improve remapping capability
This commit is contained in:
parent
10c2fdd721
commit
8da5265f4d
5 changed files with 27 additions and 21 deletions
|
@ -6,7 +6,7 @@ setbg &
|
||||||
xrdb "${XDG_CONFIG_HOME:-$HOME/.config}/x11/xresources" & xrdbpid=$!
|
xrdb "${XDG_CONFIG_HOME:-$HOME/.config}/x11/xresources" & xrdbpid=$!
|
||||||
remaps &
|
remaps &
|
||||||
|
|
||||||
autostart="picom checkup dunst unclutter pipewire dwmblocks"
|
autostart="picom checkup dunst unclutter pipewire dwmblocks remapd"
|
||||||
for program in $autostart; do
|
for program in $autostart; do
|
||||||
pidof -s "$program" || "$program" &
|
pidof -s "$program" || "$program" &
|
||||||
done >/dev/null 2>&1
|
done >/dev/null 2>&1
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
while : ; do
|
while : ; do
|
||||||
dmesg -W -f kern | grep "input:" -q
|
dmesg -W -f kern | grep "input:" -q
|
||||||
sleep 1
|
sleep 1
|
||||||
remaps-dvorak
|
remaps us:dvorak
|
||||||
done
|
done
|
||||||
|
|
|
@ -58,7 +58,7 @@ onescreen() { # If only one output available or chosen.
|
||||||
|
|
||||||
postrun() { # Stuff to run to clean up.
|
postrun() { # Stuff to run to clean up.
|
||||||
setbg # Fix background if screen size/arangement has changed.
|
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
|
{ killall dunst ; setsid -f dunst ;} >/dev/null 2>&1 # Restart dunst to ensure proper location on screen
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,27 +1,33 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
groups="us:dvorak de:nodeadkeys"
|
|
||||||
current="$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"
|
|
||||||
|
|
||||||
index() {
|
index() {
|
||||||
echo "$groups" | cut -d ' ' -f "$1"
|
echo "$groups" | cut -d ' ' -f "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
i=1
|
if [ "$1" = "-n" ]; then
|
||||||
while [ ! "$found" ]; do
|
newgroup="$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"
|
||||||
group=$(index $i)
|
elif [ "$1" = "" ];
|
||||||
if [ "$group" = "$current" ]; then
|
then
|
||||||
newgroup=$(index $((i+1)))
|
groups="us:dvorak de:nodeadkeys"
|
||||||
[ -z "$newgroup" ] && newgroup=$(index 1)
|
current="$(setxkbmap -query | grep -oP '(layout|variant):\s*\K\w+' | sed ':a;N;s/\n/:/')"
|
||||||
found=true
|
i=1
|
||||||
elif [ -z "$group" ]; then
|
while [ ! "$found" ]; do
|
||||||
newgroup=$(index 1)
|
group=$(index $i)
|
||||||
found=true
|
if [ "$group" = "$current" ]; then
|
||||||
fi
|
newgroup=$(index $((i+1)))
|
||||||
i=$((i+1))
|
[ -z "$newgroup" ] && newgroup=$(index 1)
|
||||||
done
|
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
|
xset r rate 300 50
|
||||||
killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape'
|
killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape'
|
||||||
xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock
|
xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#/bin/sh
|
#/bin/sh
|
||||||
# pidof -x sbd-xkbmap >/dev/null 2>&1 || sbd-xkbmap >/dev/null 2>&1 &
|
# 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…
Add table
Reference in a new issue