Emacs: EXWM: exwm-layout-toggle-fullscreen-or-single-window
parent
1e65664601
commit
b3302777ef
|
@ -36,14 +36,21 @@
|
||||||
(exwm-input-set-key (kbd "s-f") #'find-file)
|
(exwm-input-set-key (kbd "s-f") #'find-file)
|
||||||
(exwm-input-set-key (kbd "s-SPC") #'exwm-floating-toggle-floating)
|
(exwm-input-set-key (kbd "s-SPC") #'exwm-floating-toggle-floating)
|
||||||
|
|
||||||
(defun exwm-layout-toggle-fullscreen-or-delete-other-windows ()
|
(defvar exwm--last-window-configuration nil "Last window configuration before calling `delete-other-windows'.")
|
||||||
|
(defun exwm-layout-toggle-fullscreen-or-single-window ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(if (eq major-mode 'exwm-mode)
|
(if (eq major-mode 'exwm-mode)
|
||||||
(exwm-layout-toggle-fullscreen)
|
(exwm-layout-toggle-fullscreen)
|
||||||
;; TODO: A toggle would be nice, so that pressing s-o again would restore the deleted windows.
|
;; TODO: Store window configurations in a buffer-name-indexed alist? Not
|
||||||
;; Use register?
|
;; sure that would ever be useful.
|
||||||
(delete-other-windows)))
|
;; TODO: Make the following a `toggle-single-window' defun and store in functions.el?
|
||||||
(exwm-input-set-key (kbd "s-o") #'exwm-layout-toggle-fullscreen-or-delete-other-windows)
|
(if (/= (count-windows) 1)
|
||||||
|
(progn
|
||||||
|
(setq exwm--last-window-configuration (current-window-configuration))
|
||||||
|
(delete-other-windows))
|
||||||
|
(when exwm--last-window-configuration
|
||||||
|
(set-window-configuration exwm--last-window-configuration)))))
|
||||||
|
(exwm-input-set-key (kbd "s-o") #'exwm-layout-toggle-fullscreen-or-single-window)
|
||||||
|
|
||||||
(when (require 'functions)
|
(when (require 'functions)
|
||||||
(exwm-input-set-key (kbd "s-\\") #'toggle-window-split))
|
(exwm-input-set-key (kbd "s-\\") #'toggle-window-split))
|
||||||
|
|
Loading…
Reference in New Issue