I know how to map mouse click for F1, F2 and F3 (respectively left click, middle click, right click):
xkbset m # required, but disable keypad
xmodmap -e "keycode 67 = Pointer_Button1 Pointer_Button1"
xmodmap -e "keycode 68 = Pointer_Button2"
xmodmap -e "keycode 69 = Pointer_Button3"
But this requires me to use xkbset m
that use the slow keys mode :
If I press 4 from the keypad, it moves the cursor to the left. I don't need this feature, just the mapping above.
I tried to figure it out with xdotool
, but I don't know how to handle key pressed/key released (for drag & drop) with
xdotool mousedown 1
xdotool mouseup 1
How can I not use this mode or how can I remap all keypad keys ?
What about the numeric and arithmetic signs from keypad please ?
Is there another solution ?
For information, needed for Debian (cinnamon) and Archlinux (xfce), and if possible, I would like a solution not based on the window manager.
EDIT:
Tried this solution but I can't drag and drop with F1.
In ~/.xbindkeysrc
:
"xdotool mousedown 1"
F1
"xdotool mouseup 1"
F1 + Release
Or :
"xdotool mousedown 1"
m:0x10 + c:67
"xdotool mouseup 1"
m:0x10 + c:67 + Release
Then :
xset -r 67
EDIT2
Tried with actkbd
# actkbd configuration file
<keycode ("67")> :key : :xdotool mousedown 1
<keycode ("67")> :rel : :xdotool mouseup 1
No cigar :/
Adapted from here
Best Answer
W00T !
First : create a script
click
: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 agnosticEdit:
don't know why this doesn't work with archlinux + xfce 4.12 but on Debian9 + Cinnamon
Edit :
This solution works better :
In
.bashrc
:As a keyboard shortcut :