summaryrefslogtreecommitdiff
path: root/kolwynia/home/bdunahu/files/.config/emacs/modules/bd--tabs.el
diff options
context:
space:
mode:
Diffstat (limited to 'kolwynia/home/bdunahu/files/.config/emacs/modules/bd--tabs.el')
-rw-r--r--kolwynia/home/bdunahu/files/.config/emacs/modules/bd--tabs.el43
1 files changed, 43 insertions, 0 deletions
diff --git a/kolwynia/home/bdunahu/files/.config/emacs/modules/bd--tabs.el b/kolwynia/home/bdunahu/files/.config/emacs/modules/bd--tabs.el
new file mode 100644
index 0000000..6d4f12f
--- /dev/null
+++ b/kolwynia/home/bdunahu/files/.config/emacs/modules/bd--tabs.el
@@ -0,0 +1,43 @@
+;;; -*- lexical-binding: t; -*-
+;;; Commentary:
+;;; Code:
+
+
+(use-package tab-bar
+ :demand t
+ :config
+ (defun bd/get-mode-line-modes (buffer)
+ (with-current-buffer buffer
+ (format-mode-line (remove '(t erc-modified-channels-object) mode-line-modes))))
+ (defun bd/tab-bar-name-function ()
+ (concat (tab-bar-tab-name-current)
+ " "
+ (bd/get-mode-line-modes (window-buffer (minibuffer-selected-window)))))
+ (defun bd/toggle-tab-bar ()
+ (interactive)
+ (setopt tab-bar-show (not tab-bar-show))
+ ;; required to wait for the frame to update
+ (sit-for 0)
+ ;; dumb outer-gaps bug
+ (exwm-outer-gaps-apply))
+
+ (tab-bar-select-tab 1)
+ (tab-bar-mode)
+ (tab-bar-history-mode)
+ (setopt tab-bar-tab-name-function #'bd/tab-bar-name-function
+ tab-bar-show t
+
+ tab-bar-select-restore-windows nil
+
+ ;; remove useless gui elements
+ tab-bar-format
+ '(tab-bar-format-tabs)
+ tab-bar-close-button-show nil
+ tab-bar-auto-width-max nil
+
+ ;; add useless text elements
+ tab-bar-tab-hints nil))
+
+
+(provide 'bd--tabs)
+;;; bd--tabs.el ends here