summaryrefslogtreecommitdiff
path: root/emacs/init.el
diff options
context:
space:
mode:
authorThomas Ulmer <thomasmulmer02@gmail.com>2026-01-16 22:17:11 -0800
committerThomas Ulmer <thomasmulmer02@gmail.com>2026-01-16 22:17:11 -0800
commit95a569df5a0d8127b09045ba96ff64c626f866a3 (patch)
tree1fb2adc6c4972e5c3f5faa3dc445b6d383b3f537 /emacs/init.el
parentb221bf020529fe561c27f76068aae10b8cc3f906 (diff)
emacs: fix quick layout swap to work (fail) on multiple frames
Diffstat (limited to 'emacs/init.el')
-rw-r--r--emacs/init.el17
1 files changed, 11 insertions, 6 deletions
diff --git a/emacs/init.el b/emacs/init.el
index 5c8aa17..602b2fa 100644
--- a/emacs/init.el
+++ b/emacs/init.el
@@ -271,13 +271,18 @@ With ARG, open a Dired buffer instead."
(defun my/layout-swap (&optional arg)
"Swap between the two saved window configurations.
With ARG, don't save the current layout."
- (interactive "P")
+ (interactive "p")
+ (messaghe "%s" arg)
(let ((left (car my/layout-pair))
- (right (cdr my/layout-pair)))
- (unless arg
- (setq left (current-window-configuration)))
- (set-window-configuration right t t)
- (setq my/layout-pair (cons right left))))
+ (right (cdr my/layout-pair))
+ (cwc (current-window-configuration)))
+ (cond
+ ((>= arg 16) (setq my/layout-pair (cons cwc cwc)))
+ ((eq (selected-frame) (window-configuration-frame right))
+ (unless (>= arg 4) (setq left cwc))
+ (set-window-configuration right t t)
+ (setq my/layout-pair (cons right left)))
+ (t (message "Quick layout swap only works with same frame!")))))
(progn ; my global keybinds
(define-minor-mode my/keys-mode