diff options
-rwxr-xr-x | home-manager/packages/scripts/apps/aumo | 8 | ||||
-rwxr-xr-x | home-manager/packages/scripts/apps/con2pdf | 1 | ||||
-rwxr-xr-x | home-manager/packages/scripts/small_functions/gtk-themes | 1 | ||||
-rwxr-xr-x | home-manager/packages/scripts/small_functions/screen_shot | 7 | ||||
-rwxr-xr-x | home-manager/packages/scripts/small_functions/update-sys | 6 | ||||
-rwxr-xr-x | home-manager/packages/scripts/wrappers/ll | 13 | ||||
-rwxr-xr-x | home-manager/packages/scripts/wrappers/spodi | 24 | ||||
-rwxr-xr-x | home-manager/packages/scripts/wrappers/yti | 5 |
8 files changed, 36 insertions, 29 deletions
diff --git a/home-manager/packages/scripts/apps/aumo b/home-manager/packages/scripts/apps/aumo index 2a1054ad..a35a9de5 100755 --- a/home-manager/packages/scripts/apps/aumo +++ b/home-manager/packages/scripts/apps/aumo @@ -3,7 +3,9 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="1.1.3" . %SHELL_LIBRARY_PATH -if [ "$1" = "-u" ];then udisksctl unmount -b $(cat $HOME/.cache/aumo/mnt_disk); exit 0; fi +# TODO rewrite this + +if [ "$1" = "-u" ];then udisksctl unmount -b "$(cat "$HOME/.cache/aumo/mnt_disk")"; exit 0; fi all_available_disks=$(mktemp) awk '{print $4}' /proc/partitions | sed '1 s|.*||' > "$all_available_disks" @@ -29,7 +31,7 @@ while [ $disk -lt 0 ] || [ $disk -gt $(wc -l $unmounted_disks | awk '{print $1}' printf "%4s) %s\n" "$u" "$i" u=$(( u + 1 )) done - + printf "%4s) Exit\n" "0" printf "Input number: " read -r disk @@ -44,7 +46,7 @@ if ! [ "$1" = "-v" ] && [ -n "$1" ];then sudo mount "$mnt_disk" "$1" && exit 0;f [ -n "$2" ] && sudo mount "$mnt_disk" "$1" && exit 0 if mount | grep -q ~/mnt ;then dien "Something is mounted at ~/mnt";else udisksctl mount -b "$mnt_disk";fi -[ -e $HOME/.cache/aumo/mnt_disk ] || mkdir -p $HOME/.cache/aumo +[ -e $HOME/.cache/aumo/mnt_disk ] || mkdir -p $HOME/.cache/aumo echo $mnt_disk >> $HOME/.cache/aumo/mnt_disk rm $all_available_disks rm $mounted_disk diff --git a/home-manager/packages/scripts/apps/con2pdf b/home-manager/packages/scripts/apps/con2pdf index 653af5cb..29e9bc16 100755 --- a/home-manager/packages/scripts/apps/con2pdf +++ b/home-manager/packages/scripts/apps/con2pdf @@ -11,7 +11,6 @@ AUTHORS="Soispha"; YEARS="2023"; # shellcheck disable=2034 VERSION="1.0.0"; -NAME="con2pdf"; help() { cat << EOF diff --git a/home-manager/packages/scripts/small_functions/gtk-themes b/home-manager/packages/scripts/small_functions/gtk-themes index 3d81aee8..95dd1daf 100755 --- a/home-manager/packages/scripts/small_functions/gtk-themes +++ b/home-manager/packages/scripts/small_functions/gtk-themes @@ -4,6 +4,7 @@ SHELL_LIBRARY_VERSION="1.1.3" . %SHELL_LIBRARY_PATH +# TODO document, what this does # usage: import-gsettings config="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-3.0/settings.ini" diff --git a/home-manager/packages/scripts/small_functions/screen_shot b/home-manager/packages/scripts/small_functions/screen_shot index d0cbeb5c..815fd4fe 100755 --- a/home-manager/packages/scripts/small_functions/screen_shot +++ b/home-manager/packages/scripts/small_functions/screen_shot @@ -3,5 +3,8 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="1.1.3" . %SHELL_LIBRARY_PATH -grim -g "$(slurp)" ~/media/pictures/screenshots/"$(date +%s)".png && - alacritty -e llp -command ":{{ set sortby atime; set reverse!; }}" ~/media/pictures/screenshots +date="$(date +%s)" +grim -g "$(slurp)" "$HOME/media/pictures/screenshots/$date.png" && + alacritty -e ll -command ":{{ set sortby atime; set reverse!; }}" "$HOME/media/pictures/screenshots/$date.png" + +# vim: ft=sh diff --git a/home-manager/packages/scripts/small_functions/update-sys b/home-manager/packages/scripts/small_functions/update-sys index c1df4f48..067647b4 100755 --- a/home-manager/packages/scripts/small_functions/update-sys +++ b/home-manager/packages/scripts/small_functions/update-sys @@ -20,7 +20,7 @@ Options: EOF exit "$1"; } -tmp=$(mktmp); +default_branch=$(mktmp); BRANCH=""; while [ "$#" -gt 0 ];do @@ -63,7 +63,7 @@ fi msg2 "Updating git repository..."; git pull --rebase; -git remote show origin | grep 'HEAD' | cut -d':' -f2 | sed -e 's/^ *//g' -e 's/ *$//g' > $tmp & +git remote show origin | grep 'HEAD' | cut -d':' -f2 | sed -e 's/^ *//g' -e 's/ *$//g' > "$default_branch" & msg2 "Updating system..."; if [ -n "$MODE" ]; then @@ -72,7 +72,7 @@ else nixos-rebuild switch; fi -git switch "$(cat $tmp)" > /dev/null 2>&1 && msg2 "Switched to branch '$(cat $tmp)'"; +git switch "$(cat "$default_branch")" > /dev/null 2>&1 && msg2 "Switched to branch '$(cat "$default_branch")'"; msg "Finished Update!"; # vim: ft=sh diff --git a/home-manager/packages/scripts/wrappers/ll b/home-manager/packages/scripts/wrappers/ll index 48bd0ad3..f1d96f15 100755 --- a/home-manager/packages/scripts/wrappers/ll +++ b/home-manager/packages/scripts/wrappers/ll @@ -3,16 +3,11 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="1.1.3" . %SHELL_LIBRARY_PATH -export LLP=0 -tmp="$(mktmp)" +last_directory="$(mktmp)" -lf -last-dir-path="$tmp" "$@" +command lf -last-dir-path="$last_directory" "$@" -if [ -f "$tmp" ]; then - dir="$(cat "$tmp")" - if [ -d "$dir" ] && [ "$dir" != "$(pwd)" ];then - cd "$dir" || die "$dir doesn't exits!" - fi -fi +dir="$(cat "$last_directory")" +cd "$dir" || die "$dir does not exist!" # vim: ft=sh diff --git a/home-manager/packages/scripts/wrappers/spodi b/home-manager/packages/scripts/wrappers/spodi index 41d2b443..87a6196c 100755 --- a/home-manager/packages/scripts/wrappers/spodi +++ b/home-manager/packages/scripts/wrappers/spodi @@ -3,23 +3,24 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="1.1.3" . %SHELL_LIBRARY_PATH +DOWN_DIR="/home/soispha/media/music/down"; -DOWN_DIR=/home/soispha/media/music/down/ +download_url="$1"; -tmp=$(mktmp) -config=$(mktmp) -fd . "$DOWN_DIR" --exclude spotdl.log > "$tmp"; +already_downloaded_files="$(mktmp)" +fd . "$DOWN_DIR" --exclude spotdl.log > "$already_downloaded_files"; +config="$(mktmp)" cat << EO > "$config" --log-level INFO ---cache-path /home/soispha/.config/spotdl/.spotipy +--cache-path /home/soispha/.local/share/spotdl/.spotipy --audio youtube-music youtube --lyrics genius musixmatch azlyrics --ffmpeg ffmpeg --format mp3 ---output {artists}-{title}.{output-ext} +--output {artists}_-_{title} --overwrite skip --client-id 5f573c9620494bae87890c0f08a60293 --client-secret 212476d9b0f3472eaa762d90b19b0ba8 @@ -28,12 +29,17 @@ cat << EO > "$config" --preload EO -[ "$(wc -l "$tmp" | awk '{print $1}')" -gt 2 ] && die "something is already downloaded" +if [ -z "$NO_CHECK" ] && [ "$(wc -l < "$already_downloaded_files" )" -ne 0 ];then + die "something is already downloaded" +fi -rm "${DOWN_DIR}spotdl.log" +rm "$DOWN_DIR/spotdl.log" cd "$DOWN_DIR" || die "BUG: no $DOWN_DIR" + # The sub shell needs to be unquoted, as the arguments may not be treated as one. -unbuffer spotdl $(cat "$config") download "$1" | tee "$DOWN_DIR/spotdl.log" +# shellcheck disable=2046 +unbuffer spotdl $(cat "$config") download "$download_url" | tee "$DOWN_DIR/spotdl.log" [ -d ~/.spotdl ] && rm -r ~/.spotdl +# vim: ft=sh diff --git a/home-manager/packages/scripts/wrappers/yti b/home-manager/packages/scripts/wrappers/yti index d335a337..1c84de4e 100755 --- a/home-manager/packages/scripts/wrappers/yti +++ b/home-manager/packages/scripts/wrappers/yti @@ -3,7 +3,8 @@ # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="1.1.3" . %SHELL_LIBRARY_PATH -DOWN_DIR=/home/dt/media/playlist/down/ +die "Use spodi instead!" # TODO fix this script +DOWN_DIR=/home/soispha/media/playlist/down/ tmp=$(mktmp) @@ -30,6 +31,6 @@ EO rm ${DOWN_DIR}yt-dlp.log cd $DOWN_DIR || die "BUG: no $DOWN_DIR" -unbuffer yt-dlp --config-location "$config" "$1" | tee $DOWN_DIR/yt-dlp.log +unbuffer yt-dlp --config-location "$config" "$1" | tee $DOWN_DIR/yt-dlp.log # vim: ft=sh |