mirror of https://github.com/mitchell/dotfiles.git
Add alias and refactor scripts/
This commit is contained in:
parent
bbc105cede
commit
aaf67bea46
|
@ -1,4 +1,5 @@
|
|||
function define_aliases -a uname -d 'Defines aliases for commonly used commands'
|
||||
alias q 'exit'
|
||||
alias rcp 'rsync -aP'
|
||||
alias vg 'vagrant'
|
||||
alias tf 'terraform'
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
function glance -d 'Open glances on a preset of machines'
|
||||
tmux new -s glance mosh arch@khetanna.lan -- glances --disable-process --sparkline\; \
|
||||
neww mosh arch@kamino.lan -- glances --disable-process --sparkline\; \
|
||||
neww mosh arch@marauder.lan -- glances --disable-process --sparkline\; \
|
||||
neww mosh serenity.lan -- glances --disable-process --sparkline
|
||||
or tmux attach-session -t glance
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
function jmpv -d 'Open jellyfin-mpv-shim in a tmux session of its own'
|
||||
tmux new-session -s jmpv jellyfin-mpv-shim
|
||||
or tmux attach-session -t jmpv
|
||||
end
|
|
@ -1,6 +1,13 @@
|
|||
function ytmpv -d 'A script to help queue youtube videos on MPV'
|
||||
if not set -Uq _ytmpv_video_queue
|
||||
set -U _ytmpv_video_queue
|
||||
set -l queue ~/.ytmpv_queue
|
||||
set -l downloads ~/.ytmpv_downloads/
|
||||
|
||||
if not test -f $queue
|
||||
touch $queue
|
||||
end
|
||||
|
||||
if not test -d $downloads
|
||||
mkdir $downloads
|
||||
end
|
||||
|
||||
while read -P 'url(s)/command (play)> ' -l video
|
||||
|
@ -9,26 +16,51 @@ function ytmpv -d 'A script to help queue youtube videos on MPV'
|
|||
clear
|
||||
case c copy
|
||||
set -l video (fromcb)
|
||||
set -U _ytmpv_video_queue $_ytmpv_video_queue (string split ' ' $video)
|
||||
string split ' ' $video >> $queue
|
||||
case d destroy
|
||||
set -Ue _ytmpv_video_queue
|
||||
rm -r $queue $downloads
|
||||
break
|
||||
case dl download
|
||||
set -l urls (cat $queue)
|
||||
read -P 'username> ' -l username
|
||||
read -P 'password> ' -s -l password
|
||||
|
||||
tmux attach -t ytdlp
|
||||
tmux new-session -s ytdlp -- \
|
||||
yt-dlp \
|
||||
--username="$username" \
|
||||
--password="$password" \
|
||||
--paths=$downloads \
|
||||
--write-subs \
|
||||
$urls
|
||||
|
||||
break
|
||||
case f fg
|
||||
tmux attach -t ytmpv
|
||||
case h help
|
||||
functions ytmpv
|
||||
case l list
|
||||
string split ' ' $_ytmpv_video_queue
|
||||
cat $queue
|
||||
case p play
|
||||
tmux attach -t ytmpv
|
||||
tmux new-session -s ytmpv -- mpv --save-position-on-quit --playlist=$queue
|
||||
break
|
||||
case pdl play-downloads
|
||||
tmux attach -t ytmpv
|
||||
tmux new-session -s ytmpv -- mpv --save-position-on-quit $downloads
|
||||
break
|
||||
case q quit
|
||||
return
|
||||
case '*'
|
||||
test -z "$video"; and break
|
||||
set -U _ytmpv_video_queue $_ytmpv_video_queue (string split ' ' $video)
|
||||
if test -z "$video"
|
||||
tmux attach -t ytmpv
|
||||
tmux new-session -s ytmpv -- mpv --save-position-on-quit --playlist=$queue
|
||||
break
|
||||
end
|
||||
|
||||
string split ' ' $video >> $queue
|
||||
end
|
||||
end
|
||||
|
||||
tmux attach -t ytmpv
|
||||
tmux new-session -s ytmpv -- mpv --save-position-on-quit $_ytmpv_video_queue
|
||||
ytmpv
|
||||
end
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#!/bin/sh
|
||||
kitty tmux new -s glance mosh arch@khetanna.lan -- glances --sparkline\; neww mosh serenity.lan -- glances --sparkline
|
||||
kitty fish -C glance
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#!/usr/bin/sh
|
||||
kitty tmux new-session -s jmpv jellyfin-mpv-shim
|
||||
kitty fish -c jmpv
|
||||
|
|
Loading…
Reference in New Issue