mirror of
https://github.com/mitchell/dotfiles.git
synced 2026-08-10 08:09:35 +00:00
refactor: rename period-prefixed files to dot-<filename>
This commit is contained in:
parent
341cdd5b9e
commit
16201f13c2
49 changed files with 0 additions and 0 deletions
23
fish/dot-config/fish/conf.d/define_aliases.fish
Normal file
23
fish/dot-config/fish/conf.d/define_aliases.fish
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
if status is-interactive
|
||||
alias q exit
|
||||
alias cl clear
|
||||
alias ls lsd
|
||||
alias rcp 'rsync -aP'
|
||||
alias ssh-rm 'ssh-keygen -f ~/.ssh/known_hosts -R'
|
||||
alias age-p 'age --armor --passphrase'
|
||||
alias age-d 'age --decrypt --identity ~/.secrets/id_ed25519'
|
||||
alias age-e 'age --armor --recipient (cat ~/.secrets/id_ed25519.pub)'
|
||||
alias age-k 'age --decrypt --identity ~/.secrets/id_ed25519 ~/.secrets/age_keys.age'
|
||||
alias kp 'keepassxc-cli show -k ~/.secrets/mjfs_keepass_key_file ~/.passwords/mjfs.kdbx'
|
||||
|
||||
switch (uname)
|
||||
case Linux
|
||||
alias sctl 'sudo systemctl'
|
||||
alias uctl 'systemctl --user'
|
||||
alias bctl bluetoothctl
|
||||
alias fwl 'sudo firewall-cmd'
|
||||
alias vv 'virt-viewer'
|
||||
alias vi 'virt-install'
|
||||
alias vs 'virsh'
|
||||
end
|
||||
end
|
||||
36
fish/dot-config/fish/conf.d/define_global_variables.fish
Normal file
36
fish/dot-config/fish/conf.d/define_global_variables.fish
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
set -gx EDITOR nvim
|
||||
set -gx BROWSER firefox
|
||||
set -gx DIFFPROG delta
|
||||
|
||||
set -gx FZF_CTRL_T_COMMAND 'fd --type f --type d --hidden --exclude ".git/"'
|
||||
set -gx FZF_DEFAULT_COMMAND 'fd --type f --type d --hidden --exclude ".git/"'
|
||||
set -gx FZF_ALT_C_COMMAND 'fd --type d --hidden --exclude ".git/"'
|
||||
|
||||
set -gx GOPATH $HOME/code/go
|
||||
set -gx GOBIN $GOPATH/bin
|
||||
|
||||
set -gx BUN_INSTALL $HOME/.bun
|
||||
set -gx PNPM_HOME $HOME/.local/share/pnpm
|
||||
|
||||
set -gx LIBVIRT_DEFAULT_URI 'qemu:///system'
|
||||
|
||||
if test (uname) = Darwin
|
||||
set -gx ANDROID_HOME $HOME/Library/Android/Sdk
|
||||
else
|
||||
set -gx ANDROID_HOME $HOME/Android/Sdk
|
||||
end
|
||||
|
||||
set -gx PYENV_ROOT $HOME/.pyenv
|
||||
|
||||
fish_add_path --global $GOBIN \
|
||||
$HOME/.local/bin \
|
||||
$HOME/.pub-cache/bin \
|
||||
$HOME/code/scripts \
|
||||
$HOME/code/flutter/bin \
|
||||
$HOME/.cargo/bin \
|
||||
$HOME/.dotnet/tools \
|
||||
$BUN_INSTALL/bin \
|
||||
$PNPM_HOME/bin \
|
||||
$PYENV_ROOT/bin \
|
||||
$ANDROID_HOME/emulator \
|
||||
$ANDROID_HOME/platform-tools
|
||||
38
fish/dot-config/fish/conf.d/fish_frozen_theme.fish
Normal file
38
fish/dot-config/fish/conf.d/fish_frozen_theme.fish
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
if status is-interactive
|
||||
set --global fish_color_autosuggestion 727169 brblack
|
||||
set --global fish_color_cancel -r
|
||||
set --global fish_color_command 957FB8 magenta
|
||||
set --global fish_color_comment 727169 brblack
|
||||
set --global fish_color_cwd green
|
||||
set --global fish_color_cwd_root red
|
||||
set --global fish_color_end FF9E64 brred
|
||||
set --global fish_color_error C34043 red
|
||||
set --global fish_color_escape D27E99 brmagenta
|
||||
set --global fish_color_history_current --bold
|
||||
set --global fish_color_host normal
|
||||
set --global fish_color_host_remote yellow
|
||||
set --global fish_color_keyword D27E99 brmagenta
|
||||
set --global fish_color_normal DCD7BA normal
|
||||
set --global fish_color_operator 7AA89F cyan
|
||||
set --global fish_color_param DCD7BA normal
|
||||
set --global fish_color_quote C0A36E yellow
|
||||
set --global fish_color_redirection 76946A green
|
||||
set --global fish_color_search_match --background=2D4F67 --background=brcyan
|
||||
set --global fish_color_selection --background=2D4F67 --background=brcyan
|
||||
set --global fish_color_status red
|
||||
set --global fish_color_user brgreen
|
||||
set --global fish_color_valid_path --underline
|
||||
set --global fish_pager_color_background
|
||||
set --global fish_pager_color_completion DCD7BA normal
|
||||
set --global fish_pager_color_description 727169 brblack
|
||||
set --global fish_pager_color_prefix 957FB8 magenta
|
||||
set --global fish_pager_color_progress 727169 brblack
|
||||
set --global fish_pager_color_secondary_background
|
||||
set --global fish_pager_color_secondary_completion
|
||||
set --global fish_pager_color_secondary_description
|
||||
set --global fish_pager_color_secondary_prefix
|
||||
set --global fish_pager_color_selected_background -r
|
||||
set --global fish_pager_color_selected_completion
|
||||
set --global fish_pager_color_selected_description
|
||||
set --global fish_pager_color_selected_prefix
|
||||
end
|
||||
12
fish/dot-config/fish/conf.d/import_sources.fish
Normal file
12
fish/dot-config/fish/conf.d/import_sources.fish
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
ssh_agent_startup
|
||||
|
||||
test -e /opt/homebrew/bin/brew
|
||||
and /opt/homebrew/bin/brew shellenv | source -
|
||||
|
||||
if status is-interactive
|
||||
command -q zoxide; and zoxide init fish | source
|
||||
command -q fzf; and fzf --fish | source
|
||||
end
|
||||
|
||||
command -q pyenv; and pyenv init - | source
|
||||
command -q mise; and mise activate fish | source
|
||||
12
fish/dot-config/fish/conf.d/key_binds.fish
Normal file
12
fish/dot-config/fish/conf.d/key_binds.fish
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
if status is-interactive
|
||||
set --global fish_key_bindings fish_vi_key_bindings
|
||||
|
||||
bind --mode insert comma,a 'ssh_add; commandline -f repaint'
|
||||
bind --mode insert .,comma 'nvim; commandline -f repaint'
|
||||
bind --mode insert comma,z 'zi; commandline -f repaint'
|
||||
bind --mode insert comma,f fzf-file-widget
|
||||
bind --mode insert comma,r fzf-history-widget
|
||||
bind --mode insert comma,c fzf-cd-widget
|
||||
bind --mode insert comma,l 'clear; commandline -f repaint'
|
||||
bind --mode insert comma,o 'opencode; commandline -f repaint'
|
||||
end
|
||||
0
fish/dot-config/fish/config.fish
Normal file
0
fish/dot-config/fish/config.fish
Normal file
5
fish/dot-config/fish/functions/adr.fish
Normal file
5
fish/dot-config/fish/functions/adr.fish
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
function adr --wraps aider
|
||||
set -lx OPENAI_BASE_URL http://localhost:8080/v1
|
||||
set -lx OPENAI_API_KEY local
|
||||
aider $argv
|
||||
end
|
||||
12
fish/dot-config/fish/functions/aikeys.fish
Normal file
12
fish/dot-config/fish/functions/aikeys.fish
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
function aikeys -d 'Set AI API keys' -a service
|
||||
switch $service
|
||||
case gemini
|
||||
echo "set -lx GEMINI_API_KEY (kp Keys/google-aistudio-key -a Password)"
|
||||
case openai
|
||||
echo "set -lx OPENAI_API_KEY (kp Keys/openai-general -a Password)"
|
||||
case anthro
|
||||
echo "set -lx ANTHROPIC_API_KEY (kp Keys/anthropic-bespin-nvim -a Password)"
|
||||
case work
|
||||
echo "set -lx OPENAI_API_KEY (kp Keys/openai-mystro -a Password)"
|
||||
end
|
||||
end
|
||||
3
fish/dot-config/fish/functions/commit.fish
Normal file
3
fish/dot-config/fish/functions/commit.fish
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
function commit -d 'Commit staged changes using Opencode'
|
||||
opencode run Commit the staged changes with conventional style.
|
||||
end
|
||||
24
fish/dot-config/fish/functions/editcb.fish
Normal file
24
fish/dot-config/fish/functions/editcb.fish
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
function editcb -a ft -d 'Opens your editor to the cliboard\'s current contents.'
|
||||
set uname (uname)
|
||||
set file "._temp.$ft"
|
||||
|
||||
touch $file
|
||||
|
||||
switch "$uname"
|
||||
case 'Linux'
|
||||
xclip -out -selection clipboard >$file
|
||||
case 'Darwin'
|
||||
pbpaste >$file
|
||||
end
|
||||
|
||||
$EDITOR $file
|
||||
|
||||
switch "$uname"
|
||||
case 'Linux'
|
||||
xclip -in -selection clipboard <$file
|
||||
case 'Darwin'
|
||||
pbcopy <$file
|
||||
end
|
||||
|
||||
rm $file
|
||||
end
|
||||
16
fish/dot-config/fish/functions/fish_greeting.fish
Normal file
16
fish/dot-config/fish/functions/fish_greeting.fish
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
function fish_greeting -d "What's up, fish?"
|
||||
set_color $fish_color_autosuggestion
|
||||
|
||||
set uname (uname -nor)
|
||||
|
||||
command -s uptime >/dev/null
|
||||
and if test (uname) = Linux
|
||||
and set uptime '; ' (uptime --pretty)
|
||||
else
|
||||
and set uptime '; ' (uptime)
|
||||
end
|
||||
|
||||
echo -s $uname $uptime
|
||||
|
||||
set_color normal
|
||||
end
|
||||
3
fish/dot-config/fish/functions/fish_mode_prompt.fish
Normal file
3
fish/dot-config/fish/functions/fish_mode_prompt.fish
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
function fish_mode_prompt
|
||||
end
|
||||
|
||||
85
fish/dot-config/fish/functions/fish_prompt.fish
Normal file
85
fish/dot-config/fish/functions/fish_prompt.fish
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
function fish_prompt --description 'Write out the prompt'
|
||||
set -l last_status $status
|
||||
set -l suffix
|
||||
set -l user_prefix
|
||||
set -l git_branch
|
||||
set -l jobs_num
|
||||
set -l exit_code
|
||||
|
||||
# Set exit code, based on last command status
|
||||
if test $last_status -ne 0
|
||||
set exit_code '<' (set_color $fish_color_status) $last_status (set_color normal) '> '
|
||||
end
|
||||
|
||||
# Set jobs num, based on exit code of jobs command
|
||||
if jobs >/dev/null
|
||||
set -l jobs_out (jobs -c)
|
||||
set jobs_num '[' (set_color grey) (count $jobs_out) (set_color normal) '] '
|
||||
end
|
||||
|
||||
# Set cwd color and prompt suffix, based on current user and fish_bind_mode.
|
||||
set suffix '>'
|
||||
if test $fish_key_bindings = fish_vi_key_bindings
|
||||
switch "$fish_bind_mode"
|
||||
case insert
|
||||
set suffix (set_color brblue) $suffix (set_color normal)
|
||||
case default
|
||||
set suffix '<'
|
||||
case visual
|
||||
set suffix (set_color bryellow) v (set_color normal)
|
||||
end
|
||||
end
|
||||
|
||||
# Set user_prefix, based on whether or not inside of ssh session.
|
||||
if test -n "$SSH_CLIENT"
|
||||
set user_prefix $USER @ (prompt_hostname) ' '
|
||||
end
|
||||
|
||||
# Show current git branch, based on git commands only.
|
||||
if set -l git_status (git status 2>/dev/null)
|
||||
set -l branch_color green
|
||||
|
||||
if string match 'Changes not staged for commit:' $git_status >/dev/null
|
||||
or string match 'Untracked files:' $git_status >/dev/null
|
||||
set branch_color red
|
||||
else if string match 'Changes to be committed:' $git_status >/dev/null
|
||||
set branch_color yellow
|
||||
end
|
||||
|
||||
set -l cur_branch (git branch --show-current)
|
||||
if test -z "$cur_branch"
|
||||
set cur_branch detached
|
||||
end
|
||||
|
||||
if test -n "$cur_branch"
|
||||
set -l cur_branch_len (string length $cur_branch)
|
||||
if test $cur_branch_len -gt 21
|
||||
set -l sub_str (string sub -l 18 $cur_branch)
|
||||
set cur_branch "$sub_str..."
|
||||
end
|
||||
end
|
||||
|
||||
if string match 'Your branch is ahead of*' $git_status >/dev/null
|
||||
set cur_branch $cur_branch \u21A5
|
||||
else if string match 'Your branch is behind*' $git_status >/dev/null
|
||||
set cur_branch $cur_branch \u21A7
|
||||
end
|
||||
|
||||
set git_branch ' on ' (set_color $branch_color) $cur_branch (set_color normal)
|
||||
end
|
||||
|
||||
# Combine all prompt variables
|
||||
set -l cwd (set_color $fish_color_cwd) (prompt_pwd) (set_color normal)
|
||||
set -l top_prompt $cwd $git_branch
|
||||
set -l bottom_prompt $user_prefix $jobs_num $exit_code $suffix ' '
|
||||
|
||||
# Decide whether to insert newline, based on whether the top prompt is only equal to cwd
|
||||
if test "$top_prompt" = "$cwd"
|
||||
set bottom_prompt ' ' $bottom_prompt
|
||||
else
|
||||
set bottom_prompt \n $bottom_prompt
|
||||
end
|
||||
|
||||
echo -n -s $top_prompt
|
||||
echo -n -s $bottom_prompt
|
||||
end
|
||||
57
fish/dot-config/fish/functions/fish_right_prompt.fish
Normal file
57
fish/dot-config/fish/functions/fish_right_prompt.fish
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
# Some functions borrowed from bobthefish theme (https://github.com/oh-my-fish/theme-bobthefish).
|
||||
# Copyright (c) 2013-2014 Justin Hileman.
|
||||
|
||||
function __bobthefish_cmd_duration -S -d 'Show command duration'
|
||||
[ -z "$CMD_DURATION" -o "$CMD_DURATION" -lt 100 ]
|
||||
and return
|
||||
|
||||
if [ "$CMD_DURATION" -lt 5000 ]
|
||||
echo -ns $CMD_DURATION ms
|
||||
else if [ "$CMD_DURATION" -lt 60000 ]
|
||||
__bobthefish_pretty_ms $CMD_DURATION s
|
||||
else if [ "$CMD_DURATION" -lt 3600000 ]
|
||||
set_color $fish_color_error
|
||||
__bobthefish_pretty_ms $CMD_DURATION m
|
||||
else
|
||||
set_color $fish_color_error
|
||||
__bobthefish_pretty_ms $CMD_DURATION h
|
||||
end
|
||||
|
||||
set_color $fish_color_normal
|
||||
set_color $fish_color_autosuggestion
|
||||
|
||||
echo -ns ' ' $__bobthefish_left_arrow_glyph
|
||||
end
|
||||
|
||||
function __bobthefish_pretty_ms -S -a ms -a interval -d 'Millisecond formatting for humans'
|
||||
set -l interval_ms
|
||||
set -l scale 1
|
||||
|
||||
switch $interval
|
||||
case s
|
||||
set interval_ms 1000
|
||||
case m
|
||||
set interval_ms 60000
|
||||
case h
|
||||
set interval_ms 3600000
|
||||
set scale 2
|
||||
end
|
||||
|
||||
math -s$scale "$ms/$interval_ms"
|
||||
echo -ns $interval
|
||||
end
|
||||
|
||||
function __bobthefish_timestamp -S -d 'Show the current timestamp'
|
||||
echo -n ' '
|
||||
date "+%c"
|
||||
end
|
||||
|
||||
function fish_right_prompt -d 'bobthefish is all about the right prompt'
|
||||
set __bobthefish_left_arrow_glyph '<'
|
||||
|
||||
set_color $fish_color_autosuggestion
|
||||
|
||||
__bobthefish_cmd_duration
|
||||
__bobthefish_timestamp
|
||||
set_color normal
|
||||
end
|
||||
9
fish/dot-config/fish/functions/jmpv.fish
Normal file
9
fish/dot-config/fish/functions/jmpv.fish
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
function jmpv -d 'Open jellyfin-mpv-shim in a tmux session of its own'
|
||||
if command --query prime-run
|
||||
set --function --export __NV_PRIME_RENDER_OFFLOAD 1
|
||||
set --function --export __GLX_VENDOR_LIBRARY_NAME nvidia
|
||||
end
|
||||
|
||||
tmux new-session -s jmpv jellyfin-mpv-shim
|
||||
or tmux attach-session -t jmpv
|
||||
end
|
||||
8
fish/dot-config/fish/functions/m.fish
Normal file
8
fish/dot-config/fish/functions/m.fish
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
function m --wraps yazi
|
||||
set tmp (mktemp -t "yazi-cwd.XXXXXX")
|
||||
yazi $argv --cwd-file="$tmp"
|
||||
if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
|
||||
cd -- "$cwd"
|
||||
end
|
||||
rm -f -- "$tmp"
|
||||
end
|
||||
3
fish/dot-config/fish/functions/sesh.fish
Normal file
3
fish/dot-config/fish/functions/sesh.fish
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
function sesh -a session -d 'Create or attach to session'
|
||||
tmux new -s $session -A -D $argv[2..-1]
|
||||
end
|
||||
14
fish/dot-config/fish/functions/ssh_add.fish
Normal file
14
fish/dot-config/fish/functions/ssh_add.fish
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
function ssh_add -d 'Shortcut for adding keys to ssh agent'
|
||||
read --prompt-str='e/r/s? ' args
|
||||
|
||||
argparse --max-args 1 's/seedly' 'r/rsa' -- $args
|
||||
|
||||
switch $args
|
||||
case s seedly
|
||||
ssh-add ~/.secrets/seedly_ed25519
|
||||
case r rsa
|
||||
ssh-add ~/.secrets/id_rsa
|
||||
case '*'
|
||||
ssh-add ~/.secrets/id_ed25519
|
||||
end
|
||||
end
|
||||
5
fish/dot-config/fish/functions/ssh_agent_startup.fish
Normal file
5
fish/dot-config/fish/functions/ssh_agent_startup.fish
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
function ssh_agent_startup -d 'Start ssh agent and set env vars'
|
||||
if test -z "$SSH_AUTH_SOCK"; and test -z "$SSH_AGENT_PID"; and test -z "$SSH_CLIENT"
|
||||
eval (ssh-agent -c) >/dev/null 2>&1
|
||||
end
|
||||
end
|
||||
17
fish/dot-config/fish/functions/sshre.fish
Normal file
17
fish/dot-config/fish/functions/sshre.fish
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
function sshre -d 'Remove list of hosts from ssh known_hosts'
|
||||
alias ssh-rm 'ssh-keygen -f ~/.ssh/known_hosts -R'
|
||||
set -l hosts 10.0.0.1 10.0.0.5 git.mjfs.us dns cloud net git
|
||||
set -l domains lan m
|
||||
|
||||
if test -n "$argv"
|
||||
set hosts $argv
|
||||
end
|
||||
|
||||
for host in $hosts
|
||||
ssh-rm $host
|
||||
|
||||
for domain in $domains
|
||||
ssh-rm $host.$domain
|
||||
end
|
||||
end
|
||||
end
|
||||
8
fish/dot-config/fish/functions/temp.fish
Normal file
8
fish/dot-config/fish/functions/temp.fish
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# temp creates a temporary file in your editor, with the given filetype.
|
||||
function temp -a ft
|
||||
set file "._temp.$ft"
|
||||
|
||||
touch $file
|
||||
$EDITOR $file
|
||||
rm $file
|
||||
end
|
||||
53
fish/dot-config/fish/functions/vm_inst.fish
Normal file
53
fish/dot-config/fish/functions/vm_inst.fish
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
function vm_inst -a name os_variant install_source
|
||||
argparse \
|
||||
--ignore-unknown \
|
||||
'm/memory=' \
|
||||
'c/cpus=' \
|
||||
'd/disk-size=' \
|
||||
'b/bridge=?' \
|
||||
s/backing-store \
|
||||
i/import \
|
||||
n/netboot \
|
||||
-- $argv
|
||||
or return
|
||||
|
||||
set -l memory 2048
|
||||
set -l vcpus 2
|
||||
set -l disk_size 10
|
||||
set -l bridge_iface br0
|
||||
set -q "$_flag_memory"; and set memory $_flag_m
|
||||
set -q "$_flag_cpus"; and set vcpus $_flag_c
|
||||
set -q "$_flag_disk_size"; and set disk_size $_flag_d
|
||||
set -q "$_flag_bridge"; and not math $_flag_b &>/dev/null; or set bridge_iface $_flag_b
|
||||
|
||||
set -l inst_args \
|
||||
--name $name \
|
||||
--memory $memory \
|
||||
--vcpus $vcpus \
|
||||
--os-variant $os_variant
|
||||
|
||||
if set -q "$_flag_bridge"
|
||||
set inst_args $inst_args \
|
||||
--network bridge=$bridge_iface
|
||||
end
|
||||
|
||||
if test -n "$_flag_import"
|
||||
set inst_args $inst_args \
|
||||
--disk $install_source \
|
||||
--import
|
||||
else if test -n "$_flag_backing_store"
|
||||
set inst_args $inst_args \
|
||||
--disk size=$disk_size,sparse=yes,backing_store=$install_source \
|
||||
--import
|
||||
else if test -n "$_flag_netboot"
|
||||
set inst_args $inst_args \
|
||||
--disk size=$disk_size,sparse=yes \
|
||||
--pxe
|
||||
else
|
||||
set inst_args $inst_args \
|
||||
--disk size=$disk_size,sparse=yes \
|
||||
--cdrom $install_source
|
||||
end
|
||||
|
||||
virt-install $inst_args $argv[4..-1]
|
||||
end
|
||||
5
fish/dot-config/fish/functions/vm_rm.fish
Normal file
5
fish/dot-config/fish/functions/vm_rm.fish
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
function vm_rm -a domain -d 'Destroy, undefine, and delete the volume of a domain'
|
||||
virsh destroy $domain
|
||||
virsh undefine $domain
|
||||
virsh vol-delete /home/libvirt/$domain.qcow2
|
||||
end
|
||||
106
fish/dot-config/fish/functions/ytmpv.fish
Normal file
106
fish/dot-config/fish/functions/ytmpv.fish
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
function ytmpv -d 'A script to help queue youtube videos on MPV'
|
||||
set -l queue ~/.ytmpv_queue
|
||||
set -l downloads ~/.ytmpv_downloads/
|
||||
|
||||
if command --query prime-run
|
||||
set --function --export __NV_PRIME_RENDER_OFFLOAD 1
|
||||
set --function --export __GLX_VENDOR_LIBRARY_NAME nvidia
|
||||
end
|
||||
|
||||
|
||||
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
|
||||
switch $video
|
||||
case cl clear
|
||||
clear
|
||||
case c copy
|
||||
set -l video (fromcb)
|
||||
string split ' ' $video >>$queue
|
||||
case d destroy
|
||||
rm -r $queue
|
||||
break
|
||||
case dd destroy-downloads
|
||||
rm -r $downloads
|
||||
break
|
||||
case e edit
|
||||
$EDITOR $queue
|
||||
case f fg
|
||||
tmux attach -t ytmpv
|
||||
case h help
|
||||
functions ytmpv
|
||||
case l list
|
||||
cat $queue
|
||||
case q quit
|
||||
return
|
||||
case dl download
|
||||
tmux attach -t ytmpv
|
||||
tmux new-session -s ytmpv -- \
|
||||
yt-dlp \
|
||||
--format-sort 'height:1080' \
|
||||
--batch-file $queue \
|
||||
--path $downloads
|
||||
break
|
||||
case pd play-downloads
|
||||
tmux attach -t ytmpv
|
||||
tmux new-session -s ytmpv -- \
|
||||
mpv \
|
||||
--ytdl \
|
||||
--save-position-on-quit \
|
||||
$downloads
|
||||
break
|
||||
case p play
|
||||
tmux attach -t ytmpv
|
||||
tmux new-session -s ytmpv -- \
|
||||
mpv \
|
||||
--ytdl \
|
||||
--save-position-on-quit \
|
||||
--playlist=$queue
|
||||
break
|
||||
case pl play-login
|
||||
read -P 'username> ' -l username
|
||||
read -P 'password> ' -s -l password
|
||||
|
||||
tmux attach -t ytmpv
|
||||
tmux new-session -s ytmpv -- \
|
||||
mpv \
|
||||
--ytdl \
|
||||
--ytdl-raw-options=username=$username,password=$password \
|
||||
--save-position-on-quit \
|
||||
--playlist=$queue
|
||||
|
||||
break
|
||||
case s stream
|
||||
tmux attach -t ytmpv
|
||||
tmux new-session -s ytmpv -- \
|
||||
streamlink \
|
||||
--player mpv \
|
||||
(cat $queue) \
|
||||
best
|
||||
break
|
||||
case dwl destroy-watch-later
|
||||
rm -r ~/.local/state/mpv/watch_later/
|
||||
break
|
||||
case '*'
|
||||
if test -z "$video"
|
||||
tmux attach -t ytmpv
|
||||
tmux new-session -s ytmpv -- \
|
||||
mpv \
|
||||
--ytdl \
|
||||
--save-position-on-quit \
|
||||
--playlist=$queue
|
||||
break
|
||||
end
|
||||
|
||||
string split ' ' $video >>$queue
|
||||
end
|
||||
end
|
||||
|
||||
ytmpv
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue