From 025907fda1544e7eb45c146b2f4aac71b18a6d58 Mon Sep 17 00:00:00 2001 From: Alison Watson Date: Mon, 10 Jun 2019 23:30:49 -0400 Subject: [PATCH] actually I wasn't kidding It's Time FOr Fish --- scripts/find_stereo.sh | 20 +++++++-------- scripts/flac2mp3.sh | 19 ++++++++------- scripts/megadl.sh | 4 +-- scripts/path.sh | 6 +++-- scripts/sharenix.cw.sh | 7 +++--- scripts/sharenix.fs.sh | 7 +++--- scripts/sharenix.sel.sh | 7 +++--- scripts/sharenix.sh | 17 +++++++------ scripts/update_vim_plugins.sh | 46 +++++++++++++++++------------------ scripts/vnc.sh | 7 +++--- terminal/fish | 7 ++++-- 11 files changed, 74 insertions(+), 73 deletions(-) diff --git a/scripts/find_stereo.sh b/scripts/find_stereo.sh index 8beb4a2..5285982 100755 --- a/scripts/find_stereo.sh +++ b/scripts/find_stereo.sh @@ -1,17 +1,17 @@ -#!/usr/bin/env bash +#!/usr/bin/fish -filter='pan=mono|c0=0.5*FL+-0.5*FR,silenceremove=start_periods=1:detection=peak' +set filter 'pan=mono|c0=0.5*FL+-0.5*FR,silenceremove=start_periods=1:detection=peak' -for f in $@ -do - out=$(ffmpeg -nostdin -loglevel error -i "$f" -filter_complex "$filter" -t 0.00002 -f crc -) +for f in $argv + set out (ffmpeg -nostdin -loglevel error -i "$f" -filter_complex "$filter" -t 0.00002 -f crc -) - if [[ "$out" != 'CRC=0x00000001' ]] - then - other="${f%.ogg}.1.ogg" + if test "$out" != 'CRC=0x00000001' + set other /tmp/(basename "$f") echo "$f is stereo, converting" ffmpeg -i "$f" -ac 1 "$other" && mv "$other" "$f" - fi -done + else + echo "$f is mono" + end +end ## EOF diff --git a/scripts/flac2mp3.sh b/scripts/flac2mp3.sh index 470689d..12c7d2e 100755 --- a/scripts/flac2mp3.sh +++ b/scripts/flac2mp3.sh @@ -1,16 +1,17 @@ -#!/usr/bin/env bash +#!/usr/bin/fish -fail() { +function fail echo "failed to process $f, exiting" exit 1 -} +end for f in ./*.flac -do - ffmpeg -i "$f" -q:a 0 -vn "$(basename "$f" .flac).mp3" - (( $? )) && fail + ffmpeg -i "$f" -q:a 0 -vn (basename "$f" ".flac")".mp3" + or fail echo "$f success" -done +end -read -rep "success. delete files? [yn] " YN -[[ ${YN,,} == y* ]] && rm ./*.flac +read -P "success. delete files? [yn] " yn + +test $yn = y +and rm ./*.flac diff --git a/scripts/megadl.sh b/scripts/megadl.sh index 4bbc519..b08e43b 100755 --- a/scripts/megadl.sh +++ b/scripts/megadl.sh @@ -1,3 +1,3 @@ -#!/usr/bin/env bash +#!/usr/bin/fish -megadl $(cat ~/dl) +megadl (cat ~/dl) diff --git a/scripts/path.sh b/scripts/path.sh index 6c5c934..f5c6877 100644 --- a/scripts/path.sh +++ b/scripts/path.sh @@ -1,4 +1,6 @@ #!/usr/bin/env bash -export PATH=$HOME/.local/bin:$HOME/.gem/ruby/2.6.0/bin:$PATH -export DOOMWADDIR=/mnt/d/Stuff/GamesPC/IWads +export PATH="$HOME/.local/bin":"$HOME/.gem/ruby/2.6.0/bin":$PATH +export DOOMWADDIR='/mnt/d/Stuff/GamesPC/IWads' + +## EOF diff --git a/scripts/sharenix.cw.sh b/scripts/sharenix.cw.sh index 97b86e0..6487a77 100755 --- a/scripts/sharenix.cw.sh +++ b/scripts/sharenix.cw.sh @@ -1,5 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/fish -export spectacleargs=-a - -. "$HOME/src/scripts/sharenix.sh" +source "$HOME/src/scripts/sharenix.sh" +run_spectacle -a diff --git a/scripts/sharenix.fs.sh b/scripts/sharenix.fs.sh index 8b11ec3..13cdc1e 100755 --- a/scripts/sharenix.fs.sh +++ b/scripts/sharenix.fs.sh @@ -1,5 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/fish -export spectacleargs=-f - -. "$HOME/src/scripts/sharenix.sh" +source "$HOME/src/scripts/sharenix.sh" +run_spectacle -f diff --git a/scripts/sharenix.sel.sh b/scripts/sharenix.sel.sh index ded0224..0ae83d6 100755 --- a/scripts/sharenix.sel.sh +++ b/scripts/sharenix.sel.sh @@ -1,5 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/fish -export spectacleargs=-r - -. "$HOME/src/scripts/sharenix.sh" +source "$HOME/src/scripts/sharenix.sh" +run_spectacle -r diff --git a/scripts/sharenix.sh b/scripts/sharenix.sh index 3ce985f..fb6d7c1 100755 --- a/scripts/sharenix.sh +++ b/scripts/sharenix.sh @@ -1,12 +1,13 @@ -#!/usr/bin/env bash +#!/usr/bin/fish -f=$HOME/Pictures/$(date "+%y%m%d-%H%M%S").png +function run_spectacle + set f "$HOME/Pictures/"(date "+%y%m%d-%H%M%S")".png" -spectacle -b $spectacleargs -n -o $f + spectacle -b $argv -n -o "$f" -if [[ -f "$f" ]] -then - sharenix -n -s Greyserv "$f" -fi + if test -f "$f" + sharenix -n -s Greyserv "$f" + end -rm "$f" + rm "$f" +end diff --git a/scripts/update_vim_plugins.sh b/scripts/update_vim_plugins.sh index 6b6e90a..fd13fde 100755 --- a/scripts/update_vim_plugins.sh +++ b/scripts/update_vim_plugins.sh @@ -1,51 +1,49 @@ -#!/usr/bin/env bash - -pull_plugins() { - local res +#!/usr/bin/fish +function pull_plugins for plugin in ./* - do cd $plugin + git stash git pull -f - res=$? + set res $status + + if test $res != 0; and test $res != 128 - if [[ $res -ne 0 ]] && [[ $res -ne 128 ]] - then echo "error $res in $PWD" exit 1 - fi + end - if [[ $plugin = ./base16-vim ]] - then + if test "$plugin" = ./base16-vim echo "fixing attrs for $plugin" sed -i '/Base16hi/! s/a:\(attr\|guisp\)/l:\1/g' colors/*.vim - fi + end - if [[ -d doc ]] - then + if test -d doc echo "generating tags for $PWD" vim --cmd "helptags doc/" --cmd "q" - fi + end cd .. - done -} -cd_and_pull() { - cd $1 + end +end + +function cd_and_pull + cd $argv[1] pull_plugins cd .. -} +end cd ~/.vim/pack for folder in ./* -do cd $folder - [[ -d start ]] && cd_and_pull start - [[ -d opt ]] && [[ $1 = opt ]] && cd_and_pull opt + test -d start; and cd_and_pull start + test -d opt; and test $1 = opt; and cd_and_pull opt cd .. -done +end + +## EOF diff --git a/scripts/vnc.sh b/scripts/vnc.sh index 42e0986..4c2907a 100755 --- a/scripts/vnc.sh +++ b/scripts/vnc.sh @@ -1,6 +1,5 @@ -#!/usr/bin/env bash +#!/usr/bin/fish -while [[ 1 ]] -do +while true x11vnc -forever -scale 0.25 -done +end diff --git a/terminal/fish b/terminal/fish index a67d037..d41a423 100644 --- a/terminal/fish +++ b/terminal/fish @@ -6,8 +6,11 @@ if status is-interactive end function fish_prompt - set_color purple - echo (hostname)"% " + echo (set_color purple)"$hostname% " +end + +function fish_right_prompt + echo (set_color green)(pwd) end function fish_greeting