Use built-in vuiet mode-line updating and fix vuiet hydra

This commit is contained in:
Jeremy Dormitzer 2020-05-19 12:15:41 -04:00
parent a4509dda0e
commit 7e3b545dd7

View File

@ -6205,29 +6205,17 @@ A music browser and player:
(use-package vuiet
:straight (vuiet :host github :repo "mihaiolteanu/vuiet")
:commands (vuiet-track-artist
vuiet-track-name
vuiet-track-duration
vuiet--playing-track)
vuiet-track-name
vuiet-track-duration
vuiet--playing-track)
:defer t
:config
(setq vuiet-update-mode-line-automatically t
vuiet-update-mode-line-interval 1)
(defun vuiet-mode-setup ()
(set (make-local-variable 'org-link-elisp-confirm-function)
nil))
nil))
(add-hook 'vuiet-mode-hook #'vuiet-mode-setup)
(defun vuiet-safe-update-mode-line ()
(interactive)
(with-local-quit
(ignore-errors
(vuiet-update-mode-line))))
(defvar vuiet-mode-line-update-timer nil)
(defun vuiet-reset-mode-line ()
(interactive)
(when vuiet-mode-line-update-timer
(cancel-timer vuiet-mode-line-update-timer))
(vuiet-safe-update-mode-line)
(setq vuiet-mode-line-update-timer
(run-at-time t 1 #'vuiet-safe-update-mode-line)))
(vuiet-reset-mode-line)
:general
((normal motion visual) vuiet-mode-map "q" #'quit-window)
((normal motion visual) vuiet-mode-map "C-m" #'org-open-at-point))
@ -6256,7 +6244,7 @@ And a handy hydra for it:
(format-time-string "%M:%S" (condition-case nil
(mpv-get-playback-position)
(error 0)))
(format-time-string "%M:%S" (vuiet-track-duration track)))
(s-pad-left 5 "0" (vuiet-track-duration track)))
"[00:00/00:00]"))
(defvar hydra-vuiet-body-timer)