Compare commits

...

3 commits

Author SHA1 Message Date
xeruf
f8fa6fb67e config: variable adjustments 2023-04-07 19:35:56 +02:00
xeruf
7d2e650a04 aliases 2023-04-07 19:33:05 +02:00
xeruf
409c37fc97 config/sway/keyboard: make eu the default 2023-04-07 13:27:30 +02:00
9 changed files with 47 additions and 43 deletions

View file

@ -31,6 +31,9 @@ fi
xdh="$XDG_DATA_HOME" xdh="$XDG_DATA_HOME"
xch="$XDG_CONFIG_HOME" xch="$XDG_CONFIG_HOME"
xsh="$XDG_STATE_HOME" xsh="$XDG_STATE_HOME"
alias xdh="cd $XDG_DATA_HOME"
alias xch="cd $XDG_CONFIG_HOME"
alias xsh="cd $XDG_STATE_HOME"
if test -d "$DATA"; then if test -d "$DATA"; then
da=$(builtin cd $DATA/_* && pwd) da=$(builtin cd $DATA/_* && pwd)
d1=$(builtin cd $DATA/1* && pwd) d1=$(builtin cd $DATA/1* && pwd)
@ -201,9 +204,8 @@ alias scud='systemctl --user disable --now'
# Reload or restart matching systemctl service # Reload or restart matching systemctl service
unalias scr 2>/dev/null unalias scr 2>/dev/null
scr() { scr() {
systemctl --user daemon-reload echo -n "User: " && systemctl --user daemon-reload && systemctl --user reload-or-restart "$@" ||
echo -n "User: " && systemctl --user reload-or-restart "$@" || { echo -n "System: " && sudo systemctl daemon-reload && sudo systemctl reload-or-restart "$@"; } &&
{ echo -n "System: " && sudo systemctl reload-or-restart "$@"; } &&
echo "Successful reload" || echo "Successful reload" ||
scs "$@" scs "$@"
} }
@ -320,12 +322,12 @@ sshl() {
local authcache="/var/tmp/ssh-keys" local authcache="/var/tmp/ssh-keys"
mkdir -p "$authcache" mkdir -p "$authcache"
local file="$authcache/$1" local file="$authcache/$1"
ssh -G "$1" | grep --silent "^user root$" && ssh -G "$1" | grep --silent "^user root$" &&
! [[ "$1" =~ "pve.*" ]] && ! [[ "$1" =~ "pve.*" ]] &&
! [[ "$1" =~ "encee.*" ]] && ! [[ "$1" =~ "encee.*" ]] &&
! [[ "$1" =~ ".*fmh.de" ]] && ! [[ "$1" =~ ".*fmh.*" ]] &&
! [[ "$1" =~ "delta*" ]] && ! [[ "$1" =~ "delta*" ]] &&
local pass=pass local pass=pass
test "$all" && test "$all" &&
$pass scp ~/.bash_aliases "$1:" && $pass scp ~/.bash_aliases "$1:" &&
$pass ssh "$1" 'grep -q ".bash_aliases" .bashrc || echo "source ~/.bash_aliases" >>.bashrc' $pass ssh "$1" 'grep -q ".bash_aliases" .bashrc || echo "source ~/.bash_aliases" >>.bashrc'
@ -568,27 +570,34 @@ compdef mkcd=mkdir
# Other stuff {{{1 # Other stuff {{{1
# This is a function rather than a script as it potentially needs to cd out of the directory alias unmount=umoul
# This is a function rather than a script as it potentially needs to cd out
# if the current directory is the one to unmount
umoul() { umoul() {
local arg local arg
local mnt="${MNT:-${XDG_RUNTIME_DIR}/mnt}"
# get the last arg # get the last arg
for arg; do true; done for arg; do true; done
if test "$arg" case "$arg" in
then mountpoints="$(test -d "$arg" && realpath "$arg" || echo "${MNT:-${XDG_RUNTIME_DIR}/mnt}/$arg")" (-a|--all)
mountpoint "$mountpoints" 2>/dev/null || test -b "$mountpoints" || mountpoints=$(mount | grep "$mnt" | cut -d' ' -f3)
mountpoints="$(mount --show-labels | grep "$arg" | cut -d' ' -f3)" ("")
test "$mountpoints" || return 1 mountpoints="$(pwd | grep -v /home || echo /)"
else mountpoints="$PWD"
while test "$mountpoints" != "/"; do while test "$mountpoints" != "/"; do
mountpoint "$mountpoints" >/dev/null && break mountpoint "$mountpoints" >/dev/null && break
mountpoints="$(dirname "$mountpoints")" mountpoints="$(dirname "$mountpoints")"
done done
test "$(dirname "$mountpoints")" != "/" || test "$(dirname "$mountpoints")" != "/" ||
mountpoints="$(mount | mountpoints="$(mount |
grep --invert-match -e " /[^m][^/]*\(/[^/]*\)\? " -e "/sys" -e "/run/user" -e "/run/docker" | grep --invert-match -e " /[^m][^/]*\(/[^/]*\)\? " -e "/sys" -e "/run/user" -e "/run/docker" -e "/home" |
fzf --select-1 --exit-0 | awk '{print $3}')" || fzf --exit-0 | awk '{print $3}')" ||
return $? return $?
fi (*)
mountpoints="$(test -d "$arg" && realpath "$arg" || echo "$mnt/$arg")"
mountpoint "$mountpoints" 2>/dev/null || test -b "$mountpoints" ||
mountpoints="$(mount --show-labels | grep "$arg" | cut -d' ' -f3)"
test "$mountpoints" || return 1
esac
while true; do while true; do
case "$PWD" in case "$PWD" in
("$mountpoints"*) popd || builtin cd "$(dirname $mountpoints)";; ("$mountpoints"*) popd || builtin cd "$(dirname $mountpoints)";;

View file

@ -13,6 +13,8 @@ test "$DISPLAY" || return 0
alias graphics='lspci -vnn | grep VGA --color=never && xrandr --listproviders' alias graphics='lspci -vnn | grep VGA --color=never && xrandr --listproviders'
alias clip='cliphist list | fzf | cliphist decode | wl-copy'
# WIP Edit mozilla config # WIP Edit mozilla config
mozedit() ( mozedit() (
set -eo pipefail set -eo pipefail

View file

@ -1,16 +0,0 @@
input * {
xkb_layout de,eu,us
xkb_variant nodeadkeys,basic,euro
xkb_numlock enabled
xkb_options caps:escape_shifted_capslock
}
#input "1:1:AT_Translated_Set_2_keyboard" {
# xkb_switch_layout 1
#}
input "type:touchpad" {
tap enabled
natural_scroll disabled
accel_profile adaptive
dwt disabled
pointer_accel 0.4 # set mouse sensitivity (between -1 and 1)
}

View file

@ -1,6 +1,6 @@
input * { input * {
xkb_layout eu,de,us xkb_layout eu,de,us
xkb_variant nodeadkeys,basic,euro xkb_variant basic,nodeadkeys,euro
xkb_numlock enabled xkb_numlock enabled
xkb_options caps:escape_shifted_capslock xkb_options caps:escape_shifted_capslock
} }

View file

@ -1,3 +1,4 @@
display_preamble = false
# Don't ask for confirmations # Don't ask for confirmations
#assume_yes = ["emacs"] #assume_yes = ["emacs"]

View file

@ -159,7 +159,7 @@ setopt hist_save_no_dups
setopt hist_reduce_blanks setopt hist_reduce_blanks
unsetopt hist_ignore_space unsetopt hist_ignore_space
zshaddhistory() { zshaddhistory() {
[[ $1 != netkeeper* ]] && [[ $1 != killm* ]] [[ $1 != netkeeper* ]] && [[ $1 != killm* ]] && [[ $1 != "stretchly reset" ]]
} }
setopt sh_word_split setopt sh_word_split

View file

@ -1,13 +1,17 @@
#!/bin/sh #!/bin/sh -x
# Mount a partition by label or device identifier automatically # Mount a partition by label or device identifier automatically
# Includes interactive selection if no argument is given
set -eo pipefail set -eo pipefail
_help="$0 <device> [mountpoint] [options...]" _help="$0 <device> [mountpoint] [options...]"
case $1 in case $1 in
(-v) shift (-v) shift
bash -x "$0" "$@";; bash -x "$0" "$@";;
("") # TODO include size ("") # TODO include size
arg=$(lsblk --list --noheadings --output name,label,fstype,mountpoint | arg=$(
grep -v '/' | grep ".\+ [^ ]\+" | fzf --select-1 --exit-0 | { #for ip in $(sudo nmblookup -S \* | grep '^[0-9]' | cut -d' ' -f1)
#do timeout --kill-after=.1s .1s showmount --no-headers --exports "$ip" 2>/dev/null | sed "s|\([^ ]*\) .*|$ip:\1|"
#done &
lsblk --list --noheadings --output name,label,fstype,mountpoint | grep -v LUKS | grep -v '/' | grep ".\+ [^ ]\+"; } | fzf --exit-0 |
sed "s/^\([^ ]\+ \+\)\?\([^ ]\+\) \+[^ ]\+ *$/\2/");; sed "s/^\([^ ]\+ \+\)\?\([^ ]\+\) \+[^ ]\+ *$/\2/");;
(--help) echo "$_help" && exit 0;; (--help) echo "$_help" && exit 0;;
(-u) shift (-u) shift

View file

@ -1,9 +1,12 @@
#!/bin/sh -ex #!/bin/sh -ex
target="${1:-$PWD}" target="${1:-$PWD}"
cd $DATA/5* cd $DATA/5*
tar xf Qobuz-commandes.tar mkdir -p qobuz
mv -v *.jpg Qobuz-commandes/ cd qobuz
mv -v Qobuz-commandes $target/qobuz #$d4/music/Worship/ tar xf ../Qobuz-commandes.tar
mv -v ../*.jpg . || true
cd ..
mv -v qobuz $target/ #$d4/music/Worship/
rm -i Qobuz-commandes.tar rm -i Qobuz-commandes.tar
cd $target/qobuz cd $target/qobuz
find -type d -exec sh -c 'test $(ls "{}" | wc -l) -eq 1 && find "{}" -maxdepth 1 -type f | xargs -i% mv -v % .' \; find -type d -exec sh -c 'test $(ls "{}" | wc -l) -eq 1 && find "{}" -maxdepth 1 -type f | xargs -i% mv -v % .' \;

View file

@ -1,5 +1,6 @@
#!/bin/sh -e #!/bin/sh -e
# Execute commands on a zulip server # Execute commands on a zulip server
# https://zulip.readthedocs.io/en/latest/production/management-commands.html
zulipdepl="/home/zulip/deployments/current" zulipdepl="/home/zulip/deployments/current"
case $1 in case $1 in
(upgrade) (upgrade)