123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- (in-package :stumpwm)
- (defvar *mpv-program* "mpv"
- "The name by which to invoke MPV.")
- (defparameter *mpv-headphones*
- nil
- "If non-nil use heaphones in MPV.")
- (defvar *mpv-default-arguments*
- '("--keep-open=no"))
- (defparameter *mpv-arguments*
- *mpv-default-arguments*)
- (defcommand toggle-mpv-arguments () ()
- (if *mpv-headphones*
- (progn
- (setf *mpv-arguments* *mpv-default-arguments*)
- (setf *mpv-headphones* nil))
- (progn
- (setf *mpv-arguments*
- `(,@*mpv-default-arguments*
- ,(concat "--audio-device=" *headphones*)))
- (setf *mpv-headphones* t))))
- (defcommand mpv () ()
- "Start or focus mpv."
- (let ((clipboard (get-x-selection)))
- (cond ((string-contains "youtube.com" clipboard)
- (run-shell-command (join `(,*mpv-program* ,@*mpv-arguments* ,clipboard))))
- (t (run-or-raise (join `(,*mpv-program* ,@*mpv-arguments*))
- '(:class "mpv"))))))
- (defcommand xclip-mpv () ()
- "Play video from clipboard with mpv."
- (let ((clipboard (get-x-selection)))
- (run-shell-command
- (join `(,*mpv-program* ,@*mpv-arguments* ,clipboard)))
- (message (concat "Play " clipboard))))
- (defcommand mpv-watch () ()
- "Play video from file with mpv."
- (run-shell-command
- (join `(,*mpv-program* ,@*mpv-arguments* ,(concat "$(cat " (getenv "HOME") "/watch)")))))
- (defcommand music-mpv () ()
- "Play music in MPV."
- (let ((window (current-window)))
- (if (and window (string= (window-title window) "mpv-music"))
- (other-in-frame-or-fother)
- (run-or-raise
- (join (list "mpv" "--keep-open=no" "--msg-level=all=no"
- "--no-resume-playback" "--shuffle" "--title=mpv-music"
- (concat "--input-unix-socket=" (getenv "HOME") "/.mpv/socket")
- "/srv/music/*"))
- '(:title "mpv-music")))))
- (defcommand mpv-next () ()
- (run-shell-command "mpvctl next"))
- (defcommand mpv-previous () ()
- (run-shell-command "mpvctl previous"))
- (defcommand mpv-music () ()
- (run-shell-command "mpv https://www.youtube.com/playlist?list=PLmjgicsUWIkvEKkLN01vm85neXAik3yU2"))
- (defvar *brown-noise-file*
- "/srv/video/Smoothed_Brown_Noise.m4a")
- (defcommand brown-noise () ()
- (run-shell-command
- (format nil "alacritty -e mpv --no-resume-playback ~a"
- *brown-noise-file*)))
|