From e1b778f5f5963ca02177875dea09f4a12d95741b Mon Sep 17 00:00:00 2001 From: jao Date: Sat, 8 Nov 2025 22:21:04 +0000 Subject: afio: per workspace frame parameters --- custom/jao-custom-notmuch.el | 9 ++++++++- init.el | 4 ++++ lib/eos/jao-afio.el | 25 +++++++++++++++++-------- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/custom/jao-custom-notmuch.el b/custom/jao-custom-notmuch.el index 3f714b3..dd0d4bd 100644 --- a/custom/jao-custom-notmuch.el +++ b/custom/jao-custom-notmuch.el @@ -541,7 +541,14 @@ ch--search-keys i) (advice-add 'notmuch-tree :before #'jao-notmuch-before-tree) (advice-add 'notmuch-tree-quit :after #'jao-notmuch-after-tree-quit)) - (when jao-notmuch-enabled (jao-notmuch-use-two-panes)) + (defun jao-notmuch-use-one-pane () + (interactive) + (add-to-list 'jao-afio-frame-parameters '("mail" ((width . 120)))) + (advice-remove 'notmuch-tree #'jao-notmuch-before-tree) + (advice-remove 'notmuch-tree-quit #'jao-notmuch-after-tree-quit)) + + (when jao-notmuch-enabled + (jao-d-l (jao-notmuch-use-one-pane) (jao-notmuch-use-two-panes))) :bind (:map notmuch-tree-mode-map (("b" . jao-notmuch-browse-urls) diff --git a/init.el b/init.el index 812fea8..503054e 100644 --- a/init.el +++ b/init.el @@ -1170,6 +1170,10 @@ (jao-when-linux (global-set-key (kbd "C-c t") #'jao-afio-goto-chats)) + (jao-when-darwin + (add-to-list 'jao-afio-frame-parameters + '("docs" ((width . 195) (height . 70))))) + :bind (("C-c f" . 'jao-afio-goto-main) ("C-c g" . 'jao-afio-goto-mail) ("C-c w" . 'jao-afio-goto-www) diff --git a/lib/eos/jao-afio.el b/lib/eos/jao-afio.el index 99152b0..04d31ba 100644 --- a/lib/eos/jao-afio.el +++ b/lib/eos/jao-afio.el @@ -23,6 +23,7 @@ (require 'jao-doc-session) (defvar jao-afio-use-frames (not window-system)) +(defvar jao-afio-frame-parameters nil) (defvar jao-open-doc-fun 'find-file) (defvar jao-afio-mail-function 'gnus) @@ -37,11 +38,18 @@ (when c (modify-frame-parameters f `((afio . ,c)))) (frame-parameter f 'afio)) +(defun jao-afio--set-up-frame (cfg) + (when jao-afio-use-frames + (let ((fn (jao-afio-frame-name cfg))) + (set-frame-name fn) + (when-let* ((params (cadr (assoc fn jao-afio-frame-parameters)))) + (modify-frame-parameters nil params))))) + (defun jao-afio--init (&optional f) (interactive) (jao-afio--current-config ?c) (if jao-afio-use-frames - (set-frame-name (jao-afio-frame-name ?c)) + (jao-afio--set-up-frame) (window-configuration-to-register ?c))) (defun jao-afio--check-frame () @@ -80,7 +88,7 @@ (defun jao-afio-open-doc () (interactive) (delete-other-windows) - (split-window-right) + (split-window-right 80) (let ((docs (cl-remove-if-not 'jao-doc-session-is-doc (buffer-list)))) (if (car docs) (progn (switch-to-buffer (car docs)) @@ -146,10 +154,12 @@ (defun jao-afio--open-mail (fun) (unless (get-buffer "*Calendar*") (calendar)) (delete-other-windows) - (split-window-horizontally -80) - (funcall fun) - ;; (set-window-dedicated-p nil t) - (jao-afio--mail-sidebar)) + (if (< (frame-width) 160) + (funcall fun) + (split-window-horizontally -80) + (funcall fun) + ;; (set-window-dedicated-p nil t) + (jao-afio--mail-sidebar))) ;;;###autoload (defun jao-afio-open-mail () @@ -194,8 +204,7 @@ (let ((f (jao-afio--find-frame next))) (select-frame-set-input-focus (or f (make-frame))) (when (setq reset (or reset (not f))) - (set-frame-name - (format "%s" (or (jao-afio-frame-name next) next))))) + (jao-afio--set-up-frame next))) (window-configuration-to-register (jao-afio--current-config)) (when (and (not reset) (get-register next)) (ignore-errors (jump-to-register next))) -- cgit v1.2.3