mirror of
https://github.com/emacs-exwm/exwm.git
synced 2024-11-30 16:07:59 +01:00
Add some useful key bindings
* exwm-core.el (exwm--floating-mode-line-format, exwm--mode-line-format) (exwm-mode-map): * exwm-floating.el (exwm-floating-hide-mode-line) (exwm-floating-show-mode-line): * exwm-layout.el (exwm-layout-hide-mode-line, exwm-layout-show-mode-line) (exwm-layout-toggle-mode-line): Allow hide/show mode-line for all `exwm-mode' buffers with 'C-c M'. * exwm-config.el (exwm-config-default): Add simulation keys for 'C-d' and 'C-k'.
This commit is contained in:
parent
3d643fafbe
commit
e2edf81271
4 changed files with 49 additions and 33 deletions
|
@ -55,7 +55,9 @@
|
||||||
([?\C-a] . home)
|
([?\C-a] . home)
|
||||||
([?\C-e] . end)
|
([?\C-e] . end)
|
||||||
([?\M-v] . prior)
|
([?\M-v] . prior)
|
||||||
([?\C-v] . next)))
|
([?\C-v] . next)
|
||||||
|
([?\C-d] . delete)
|
||||||
|
([?\C-k] . (S-end delete))))
|
||||||
;; Enable EXWM
|
;; Enable EXWM
|
||||||
(exwm-enable)
|
(exwm-enable)
|
||||||
;; Configure Ido
|
;; Configure Ido
|
||||||
|
|
|
@ -83,7 +83,7 @@
|
||||||
(defvar-local exwm--container nil) ;container
|
(defvar-local exwm--container nil) ;container
|
||||||
(defvar-local exwm--frame nil) ;workspace frame
|
(defvar-local exwm--frame nil) ;workspace frame
|
||||||
(defvar-local exwm--floating-frame nil) ;floating frame
|
(defvar-local exwm--floating-frame nil) ;floating frame
|
||||||
(defvar-local exwm--floating-mode-line-format nil) ;save mode-line-format
|
(defvar-local exwm--mode-line-format nil) ;save mode-line-format
|
||||||
(defvar-local exwm--fullscreen nil) ;used in fullscreen
|
(defvar-local exwm--fullscreen nil) ;used in fullscreen
|
||||||
(defvar-local exwm--floating-frame-position nil) ;used in fullscreen
|
(defvar-local exwm--floating-frame-position nil) ;used in fullscreen
|
||||||
(defvar-local exwm--fixed-size nil) ;fixed size
|
(defvar-local exwm--fixed-size nil) ;fixed size
|
||||||
|
@ -122,6 +122,7 @@
|
||||||
(define-key map "\C-cm" #'exwm-floating-toggle-floating)
|
(define-key map "\C-cm" #'exwm-floating-toggle-floating)
|
||||||
(define-key map "\C-cq" #'exwm-input-send-next-key)
|
(define-key map "\C-cq" #'exwm-input-send-next-key)
|
||||||
(define-key map "\C-cv" #'exwm-workspace-move-window)
|
(define-key map "\C-cv" #'exwm-workspace-move-window)
|
||||||
|
(define-key map "\C-cM" #'exwm-layout-toggle-mode-line)
|
||||||
map)
|
map)
|
||||||
"Keymap for `exwm-mode'.")
|
"Keymap for `exwm-mode'.")
|
||||||
|
|
||||||
|
|
|
@ -248,30 +248,10 @@ are provided. You should call `xcb:flush' and restore the value of
|
||||||
(window-mode-line-height)
|
(window-mode-line-height)
|
||||||
(window-header-line-height)))))
|
(window-header-line-height)))))
|
||||||
|
|
||||||
(defun exwm-floating-hide-mode-line ()
|
(define-obsolete-function-alias 'exwm-floating-hide-mode-line
|
||||||
"Hide mode-line of a floating frame."
|
'exwm-layout-hide-mode-line "25.1" "Hide mode-line of a floating frame.")
|
||||||
(interactive)
|
(define-obsolete-function-alias 'exwm-floating-show-mode-line
|
||||||
(unless (eq major-mode 'exwm-mode)
|
'exwm-layout-show-mode-line "25.1" "Show mode-line of a floating frame.")
|
||||||
(user-error "[EXWM] Please use this command with EXWM buffers"))
|
|
||||||
(when (and exwm--floating-frame mode-line-format)
|
|
||||||
(setq exwm--floating-mode-line-format mode-line-format
|
|
||||||
mode-line-format nil)
|
|
||||||
(exwm-floating--fit-frame-to-window)
|
|
||||||
(xcb:flush exwm--connection)
|
|
||||||
(setq window-size-fixed exwm--fixed-size)))
|
|
||||||
|
|
||||||
(defun exwm-floating-show-mode-line ()
|
|
||||||
"Show mode-line of a floating frame."
|
|
||||||
(interactive)
|
|
||||||
(unless (eq major-mode 'exwm-mode)
|
|
||||||
(user-error "[EXWM] Please use this command with EXWM buffers"))
|
|
||||||
(when (and exwm--floating-frame (not mode-line-format))
|
|
||||||
(setq mode-line-format exwm--floating-mode-line-format
|
|
||||||
exwm--floating-mode-line-format nil)
|
|
||||||
(exwm-floating--fit-frame-to-window)
|
|
||||||
(exwm-input-grab-keyboard) ;mode-line-format may be outdated
|
|
||||||
(xcb:flush exwm--connection)
|
|
||||||
(setq window-size-fixed exwm--fixed-size)))
|
|
||||||
|
|
||||||
(defvar exwm-floating--moveresize-calculate nil
|
(defvar exwm-floating--moveresize-calculate nil
|
||||||
"Calculate move/resize parameters [buffer event-mask x y width height].")
|
"Calculate move/resize parameters [buffer event-mask x y width height].")
|
||||||
|
|
|
@ -392,6 +392,39 @@ See also `exwm-layout-enlarge-window'."
|
||||||
(interactive "p")
|
(interactive "p")
|
||||||
(exwm-layout-enlarge-window (- delta) t))
|
(exwm-layout-enlarge-window (- delta) t))
|
||||||
|
|
||||||
|
(defun exwm-layout-hide-mode-line ()
|
||||||
|
"Hide mode-line."
|
||||||
|
(interactive)
|
||||||
|
(when (and (eq major-mode 'exwm-mode) mode-line-format)
|
||||||
|
(setq exwm--mode-line-format mode-line-format
|
||||||
|
mode-line-format nil)
|
||||||
|
(if (not exwm--floating-frame)
|
||||||
|
(exwm-layout--show exwm--id)
|
||||||
|
(exwm-floating--fit-frame-to-window)
|
||||||
|
(xcb:flush exwm--connection)
|
||||||
|
(setq window-size-fixed exwm--fixed-size))))
|
||||||
|
|
||||||
|
(defun exwm-layout-show-mode-line ()
|
||||||
|
"Show mode-line."
|
||||||
|
(interactive)
|
||||||
|
(when (and (eq major-mode 'exwm-mode) (not mode-line-format))
|
||||||
|
(setq mode-line-format exwm--mode-line-format
|
||||||
|
exwm--mode-line-format nil)
|
||||||
|
(if (not exwm--floating-frame)
|
||||||
|
(exwm-layout--show exwm--id)
|
||||||
|
(exwm-floating--fit-frame-to-window)
|
||||||
|
(exwm-input-grab-keyboard)
|
||||||
|
(xcb:flush exwm--connection)
|
||||||
|
(setq window-size-fixed exwm--fixed-size))))
|
||||||
|
|
||||||
|
(defun exwm-layout-toggle-mode-line ()
|
||||||
|
"Toggle the display of mode-line."
|
||||||
|
(interactive)
|
||||||
|
(when (eq major-mode 'exwm-mode)
|
||||||
|
(if mode-line-format
|
||||||
|
(exwm-layout-hide-mode-line)
|
||||||
|
(exwm-layout-show-mode-line))))
|
||||||
|
|
||||||
(defun exwm-layout--init ()
|
(defun exwm-layout--init ()
|
||||||
"Initialize layout module."
|
"Initialize layout module."
|
||||||
;; Auto refresh layout
|
;; Auto refresh layout
|
||||||
|
|
Loading…
Reference in a new issue