bin: slight script adjustments

This commit is contained in:
xerus2000 2021-04-21 19:51:56 +02:00
parent 82c053886d
commit b23515c424
3 changed files with 12 additions and 7 deletions

View File

@ -358,7 +358,7 @@ clean() {
highlight "m to clean mac-files"
if [[ $1 =~ "m" ]]; then
find -iname '.spotlight*' -print -exec rm -r {} \;
find -name "*.DS_Store" -delete
find -name '*.DS_Store' -delete
fi
if test "$BASH_VERSION"; then
@ -380,12 +380,16 @@ clean() {
export aptclean_last=$aptclean_cur
fi
which yay &>/dev/null && yay -Sc
highlight "e to delete empty folders"
[[ $1 =~ "e" ]] && find -empty -type d -delete -print
nix-collect-garbage
highlight "o to optimize extensively"
if [[ $1 =~ "o" ]]; then
which yay &>/dev/null && yay -Sc
nix-collect-garbage -d
nix-store --optimize
fi
}
function zipdiff() {

View File

@ -2,3 +2,4 @@
echo "Args: $@"
echo "Number of args: $#"
echo "${@:-default}" | sed 's/\(\w\+\)/\1+sed/g'
echo "Last arg: ${@:$#}"

View File

@ -1,13 +1,13 @@
#!/bin/sh
{
case $ACTION in
add) id=1;;
remove) id=0;;
*) id=$(test -c /dev/ttyACM0 && echo 1 || echo 0);;
(add) id=1;;
(remove) id=0;;
(*) id=$(test -c /dev/ttyACM0 && echo 1 || echo 0);;
esac
echo "Keyboard layout update to $id($ACTION) at $(date)" >>/tmp/scripts.log
export XAUTHORITY="/run/user/1000/Xauthority" DISPLAY=:0
# setxkbmap "$id" #nodeadkeys
xkbstate="$(dirname $(dirname $0))/xkblayout-state"
test "$($xkbstate print %C)" -gt 1 && $xkbstate set $id
# Swap semicolon and colon - https://unix.stackexchange.com/questions/615799/swap-semicolon-colon-to-p-unexpected-cause-semicolon-colon-affected-by-cpas-lock