summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-08-13 17:38:35 +0100
committerjao <jao@gnu.org>2022-08-13 17:38:35 +0100
commit72ba87a9df87f8a16af96c21c3dcf6c387875294 (patch)
treece6bd364f94468c308f8409c46843d6b80153efd
parent09f9cb86a017d588db3f7524b3f12f6bee22f71c (diff)
downloadxmobar-72ba87a9df87f8a16af96c21c3dcf6c387875294.tar.gz
xmobar-72ba87a9df87f8a16af96c21c3dcf6c387875294.tar.bz2
xmobar.el nits
-rw-r--r--doc/plugins.org2
-rw-r--r--etc/xmobar.el13
2 files changed, 9 insertions, 6 deletions
diff --git a/doc/plugins.org b/doc/plugins.org
index ccf5780..2199659 100644
--- a/doc/plugins.org
+++ b/doc/plugins.org
@@ -390,7 +390,7 @@
- Default template: =Freq: <cpu0>GHz=
- - This monitor requires acpi_cpufreq module to be loaded in kernel
+ - This monitor requires the ~acpi_cpufreq~ module to be loaded in kernel
- Example:
diff --git a/etc/xmobar.el b/etc/xmobar.el
index 905af3d..86f7190 100644
--- a/etc/xmobar.el
+++ b/etc/xmobar.el
@@ -54,7 +54,7 @@
:type 'string)
(defcustom xmobar-tab-bar-format
- '(xmobar-left-string tab-bar-format-align-right xmobar-right-string)
+ '(xmobar-left-string xmobar-elastic-space xmobar-right-string)
"Format for the tab bar when `xmobar-tab-bar' is t."
:type 'list)
@@ -72,10 +72,12 @@
(if (featurep 'xterm-color) #'xterm-color-filter #'ansi-color-apply))
(defvar xmobar--old-tab-format tab-bar-format)
+(defvar xmobar--len 0)
(defun xmobar-string () xmobar-string)
(defun xmobar-right-string () xmobar-string)
(defun xmobar-left-string () xmobar--left-string)
+(defun xmobar-elastic-space () (make-string (- (frame-width) xmobar--len 3) ? ))
;;;###autoload
(define-minor-mode xmobar-mode
@@ -90,8 +92,7 @@
(tab-bar-mode 1))
(or global-mode-string (setq global-mode-string '("")))
(unless (memq 'xmobar-string global-mode-string)
- (setq global-mode-string
- (append global-mode-string '(xmobar-string)))))
+ (add-to-list 'global-mode-string 'xmobar-string t)))
(xmobar--start))
(when xmobar-tab-bar (setq tab-bar-format xmobar--old-tab-format))))
@@ -101,7 +102,9 @@
(let* ((str (funcall xmobar--colorize-fn update))
(strs (and xmobar-tab-split (split-string str xmobar-tab-split))))
(setq xmobar-string (if strs (cadr strs) str)
- xmobar--left-string (or (car strs) "")))
+ xmobar--left-string (or (car strs) "")
+ xmobar--len (+ (string-width xmobar--left-string)
+ (string-width xmobar-string))))
(force-mode-line-update t)))
(defun xmobar--process-filter (proc string)
@@ -115,7 +118,7 @@
(insert string)
(set-marker (process-mark proc) (point)))
(when (string-match-p "\n$" string)
- (xmobar--update (buffer-string))
+ (xmobar--update (buffer-substring (point-min) (- (point-max) 1)))
(delete-region (point-min) (point-max)))))))
(defun xmobar--process-sentinel (proc status)