mirror of
https://github.com/mitchell/dotfiles.git
synced 2025-12-17 04:17:22 +00:00
Add ytmpv function and scripts folder
This commit is contained in:
parent
1604fd862e
commit
ff4007d988
5 changed files with 45 additions and 0 deletions
34
.config/fish/functions/ytmpv.fish
Normal file
34
.config/fish/functions/ytmpv.fish
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
function ytmpv -d 'A script to help queue youtube videos on MPV'
|
||||
if not set -Uq _ytmpv_video_queue
|
||||
set -U _ytmpv_video_queue
|
||||
end
|
||||
|
||||
while read -P 'url(s)/command (play)> ' -l video
|
||||
switch $video
|
||||
case cl clear
|
||||
clear
|
||||
case c copy
|
||||
set -l video (fromcb)
|
||||
set -U _ytmpv_video_queue $_ytmpv_video_queue (string split ' ' $video)
|
||||
case d destroy
|
||||
set -Ue _ytmpv_video_queue
|
||||
case f fg
|
||||
tmux attach -t ytmpv
|
||||
case h help
|
||||
functions ytmpv
|
||||
case l list
|
||||
string split ' ' $_ytmpv_video_queue
|
||||
case p play
|
||||
break
|
||||
case q quit
|
||||
return
|
||||
case '*'
|
||||
test -z "$video"; and break
|
||||
set -U _ytmpv_video_queue $_ytmpv_video_queue (string split ' ' $video)
|
||||
end
|
||||
end
|
||||
|
||||
tmux attach -t ytmpv
|
||||
tmux new-session -s ytmpv -- mpv --save-position-on-quit $_ytmpv_video_queue
|
||||
ytmpv
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue