Skip to content

Commit 02ffa33

Browse files
committed
Integrate tab-line
1 parent b62d5e7 commit 02ffa33

File tree

4 files changed

+79
-0
lines changed

4 files changed

+79
-0
lines changed

exwm-core.el

+1
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ Return a three element list with the respective results."
222222
(defvar-local exwm--frame nil) ;workspace frame
223223
(defvar-local exwm--floating-frame nil) ;floating frame
224224
(defvar-local exwm--mode-line-format nil) ;save mode-line-format
225+
(defvar-local exwm--tab-line-format nil) ;save tab-line-format
225226
(defvar-local exwm--floating-frame-position nil) ;set when hidden.
226227
(defvar-local exwm--fixed-size nil) ;fixed size
227228
(defvar-local exwm--selected-input-mode 'line-mode

exwm-floating.el

+25
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@ context of the corresponding buffer."
271271
'floating-mode-line))
272272
(floating-header-line (plist-get exwm--configurations
273273
'floating-header-line))
274+
(floating-tab-line (plist-get exwm--configurations
275+
'floating-tab-line))
274276
(border-pixel (exwm--color->pixel exwm-floating-border-color)))
275277
(if floating-mode-line
276278
(setq exwm--mode-line-format (or exwm--mode-line-format
@@ -296,6 +298,22 @@ context of the corresponding buffer."
296298
(setq frame-height (- frame-height (window-header-line-height
297299
(frame-root-window frame)))
298300
header-line-format nil)))
301+
302+
(if floating-tab-line
303+
(setq exwm--tab-line-format (or exwm--tab-line-format
304+
tab-line-format)
305+
tab-line-format floating-tab-line)
306+
(if (and (not (plist-member exwm--configurations 'floating-tab-line))
307+
exwm--mwm-hints-decorations)
308+
(when exwm--tab-line-format
309+
(setq tab-line-format exwm--tab-line-format))
310+
;; The mode-line need to be hidden in floating mode.
311+
(setq frame-height (- frame-height (window-tab-line-height
312+
(frame-root-window frame)))
313+
exwm--tab-line-format (or exwm--tab-line-format
314+
tab-line-format)
315+
tab-line-format nil)))
316+
299317
(set-frame-size frame frame-width frame-height t)
300318
;; Create the frame container as the parent of the frame.
301319
(xcb:+request exwm--connection
@@ -438,6 +456,13 @@ context of the corresponding buffer."
438456
mode-line-format)
439457
mode-line-format (plist-get exwm--configurations
440458
'tiling-mode-line)))
459+
(if (not (plist-member exwm--configurations 'tiling-tab-line))
460+
(when exwm--tab-line-format
461+
(setq tab-line-format exwm--tab-line-format))
462+
(setq exwm--tab-line-format (or exwm--tab-line-format
463+
tab-line-format)
464+
tab-line-format (plist-get exwm--configurations
465+
'tiling-tab-line)))
441466
(if (not (plist-member exwm--configurations 'tiling-header-line))
442467
(setq header-line-format nil)
443468
(setq header-line-format (plist-get exwm--configurations

exwm-layout.el

+48
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@
114114
(height (- (pop edges) y))
115115
frame-x frame-y frame-width frame-height)
116116
(with-current-buffer (exwm--id->buffer id)
117+
(when tab-line-format
118+
(setq y (+ y (window-tab-line-height window))))
117119
(when exwm--floating-frame
118120
(setq frame-width (frame-pixel-width exwm--floating-frame)
119121
frame-height (+ (frame-pixel-height exwm--floating-frame)
@@ -590,6 +592,52 @@ See also `exwm-layout-enlarge-window'."
590592
(exwm-layout-hide-mode-line)
591593
(exwm-layout-show-mode-line))))
592594

595+
;;;###autoload
596+
(defun exwm-layout-hide-tab-line ()
597+
"Hide tab-line."
598+
(interactive)
599+
(exwm--log)
600+
(when (and (derived-mode-p 'exwm-mode) tab-line-format)
601+
(let (tab-line-height)
602+
(when exwm--floating-frame
603+
(setq tab-line-height (window-tab-line-height
604+
(frame-root-window exwm--floating-frame))))
605+
(setq exwm--tab-line-format tab-line-format
606+
tab-line-format nil)
607+
(if (not exwm--floating-frame)
608+
(exwm-layout--show exwm--id)
609+
(set-frame-height exwm--floating-frame
610+
(- (frame-pixel-height exwm--floating-frame)
611+
tab-line-height)
612+
nil t)))))
613+
614+
;;;###autoload
615+
(defun exwm-layout-show-tab-line ()
616+
"Show tab-line."
617+
(interactive)
618+
(exwm--log)
619+
(when (and (derived-mode-p 'exwm-mode) (not tab-line-format))
620+
(setq tab-line-format exwm--tab-line-format
621+
exwm--tab-line-format nil)
622+
(if (not exwm--floating-frame)
623+
(exwm-layout--show exwm--id)
624+
(set-frame-height exwm--floating-frame
625+
(+ (frame-pixel-height exwm--floating-frame)
626+
(window-tab-line-height (frame-root-window
627+
exwm--floating-frame)))
628+
nil t)
629+
(call-interactively #'exwm-input-grab-keyboard))))
630+
631+
;;;###autoload
632+
(defun exwm-layout-toggle-tab-line ()
633+
"Toggle the display of tab-line."
634+
(interactive)
635+
(exwm--log)
636+
(when (derived-mode-p 'exwm-mode)
637+
(if tab-line-format
638+
(exwm-layout-hide-tab-line)
639+
(exwm-layout-show-tab-line))))
640+
593641
(defun exwm-layout--init ()
594642
"Initialize layout module."
595643
;; Auto refresh layout

exwm-manage.el

+5
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ possible choices:
6060
* fullscreen: Force full screen (non-nil) on startup.
6161
* floating-mode-line: `mode-line-format' used when floating.
6262
* tiling-mode-line: `mode-line-format' used when tiling.
63+
* floating-tab-line: `tab-line-format' used when floating.
64+
* tiling-tab-line: `tab-line-format' used when tiling.
6365
* floating-header-line: `header-line-format' used when floating.
6466
* tiling-header-line: `header-line-format' used when tiling.
6567
* char-mode: Force char-mode (non-nil) on startup.
@@ -87,6 +89,9 @@ want to match against EXWM internal variables such as `exwm-title',
8789
((const :tag "Floating mode-line" floating-mode-line)
8890
sexp)
8991
((const :tag "Tiling mode-line" tiling-mode-line) sexp)
92+
((const :tag "Floating tab-line" floating-tab-line)
93+
sexp)
94+
((const :tag "Tiling tab-line" tiling-tab-line) sexp)
9095
((const :tag "Floating header-line"
9196
floating-header-line)
9297
sexp)

0 commit comments

Comments
 (0)