mirror of
				https://github.com/mitchell/dotfiles.git
				synced 2025-11-03 21:25:26 +00:00 
			
		
		
		
	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'
 | 
					function define_aliases -a uname -d 'Defines aliases for commonly used commands'
 | 
				
			||||||
 | 
					    alias q 'exit'
 | 
				
			||||||
    alias rcp 'rsync -aP'
 | 
					    alias rcp 'rsync -aP'
 | 
				
			||||||
    alias vg 'vagrant'
 | 
					    alias vg 'vagrant'
 | 
				
			||||||
    alias tf 'terraform'
 | 
					    alias tf 'terraform'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										7
									
								
								.config/fish/functions/glance.fish
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								.config/fish/functions/glance.fish
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -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
 | 
				
			||||||
							
								
								
									
										4
									
								
								.config/fish/functions/jmpv.fish
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								.config/fish/functions/jmpv.fish
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -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'
 | 
					function ytmpv -d 'A script to help queue youtube videos on MPV'
 | 
				
			||||||
    if not set -Uq _ytmpv_video_queue
 | 
					    set -l queue ~/.ytmpv_queue
 | 
				
			||||||
        set -U _ytmpv_video_queue
 | 
					    set -l downloads ~/.ytmpv_downloads/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if not test -f $queue
 | 
				
			||||||
 | 
					        touch $queue
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if not test -d $downloads
 | 
				
			||||||
 | 
					        mkdir $downloads
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    while read -P 'url(s)/command (play)> ' -l video
 | 
					    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
 | 
					                clear
 | 
				
			||||||
            case c copy
 | 
					            case c copy
 | 
				
			||||||
                set -l video (fromcb)
 | 
					                set -l video (fromcb)
 | 
				
			||||||
                set -U _ytmpv_video_queue $_ytmpv_video_queue (string split ' ' $video)
 | 
					                string split ' ' $video >> $queue
 | 
				
			||||||
            case d destroy
 | 
					            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
 | 
					            case f fg
 | 
				
			||||||
                tmux attach -t ytmpv
 | 
					                tmux attach -t ytmpv
 | 
				
			||||||
            case h help
 | 
					            case h help
 | 
				
			||||||
                functions ytmpv
 | 
					                functions ytmpv
 | 
				
			||||||
            case l list
 | 
					            case l list
 | 
				
			||||||
                string split ' ' $_ytmpv_video_queue
 | 
					                cat $queue
 | 
				
			||||||
            case p play
 | 
					            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
 | 
					                break
 | 
				
			||||||
            case q quit
 | 
					            case q quit
 | 
				
			||||||
                return
 | 
					                return
 | 
				
			||||||
            case '*'
 | 
					            case '*'
 | 
				
			||||||
                test -z "$video"; and break
 | 
					                if test -z "$video"
 | 
				
			||||||
                set -U _ytmpv_video_queue $_ytmpv_video_queue (string split ' ' $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
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    tmux attach -t ytmpv
 | 
					 | 
				
			||||||
    tmux new-session -s ytmpv -- mpv --save-position-on-quit $_ytmpv_video_queue
 | 
					 | 
				
			||||||
    ytmpv
 | 
					    ytmpv
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,2 +1,2 @@
 | 
				
			||||||
#!/bin/sh
 | 
					#!/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
 | 
					#!/usr/bin/sh
 | 
				
			||||||
kitty tmux new-session -s jmpv jellyfin-mpv-shim
 | 
					kitty fish -c jmpv
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue