diff options
| author | jao <jao@gnu.org> | 2025-11-19 17:40:01 +0000 |
|---|---|---|
| committer | jao <jao@gnu.org> | 2025-11-19 17:40:01 +0000 |
| commit | 0bf664c5a05534bdf12a698c2c18f325f090d0a6 (patch) | |
| tree | 4c5bd497f7fb541a22b62d132742179b5f658cb7 | |
| parent | 486d8c72c3536537de0d660c6811a376a24f3bf4 (diff) | |
| download | elibs-0bf664c5a05534bdf12a698c2c18f325f090d0a6.tar.gz elibs-0bf664c5a05534bdf12a698c2c18f325f090d0a6.tar.bz2 | |
experimental afio configs
| -rw-r--r-- | init.el | 3 | ||||
| -rw-r--r-- | lib/eos/jao-afio.el | 32 |
2 files changed, 28 insertions, 7 deletions
@@ -1957,7 +1957,8 @@ ("g" "mail" jao-afio-goto-mail) ("z" "docs" jao-afio-goto-docs) ("w" "wwww" jao-afio-goto-www) - ("f" "main" jao-afio-goto-main)] + ("f" "main" jao-afio-goto-main) + ("a" "save configuration" jao-afio-save-configuration)] ["Network" ("s" "ssh" jao-ssh) ("r" "r2e" jao-r2e) diff --git a/lib/eos/jao-afio.el b/lib/eos/jao-afio.el index 1099344..68c8166 100644 --- a/lib/eos/jao-afio.el +++ b/lib/eos/jao-afio.el @@ -34,6 +34,23 @@ (defvar jao-afio--configs '(?c ?w ?g ?p ?s ?t)) (defvar jao-afio--previous-config (car jao-afio--configs)) +(define-multisession-variable jao-afio-configurations nil) + +(defun jao-afio--current-wc () + (window-state-get (frame-root-window) t)) + +(defun jao-afio-save-configuration () + (interactive) + (when-let* ((c (jao-afio--current-config))) + (setf (alist-get c (multisession-value jao-afio-configurations)) + (jao-afio--current-wc)) + (message "Configuration of %s saved" (jao-afio-frame-name c)))) + +(defun jao-afio-restore-configuration (c) + (when-let ((c (alist-get c (multisession-value jao-afio-configurations)))) + (window-state-put c) + t)) + (defun jao-afio--current-config (&optional c f) (when c (modify-frame-parameters f `((afio . ,c)))) (frame-parameter f 'afio)) @@ -171,12 +188,15 @@ ;;;###autoload (defun jao-afio-reset () (interactive) - (delete-other-windows) - (cl-case (jao-afio--current-config) - (?w (jao-afio-open-www)) - (?g (jao-afio-open-mail)) - (?p (jao-afio-open-doc)) - (t (jao-afio-trisect)))) + (let ((c (jao-afio--current-config))) + (unless (jao-afio-restore-configuration c) + (delete-other-windows) + (cl-case (jao-afio--current-config) + (?w (jao-afio-open-www)) + (?g (jao-afio-open-mail)) + (?p (jao-afio-open-doc)) + (t (jao-afio-trisect))) + (jao-afio-save-configuration)))) ;;; go to frame (defsubst jao-afio--find-frame (c) |
