summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--init.el3
-rw-r--r--lib/eos/jao-afio.el32
2 files changed, 28 insertions, 7 deletions
diff --git a/init.el b/init.el
index 3a55830..152eda9 100644
--- a/init.el
+++ b/init.el
@@ -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)