Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show tab-line when tab-line-mode is enabled #899

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions exwm-core.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions exwm-floating.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -296,6 +298,12 @@ context of the corresponding buffer."
(setq frame-height (- frame-height (window-header-line-height
(frame-root-window frame)))
header-line-format nil)))

;; Hide tab-line by default but override with floating-tab-line.
(setq exwm--tab-line-format (or exwm--tab-line-format
tab-line-format)
tab-line-format floating-tab-line)

(set-frame-size frame frame-width frame-height t)
;; Create the frame container as the parent of the frame.
(xcb:+request exwm--connection
Expand Down Expand Up @@ -438,6 +446,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
Expand Down
48 changes: 48 additions & 0 deletions exwm-layout.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions exwm-manage.el
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down