From 912116b9be2a9854c8e9bcd2101c1474f38fd33f Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Mon, 7 Aug 2023 19:59:11 +0200 Subject: [PATCH] config/shell: adjust helpers --- .config/shell/functions | 10 +++++++--- .config/shell/graphical | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.config/shell/functions b/.config/shell/functions index bdf8bc4..4cab6c4 100644 --- a/.config/shell/functions +++ b/.config/shell/functions @@ -266,10 +266,11 @@ curlh() { unalias u 2>/dev/null # for bash u() { # Line below handy for users of netkeeper - sudo nft list ruleset | grep -q outall && echo "Suspending netkeeper" >&2 | echo 'pausing netkeeper for sysupgrade' | netkeeper 30 2>/dev/null + #sudo nft list ruleset | grep -q outall && echo "Suspending netkeeper" >&2 | echo 'pausing netkeeper for sysupgrade' | netkeeper 30 2>/dev/null if command -v pacman >/dev/null; then if test "$(stat /etc/pacman.d/mirrorlist --printf=%y | cut -d'-' -f1-2)" != "$(date +%Y-%m)" then + # TODO or if location changed significantly or very slow if command -v pacman-mirrors >/dev/null then sudo pacman-mirrors --geoip else sudo touch /etc/pacman.d/mirrorlist @@ -424,7 +425,10 @@ dic() { alias dict="rlwrap rdictcc --directory $DICT" dict_update() { local dictfile="$DICT/dict.txt" - test $# -gt 0 && mv -v $1 "$dictfile" + test $# -gt 0 && case "$1" in + (*.zip) dir=$(mktemp -d) && unzip "$1" -d "$dir" && mv -v $dir/* "$dictfile" && rm -v "$1";; + (*) mv -v "$1" "$dictfile";; + esac echo "Reading in $dictfile..." unbuffer rdictcc --directory $DICT -i "$dictfile" | rewrite } @@ -440,7 +444,7 @@ npm-reinstall() { alias onkyo='bluetoothctl disconnect 00:09:B0:1D:DC:98 && sleep 1 && bluetoothctl connect 00:09:B0:1D:DC:98' alias pdfcon='TEXMF="" pdfjam -o $(date +%F).pdf' -alias pdfwor='TEXMF="" pdfjam -o collections/$(date +%F)_Akkorde.pdf' +alias pdfwor='TEXMF="" pdfjam -o $(test -d "collections" && echo "collections/")$(date +%F)_Akkorde.pdf' # Custom tools {{{1 diff --git a/.config/shell/graphical b/.config/shell/graphical index 5462e00..c08e56d 100644 --- a/.config/shell/graphical +++ b/.config/shell/graphical @@ -15,6 +15,8 @@ alias graphics='lspci -vnn | grep VGA --color=never && xrandr --listproviders' alias clip='cliphist list | fzf | cliphist decode | wl-copy' +alias rotate='noglob swaymsg output * transform 270' + # WIP Edit mozilla config mozedit() ( set -eo pipefail