diff --git a/exwm-core.el b/exwm-core.el index 75c7c1b..2f8e001 100644 --- a/exwm-core.el +++ b/exwm-core.el @@ -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 diff --git a/exwm-floating.el b/exwm-floating.el index 69e86a2..0bd5363 100644 --- a/exwm-floating.el +++ b/exwm-floating.el @@ -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 diff --git a/exwm-layout.el b/exwm-layout.el index ea186fe..5ce086d 100644 --- a/exwm-layout.el +++ b/exwm-layout.el @@ -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 diff --git a/exwm-manage.el b/exwm-manage.el index c3d47f7..240a817 100644 --- a/exwm-manage.el +++ b/exwm-manage.el @@ -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)