How to map mouse keys as keyboard keys without losing'numeric keypad' for Linux?
W00T !
First : create a script click
:
#!/bin/bash
id=$(
xinput list |
awk '/Dell USB Keyboard/{print gensub(/.*id=([0-9]+).*/, "\\1", "1")}'
)
xdotool mousedown $1
while IFS= read -r event; do
if [[ $event == *release* ]]; then
xdotool mouseup $1
exit
fi
done < <(xinput test $id)
Then add a new keyboard shortcut in your window manager and map F1 to run /path/to/mouse <1|3>
(left OR right click).
Et voilà ;)
This can be ran with xbindkeys
to be WM agnostic
Edit:
don't know why this doesn't work with archlinux + xfce 4.12 but on Debian9 + Cinnamon
Edit :
This solution works better :
In .bashrc
:
xmodmap -e "keycode 67 = Pointer_Button1 Pointer_Button1"
xmodmap -e "keycode 68 = Pointer_Button2"
xmodmap -e "keycode 69 = Pointer_Button3"
As a keyboard shortcut :
#!/bin/bash
id=$(
xinput list |
awk '/Dell USB Keyboard/{print gensub(/.*id=([0-9]+).*/, "\\1", "1")}'
)
(
while read event; do
if [[ $event == *release* ]]; then
xkbset -m
exit
fi
done < <(xinput test $id)
) &
xkbset m