diff --git a/.local/bin/scripts/clean b/.local/bin/scripts/clean index a15e877..04456f7 100755 --- a/.local/bin/scripts/clean +++ b/.local/bin/scripts/clean @@ -50,7 +50,7 @@ fi highlight "d :: recursively remove development caches" if [[ $1 =~ "d" ]]; then find -maxdepth 1 \( -name "*.aux" -o -name "*.log" -o -name "*.t[uo]c" -o -name "*.out" \) -print -delete - find -name "src" -prune -o \ + find \( -name 'src' -o -name 'vendor' \) -prune -o \ -type d \( -name 'cache' $(echo $DIRS_GENERATED | sed 's|-x \([^ ]\+\)|-o -name \1|g') \) \ -print -exec rm $i -r {} + -prune echo -n " " && highlight "build directories" @@ -69,16 +69,16 @@ highlight "c :: clean electron caches" [[ $1 =~ "c" ]] && find "$dir$(expr "${XDG_CONFIG_HOME/$HOME}" \| "/.config")" \ -type d -name "*Cache*" -print -exec rm $i -r {} + -prune -if test -f "/var/log/apt/history.log"; then - aptclean_cur=$(cat "/var/log/apt/history.log" | wc -l) - test "$aptclean_cur" -gt "${aptclean_last:--1}" && - sudo apt-get clean && sudo apt-get autoremove && - echo "Cleaned apt" - export aptclean_last=$aptclean_cur -fi - highlight "o :: optimize space extensively" if [[ $1 =~ "o" ]]; then + if test -f "/var/log/apt/history.log"; then + aptclean_cur=$(cat "/var/log/apt/history.log" | wc -l) + test "$aptclean_cur" -gt "${aptclean_last:--1}" && + sudo apt-get clean && sudo apt-get autoremove && + echo "Cleaned apt" + export aptclean_last=$aptclean_cur + fi + sudo rm -rf "$XDG_DATA_HOME/baloo" docker image prune which yay &>/dev/null && yay -Sc --noconfirm diff --git a/.local/bin/scripts/genssh b/.local/bin/scripts/genssh index 70e98e8..d4d3d1c 100755 --- a/.local/bin/scripts/genssh +++ b/.local/bin/scripts/genssh @@ -13,4 +13,4 @@ cat "$keys/$name.pub" if test "$OSTYPE" = "cygwin" then cat "$keys/$name.pub">/dev/clipboard else xclip -sel clip 2>/dev/null <"$keys/$name.pub" -fi && echo "SSH Public key copied to clipboard" || true +fi && echo "SSH Public key copied to clipboard" >&2 || true diff --git a/.local/bin/scripts/git-fork b/.local/bin/scripts/git-fork index fc70b7a..03f44c1 100755 --- a/.local/bin/scripts/git-fork +++ b/.local/bin/scripts/git-fork @@ -7,7 +7,7 @@ # - host # - target directory name (and further arguments to clone) # In an existing repo, first arg is omitted -test $# -eq 0 && echo "Usage: $0 [repo] [upstream owner] [own user] [url]" && exit 2 +test $# -eq 0 && echo "Usage: $0 [repo (omit if in repo)] [upstream owner] [own user] [url]" && exit 2 # TODO check from subdir if test -d ".git" then repo="$(basename "$PWD")" @@ -21,5 +21,6 @@ else repo="$1" && shift cd "$(expr "$4" \| "$repo")" fi user="${1:-$repo}" +git remote remove upstream 2>/dev/null git remote add upstream "$(git-repo "${3:-github.com}" "$repo" "$user")" git remote -v diff --git a/.local/bin/scripts/git-upstream b/.local/bin/scripts/git-upstream index 2272b55..ee9ecd4 100755 --- a/.local/bin/scripts/git-upstream +++ b/.local/bin/scripts/git-upstream @@ -9,7 +9,7 @@ then name="$3" git remote remove "$3" 2>/dev/null else - git remote get-url upstream 2>/dev/null && name="$1" || name="upstream" + git remote get-url upstream >/dev/null 2>&1 && name="$1" || name="upstream" fi origin="$(git remote get-url origin)" git remote add -f $name "$(echo $origin | cut -d':' -f1):$1/${2:-$(echo $origin | cut -d'/' -f2)}" diff --git a/.local/bin/scripts/tl b/.local/bin/scripts/tl index 14a3939..4c9fe27 100755 --- a/.local/bin/scripts/tl +++ b/.local/bin/scripts/tl @@ -6,4 +6,4 @@ # If first arg is a digit, it displaces the default depth of 3 # Any other arguments (usually pathnames) are passed on to the tree command case "$1" in ([0-9]) depth=$1; shift;; esac -tree -a --dirsfirst --du -h -C -L ${depth:-3} "$@" | ${PAGER:-less} +tree -a --dirsfirst --du -h -C -L ${depth:-3} "$@" | ${PAGER:-less} -rF diff --git a/.local/bin/scripts/vnctype b/.local/bin/scripts/vnctype index 5e38109..d4f210b 100755 --- a/.local/bin/scripts/vnctype +++ b/.local/bin/scripts/vnctype @@ -3,5 +3,5 @@ xdotool search --onlyvisible --classname Navigator windowactivate # Activate Firefox setxkbmap de sleep 0.1 -xdotool type --clearmodifiers "$@" +xdotool type --delay 80ms --clearmodifiers "$@" update-keyboard-layout >/dev/null