diff options
author | Thanos Apollo <[email protected]> | 2024-04-06 20:43:08 +0300 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2024-04-06 20:43:08 +0300 |
commit | ed7807cb7c8de3133cd1b503c0bbdeced1a5e6ab (patch) | |
tree | 97aa9bb83368d9ffcfca74d4675224b2d4c7eeaa | |
parent | 56755f394d2130b58f128ebb099584b8e1392b11 (diff) |
yeetube-mpv: Add yeetube-mpv-modeline-mode
-rw-r--r-- | yeetube-mpv.el | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/yeetube-mpv.el b/yeetube-mpv.el index 141e6e9..4bab5e9 100644 --- a/yeetube-mpv.el +++ b/yeetube-mpv.el @@ -46,6 +46,12 @@ Accepted values include: 1080, 720, 480, 360, 240, 144") (defvar yeetube-mpv-currently-playing nil "Currently playing information.") +(defun yeetube-mpv-modeline-string () + "Return modeline string for yeetube-mpv." + (if yeetube-mpv-currently-playing + (format "%s" yeetube-mpv-currently-playing) + "nil")) + (defun yeetube-mpv-change-video-quality () "Change video quality." (interactive) @@ -103,6 +109,22 @@ to play local files." "yeetube: Starting mpv process")) (setf yeetube-mpv-currently-playing (format "[%s]" info)))) +(define-minor-mode yeetube-mpv-modeline-mode + "Minor mode for showing currently playing information on the modeline." + :global t + :group 'yeetube + :lighter nil + (if yeetube-mpv-modeline-mode + (progn + (add-to-list 'global-mode-string '(:eval + (format " ♫:%s" (yeetube-mpv-modeline-string)))) + (force-mode-line-update)) + (setf global-mode-string + (seq-remove (lambda (item) + (and (listp item) (eq (car item) :eval) + (string-prefix-p " ♫:" (format "%s" (eval (cadr item)))))) + global-mode-string)) + (force-mode-line-update))) (defun yeetube-mpv-toggle-no-video-flag () "Toggle no video flag for mpv player." |