1
0
Fork 0

improve remapping capability

This commit is contained in:
Luca Bilke 2023-02-06 22:51:32 +01:00
parent 10c2fdd721
commit 8da5265f4d
5 changed files with 27 additions and 21 deletions

View File

@ -6,7 +6,7 @@ setbg &
xrdb "${XDG_CONFIG_HOME:-$HOME/.config}/x11/xresources" & xrdbpid=$!
remaps &
autostart="picom checkup dunst unclutter pipewire dwmblocks"
autostart="picom checkup dunst unclutter pipewire dwmblocks remapd"
for program in $autostart; do
pidof -s "$program" || "$program" &
done >/dev/null 2>&1

View File

@ -2,5 +2,5 @@
while : ; do
dmesg -W -f kern | grep "input:" -q
sleep 1
remaps-dvorak
remaps us:dvorak
done

View File

@ -58,7 +58,7 @@ onescreen() { # If only one output available or chosen.
postrun() { # Stuff to run to clean up.
setbg # Fix background if screen size/arangement has changed.
remaps-no-change # Re-remap keys if keyboard added (for laptop bases)
remaps -n # Re-remap keys if keyboard added (for laptop bases)
{ killall dunst ; setsid -f dunst ;} >/dev/null 2>&1 # Restart dunst to ensure proper location on screen
}

View File

@ -1,12 +1,15 @@
#!/bin/sh
groups="us:dvorak de:nodeadkeys"
current="$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"
index() {
echo "$groups" | cut -d ' ' -f "$1"
}
if [ "$1" = "-n" ]; then
newgroup="$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"
elif [ "$1" = "" ];
then
groups="us:dvorak de:nodeadkeys"
current="$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"
i=1
while [ ! "$found" ]; do
group=$(index $i)
@ -20,8 +23,11 @@ while [ ! "$found" ]; do
fi
i=$((i+1))
done
else
newgroup="$1"
fi
setxkbmap -layout "$(echo "$newgroup" | cut -d ':' -f1)" -variant "$(echo "$newgroup" | cut -d ':' -f2)" -option caps:super -option terminate:ctrl_alt_bksp
setxkbmap -layout "$(echo "$newgroup" | cut -d ':' -f1)" -variant "$(echo "$newgroup" | cut -d ':' -f2)" -option caps:super -option terminate:ctrl_alt_bksp 1>/dev/null 2>&1 || echo "Unkown keyboard layout"
xset r rate 300 50
killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape'
xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock

View File

@ -1,3 +1,3 @@
#/bin/sh
# pidof -x sbd-xkbmap >/dev/null 2>&1 || sbd-xkbmap >/dev/null 2>&1 &
printf "\033[11m\033[10m %s\n" "$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/ /')"
printf "\033[11m\033[10m %s\n" "$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"