[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/minibar 37699eb25e 08/17: Don't use undocumented data in b
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/minibar 37699eb25e 08/17: Don't use undocumented data in battery module |
Date: |
Sun, 27 Nov 2022 16:01:37 -0500 (EST) |
branch: elpa/minibar
commit 37699eb25e5f66d63286e46934f733741afc87e3
Author: Akib Azmain Turja <akib@disroot.org>
Commit: Akib Azmain Turja <akib@disroot.org>
Don't use undocumented data in battery module
---
minibar.el | 50 ++++++++++++++++++++++++++++++--------------------
1 file changed, 30 insertions(+), 20 deletions(-)
diff --git a/minibar.el b/minibar.el
index 01e6b92ee9..3e605c0394 100644
--- a/minibar.el
+++ b/minibar.el
@@ -188,22 +188,22 @@ it was recorded.")
(funcall battery-status-function))))
(when (and (listp status)
(assq ?p status)
- (assq ?L status)
+ (assq ?B status)
(assq ?h status)
(assq ?m status))
(let ((load (floor (string-to-number (alist-get ?p status))))
- (charging (string= (alist-get ?L status) "AC"))
+ (state (alist-get ?b status))
(remaining-hours (string-to-number (alist-get ?h status)))
(remaining-minutes (mod (string-to-number
(alist-get ?m status))
60)))
(concat
(if (and (< load minibar-module-battery-low-threshold)
- (not charging))
+ (not (zerop (length state))))
(propertize (format "%i%%" load) 'face
'minibar-module-battery-low-face)
(format "%s%%" load))
- (if charging "+" " ")
+ (format "%1s" state)
(if (eq load 100)
"(full)"
(format "(%02i:%02i)" remaining-hours
@@ -422,13 +422,13 @@ it was recorded.")
(format
"%3i%%%s"
(minibar--module-cpu-calculate-load "cpu")
- (if (and (char-displayable-p ?█) ;; #x2588
- (char-displayable-p ?▇) ;; #x2587
- (char-displayable-p ?▆) ;; #x2586
- (char-displayable-p ?▅) ;; #x2585
- (char-displayable-p ?▄) ;; #x2584
- (char-displayable-p ?▃) ;; #x2583
- (char-displayable-p ?▂)) ;; #x2582
+ (if (or (char-displayable-p ?█) ; #x2588
+ (char-displayable-p ?▇) ; #x2587
+ (char-displayable-p ?▆) ; #x2586
+ (char-displayable-p ?▅) ; #x2585
+ (char-displayable-p ?▄) ; #x2584
+ (char-displayable-p ?▃) ; #x2583
+ (char-displayable-p ?▂)) ; #x2582
(concat
" "
(mapconcat
@@ -436,23 +436,33 @@ it was recorded.")
(let ((load (minibar--module-cpu-calculate-load
(format "cpu%i" i))))
(cond
- ((>= load 87.5)
+ ((and (char-displayable-p ?█) ; #x2588
+ (>= load 87.5))
(propertize "█" 'face 'bold))
- ((>= load 75)
+ ((and (char-displayable-p ?▇) ; #x2587
+ (>= load 75))
(propertize "▇" 'face 'bold))
- ((>= load 62.5)
+ ((and (char-displayable-p ?▆) ; #x2586
+ (>= load 62.5))
(propertize "▆" 'face 'bold))
- ((>= load 50)
+ ((and (char-displayable-p ?▅) ; #x2585
+ (>= load 50))
(propertize "▅" 'face 'bold))
- ((>= load 37.5)
+ ((and (char-displayable-p ?▄) ; #x2584
+ (>= load 37.5))
(propertize "▄" 'face 'bold))
- ((>= load 25)
+ ((and (char-displayable-p ?▃) ; #x2583
+ (>= load 25))
(propertize "▃" 'face 'bold))
- ((>= load 12.5)
+ ((and (char-displayable-p ?▂) ; #x2582
+ (>= load 12.5))
(propertize "▂" 'face 'bold))
- (t
+ (t ; (char-displayable-p ? ) => t
(propertize
- (string #x2581) 'face
+ (if (char-displayable-p ?▁) ; #x2581
+ "▁"
+ " ")
+ 'face
'(:weight bold :inherit font-lock-comment-face))))))
(number-sequence 0 (1- minibar--module-cpu-count)) ""))
"")))
- [nongnu] elpa/minibar 5e8afde8f7 13/17: Don't run module functions in temp buffer, (continued)
- [nongnu] elpa/minibar 5e8afde8f7 13/17: Don't run module functions in temp buffer, ELPA Syncer, 2022/11/27
- [nongnu] elpa/minibar 1da37a9286 12/17: Update install instructions, ELPA Syncer, 2022/11/27
- [nongnu] elpa/minibar 46f3307cc9 10/17: Fix wrong argument order, ELPA Syncer, 2022/11/27
- [nongnu] elpa/minibar 8775f1584c 09/17: Use idle timer, ELPA Syncer, 2022/11/27
- [nongnu] elpa/minibar 9d650e3c71 14/17: Fix group positioning in minibuffer, ELPA Syncer, 2022/11/27
- [nongnu] elpa/minibar 3913de72e0 15/17: Try to make all lines less than 75 characters width, ELPA Syncer, 2022/11/27
- [nongnu] elpa/minibar 9d1a459684 04/17: Don't depend on minibuffer-line, ELPA Syncer, 2022/11/27
- [nongnu] elpa/minibar f228469970 06/17: Use char-displayable-p instead of display-graphic-p, ELPA Syncer, 2022/11/27
- [nongnu] elpa/minibar 0b02619c7f 11/17: Don't stop updating after first update after idle, ELPA Syncer, 2022/11/27
- [nongnu] elpa/minibar 45824cb137 17/17: Simplify character choosing logic in CPU module, ELPA Syncer, 2022/11/27
- [nongnu] elpa/minibar 37699eb25e 08/17: Don't use undocumented data in battery module,
ELPA Syncer <=
- [nongnu] elpa/minibar 15896aa33a 16/17: Add .dir-locals.el, ELPA Syncer, 2022/11/27