Is there any way to bind the meta key (a.k.a. super key / Windows key) to a left click using xbindkeys? I would like that hitting the meta key triggers a left click, and hold down the meta key allows to drag and drop (just like it would do when holding down left click).
This is possible. The following will disable the super key and rebind it to the left mouse button. If you wish to preserve the functionality of the super key while also binding to the left mouse button, check out this question.
There seem to be some issues with
xbindkeys when we use a modifier key to trigger mouse or keyboard events, so we will first rebind the super key to a non-modifier key using
First, determine the keycode and keysym of your super key using
xbindkeys --key, and substitute these values in the commands below. Example output, indicating keycode 134 and keysym Super_R:
m:0x50 + c:134 Mod2+Mod4 + Super_R
Remove the super key from the modifier map:
xmodmap -e 'remove mod4 = Super_R'
Rebind the super key to an unused keysym (in this example, F13):
xmodmap -e 'keycode 134 = F13'
Disable autorepeat for the rebinded key:
xset -r 134
xdotool and add the following to
~/.xbindkeysrc to configure
xte or another virtual input program can be used instead of
"xdotool mousedown 1" F13 "xdotool mouseup 1" F13 + release
Now simply kill any existing
xbindkeys instance and run
xbindkeys. The super key will behave as a left mouse button.
Note that these settings are not preserved across sessions. To set things up automatically, run the following at the start of each session (along with starting
xmodmap -e 'remove mod4 = Super_R' -e 'keycode 134 = F13' && xset -r 134