bin: many little interaction fixes

This commit is contained in:
xeruf 2022-09-27 21:58:13 +02:00
parent 48df706c70
commit c302da4622
6 changed files with 15 additions and 14 deletions

View File

@ -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,6 +69,8 @@ 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
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}" &&
@ -77,8 +79,6 @@ if test -f "/var/log/apt/history.log"; then
export aptclean_last=$aptclean_cur
fi
highlight "o :: optimize space extensively"
if [[ $1 =~ "o" ]]; then
sudo rm -rf "$XDG_DATA_HOME/baloo"
docker image prune
which yay &>/dev/null && yay -Sc --noconfirm

View File

@ -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

View File

@ -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

View File

@ -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)}"

View File

@ -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

View File

@ -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