improve remapping capability
This commit is contained in:
parent
10c2fdd721
commit
8da5265f4d
|
@ -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
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
while : ; do
|
||||
dmesg -W -f kern | grep "input:" -q
|
||||
sleep 1
|
||||
remaps-dvorak
|
||||
remaps us:dvorak
|
||||
done
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -1,27 +1,33 @@
|
|||
#!/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"
|
||||
}
|
||||
|
||||
i=1
|
||||
while [ ! "$found" ]; do
|
||||
group=$(index $i)
|
||||
if [ "$group" = "$current" ]; then
|
||||
newgroup=$(index $((i+1)))
|
||||
[ -z "$newgroup" ] && newgroup=$(index 1)
|
||||
found=true
|
||||
elif [ -z "$group" ]; then
|
||||
newgroup=$(index 1)
|
||||
found=true
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
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)
|
||||
if [ "$group" = "$current" ]; then
|
||||
newgroup=$(index $((i+1)))
|
||||
[ -z "$newgroup" ] && newgroup=$(index 1)
|
||||
found=true
|
||||
elif [ -z "$group" ]; then
|
||||
newgroup=$(index 1)
|
||||
found=true
|
||||
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
|
||||
|
|
|
@ -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/:/')"
|
||||
|
|
Loading…
Reference in New Issue