Skip to content

Commit

Permalink
Integrate tab-line
Browse files Browse the repository at this point in the history
  • Loading branch information
mitch-kyle committed Dec 1, 2022
1 parent b62d5e7 commit a73e403
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 0 deletions.
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
25 changes: 25 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,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
Expand Down Expand Up @@ -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
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-mode
(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

0 comments on commit a73e403

Please sign in to comment.