Integrate tab-line

This commit is contained in:
mitch-kyle 2022-11-30 21:00:01 -04:00
parent b62d5e79b0
commit 02ffa3359c
4 changed files with 79 additions and 0 deletions

View file

@ -222,6 +222,7 @@ Return a three element list with the respective results."
(defvar-local exwm--frame nil) ;workspace frame
(defvar-local exwm--floating-frame nil) ;floating frame
(defvar-local exwm--mode-line-format nil) ;save mode-line-format
(defvar-local exwm--tab-line-format nil) ;save tab-line-format
(defvar-local exwm--floating-frame-position nil) ;set when hidden.
(defvar-local exwm--fixed-size nil) ;fixed size
(defvar-local exwm--selected-input-mode 'line-mode

View file

@ -271,6 +271,8 @@ context of the corresponding buffer."
'floating-mode-line))
(floating-header-line (plist-get exwm--configurations
'floating-header-line))
(floating-tab-line (plist-get exwm--configurations
'floating-tab-line))
(border-pixel (exwm--color->pixel exwm-floating-border-color)))
(if floating-mode-line
(setq exwm--mode-line-format (or exwm--mode-line-format
@ -296,6 +298,22 @@ context of the corresponding buffer."
(setq frame-height (- frame-height (window-header-line-height
(frame-root-window frame)))
header-line-format nil)))
(if floating-tab-line
(setq exwm--tab-line-format (or exwm--tab-line-format
tab-line-format)
tab-line-format floating-tab-line)
(if (and (not (plist-member exwm--configurations 'floating-tab-line))
exwm--mwm-hints-decorations)
(when exwm--tab-line-format
(setq tab-line-format exwm--tab-line-format))
;; The mode-line need to be hidden in floating mode.
(setq frame-height (- frame-height (window-tab-line-height
(frame-root-window frame)))
exwm--tab-line-format (or exwm--tab-line-format
tab-line-format)
tab-line-format nil)))
(set-frame-size frame frame-width frame-height t)
;; Create the frame container as the parent of the frame.
(xcb:+request exwm--connection
@ -438,6 +456,13 @@ context of the corresponding buffer."
mode-line-format)
mode-line-format (plist-get exwm--configurations
'tiling-mode-line)))
(if (not (plist-member exwm--configurations 'tiling-tab-line))
(when exwm--tab-line-format
(setq tab-line-format exwm--tab-line-format))
(setq exwm--tab-line-format (or exwm--tab-line-format
tab-line-format)
tab-line-format (plist-get exwm--configurations
'tiling-tab-line)))
(if (not (plist-member exwm--configurations 'tiling-header-line))
(setq header-line-format nil)
(setq header-line-format (plist-get exwm--configurations

View file

@ -114,6 +114,8 @@
(height (- (pop edges) y))
frame-x frame-y frame-width frame-height)
(with-current-buffer (exwm--id->buffer id)
(when tab-line-format
(setq y (+ y (window-tab-line-height window))))
(when exwm--floating-frame
(setq frame-width (frame-pixel-width exwm--floating-frame)
frame-height (+ (frame-pixel-height exwm--floating-frame)
@ -590,6 +592,52 @@ See also `exwm-layout-enlarge-window'."
(exwm-layout-hide-mode-line)
(exwm-layout-show-mode-line))))
;;;###autoload
(defun exwm-layout-hide-tab-line ()
"Hide tab-line."
(interactive)
(exwm--log)
(when (and (derived-mode-p 'exwm-mode) tab-line-format)
(let (tab-line-height)
(when exwm--floating-frame
(setq tab-line-height (window-tab-line-height
(frame-root-window exwm--floating-frame))))
(setq exwm--tab-line-format tab-line-format
tab-line-format nil)
(if (not exwm--floating-frame)
(exwm-layout--show exwm--id)
(set-frame-height exwm--floating-frame
(- (frame-pixel-height exwm--floating-frame)
tab-line-height)
nil t)))))
;;;###autoload
(defun exwm-layout-show-tab-line ()
"Show tab-line."
(interactive)
(exwm--log)
(when (and (derived-mode-p 'exwm-mode) (not tab-line-format))
(setq tab-line-format exwm--tab-line-format
exwm--tab-line-format nil)
(if (not exwm--floating-frame)
(exwm-layout--show exwm--id)
(set-frame-height exwm--floating-frame
(+ (frame-pixel-height exwm--floating-frame)
(window-tab-line-height (frame-root-window
exwm--floating-frame)))
nil t)
(call-interactively #'exwm-input-grab-keyboard))))
;;;###autoload
(defun exwm-layout-toggle-tab-line ()
"Toggle the display of tab-line."
(interactive)
(exwm--log)
(when (derived-mode-p 'exwm-mode)
(if tab-line-format
(exwm-layout-hide-tab-line)
(exwm-layout-show-tab-line))))
(defun exwm-layout--init ()
"Initialize layout module."
;; Auto refresh layout

View file

@ -60,6 +60,8 @@ possible choices:
* fullscreen: Force full screen (non-nil) on startup.
* floating-mode-line: `mode-line-format' used when floating.
* tiling-mode-line: `mode-line-format' used when tiling.
* floating-tab-line: `tab-line-format' used when floating.
* tiling-tab-line: `tab-line-format' used when tiling.
* floating-header-line: `header-line-format' used when floating.
* tiling-header-line: `header-line-format' used when tiling.
* char-mode: Force char-mode (non-nil) on startup.
@ -87,6 +89,9 @@ want to match against EXWM internal variables such as `exwm-title',
((const :tag "Floating mode-line" floating-mode-line)
sexp)
((const :tag "Tiling mode-line" tiling-mode-line) sexp)
((const :tag "Floating tab-line" floating-tab-line)
sexp)
((const :tag "Tiling tab-line" tiling-tab-line) sexp)
((const :tag "Floating header-line"
floating-header-line)
sexp)