xmobar 0.47.3 → 0.47.4
raw patch · 3 files changed
+25/−20 lines, 3 files
Files
- etc/xmobar.el +21/−16
- src/Xmobar/Plugins/Monitors/Batt/Common.hs +3/−3
- xmobar.cabal +1/−1
etc/xmobar.el view
@@ -1,6 +1,6 @@ ;; xmobar.el --- Display xmobar text output -*- lexical-binding: t -*- -;; Copyright 2022 jao <jao@gnu.org>+;; Copyright 2022, 2024 jao <jao@gnu.org> ;; Version: 0.0.1 ;; Package-Requires: ((emacs "28.1")) ;; Keywords: unix@@ -98,28 +98,33 @@ (defun xmobar--update (update) "Apply an UPDATE to the xmobar bar."- (when xmobar-mode- (let* ((str (funcall xmobar--colorize-fn update))+ (when (and xmobar-mode update)+ (let* ((str (or (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--len (+ (string-width xmobar--left-string)- (string-width xmobar-string))))+ xmobar--len (+ (string-width (or xmobar--left-string ""))+ (string-width (or xmobar-string ""))))) (force-mode-line-update t))) (defun xmobar--process-filter (proc string) "Process output from the xmobar process."- (let ((buf (process-buffer proc)))- (when (buffer-live-p buf)- (with-current-buffer buf- ;; Write the input to the buffer (might be partial).- (save-excursion- (goto-char (process-mark proc))- (insert string)- (set-marker (process-mark proc) (point)))- (when (string-match-p "\n$" string)- (xmobar--update (buffer-substring (point-min) (- (point-max) 1)))- (delete-region (point-min) (point-max)))))))+ (when string+ (let ((buf (process-buffer proc)))+ (condition-case err+ (when (buffer-live-p buf)+ (with-current-buffer buf+ ;; Write the input to the buffer (might be partial).+ (save-excursion+ (goto-char (process-mark proc))+ (insert string)+ (set-marker (process-mark proc) (point)))+ (when (string-match-p "\n$" string)+ (xmobar--update (buffer-substring (point-min) (- (point-max) 1)))+ (delete-region (point-min) (point-max)))))+ (error (message "Error running xmobar filter: %s"+ (error-message-string err))+ (xmobar--stop)))))) (defun xmobar--process-sentinel (proc status) "Handle events from the xmobar process (PROC).
src/Xmobar/Plugins/Monitors/Batt/Common.hs view
@@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Plugins.Monitors.Batt.Common--- Copyright : (c) 2010, 2011, 2012, 2013, 2015, 2016, 2018, 2019 Jose A Ortega+-- Copyright : (c) 2010-2016, 2018, 2019, 2024 Jose A Ortega -- (c) 2010 Andrea Rossato, Petr Rockai -- License : BSD-style (see LICENSE) --@@ -18,7 +18,7 @@ , Status(..) , maybeAlert) where -import System.Process (system)+import System.Process (spawnCommand) import Control.Monad (unless, void) import Xmobar.Plugins.Monitors.Common @@ -54,4 +54,4 @@ case onLowAction opts of Nothing -> return () Just x -> unless (isNaN left || actionThreshold opts < 100 * left)- $ void $ system x+ $ void $ spawnCommand x
xmobar.cabal view
@@ -1,5 +1,5 @@ name: xmobar-version: 0.47.3+version: 0.47.4 homepage: https://codeberg.org/xmobar/xmobar synopsis: A Minimalistic Text Based Status Bar description: Xmobar is a minimalistic text based status bar.