summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/.emacs.d/init.el60
1 files changed, 34 insertions, 26 deletions
diff --git a/common/.emacs.d/init.el b/common/.emacs.d/init.el
index 0ade3ee..9c5e4f6 100644
--- a/common/.emacs.d/init.el
+++ b/common/.emacs.d/init.el
@@ -3005,38 +3005,46 @@ instead."
empv-mpv-args (cl-delete "--no-video" empv-mpv-args :test #'equal))
(defvar empv-mode-line-format
- (concat " " (propertize "%t" 'face 'bold) " " (propertize "[%p]" 'face 'italic)))
+ (concat " " (propertize "%t" 'face 'bold) " " (propertize "[%T/%D]" 'face 'italic)))
(defvar empv-mode-line-string)
(defvar empv-mode-line-timer)
(defun empv-mode-line-update ()
- (empv--let-properties
- '(time-pos
- duration
- metadata
- path)
- (if .path
- (let ((progress
- (when (and .time-pos .duration)
- (thread-last
- (/ .time-pos .duration)
- (* 100)
- (format "%d%%"))))
- (path .path))
- (let-alist .metadata
- (setq empv-mode-line-string
- (format-spec empv-mode-line-format
- `((?t . ,(or (and .TITLE
- (string-limit .TITLE 50))
- (string-limit path 50 t)))
- (?a . ,(or .ARTIST ""))
- (?A . ,(or .ALBUM ""))
- (?G . ,(or .GENRE ""))
- (?p . ,(or progress ""))))))
- (force-mode-line-update))
- (setq empv-mode-line-string ""))))
+ (cl-flet ((time-str (sec total)
+ (if (> (or total 0) (* 60 60))
+ (format-seconds "%.2h:%.2m:%.2s" (or sec 0))
+ (format-seconds "%.2m:%.2s" (or sec 0)))))
+ (empv--let-properties
+ '(time-pos
+ duration
+ metadata
+ path)
+ (if .path
+ (let ((time-pos (time-str .time-pos .duration))
+ (duration (time-str .duration .duration))
+ (progress
+ (when (and .time-pos .duration)
+ (thread-last
+ (/ .time-pos .duration)
+ (* 100)
+ (format "%d%%"))))
+ (path .path))
+ (let-alist .metadata
+ (setq empv-mode-line-string
+ (format-spec empv-mode-line-format
+ `((?t . ,(or (and .TITLE
+ (string-limit .TITLE 50))
+ (string-limit path 50 t)))
+ (?a . ,(or .ARTIST ""))
+ (?A . ,(or .ALBUM ""))
+ (?G . ,(or .GENRE ""))
+ (?p . ,(or progress ""))
+ (?T . ,(or time-pos ""))
+ (?D . ,(or duration ""))))))
+ (force-mode-line-update))
+ (setq empv-mode-line-string "")))))
(define-minor-mode empv-mode-line-mode
""