diff options
Diffstat (limited to 'lib/eos/jao-afio.el')
| -rw-r--r-- | lib/eos/jao-afio.el | 32 |
1 files changed, 26 insertions, 6 deletions
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) |
