Edit: A simpler solution is to use the xcape
package,
as described in this answer.
Wow. 10 years ago?! Better late than never, I guess? ;-)
You can certainly do this with xbindkeys
.
sudo apt-get install xbindkeys
Run xbindkeys -k
and press the "Super (Win) key" to find the key name.
For example:
system@/dev/pts/5:$ xbindkeys -k
Press combination of keys or/and click under the window.
You can use one of the two lines after "NoCommand"
in $HOME/.xbindkeysrc to bind a key.
"(Scheme function)"
m:0x50 + c:133
Mod2+Mod4 + Super_L
Now you can add the following to ~/.xbindkeysrc
# Run command on Super_L release event
"bash -c xfce4-popup-whiskermenu"
release+Super_L
Now, run xbindkeys -p
to poll for the changes.
If all went well, it works!
I have a hail mary workaround idea.
# Run command on Super_L release event
"bash -c 'sleep 0.1; xfce4-popup-whiskermenu'"
release + m:0x50 + c:133
Introduce a slight delay to give the menu time, and hopefully trigger correctly upon release. If 0.1
doesn't work try up to .5
, but if by half a second it doesn't work, it's not going to.
Make sure that, after changes, you run xbindkeys -p
. To really make sure, pkill xbindkeys && xbindkeys
Completely stopping and restarting the program is a guarantee.
If the "hail mary" fails, you could try a possible interception.
sudo apt-get install xdotool
Then run:
nano ~/super_key_menu.sh
Add the following:
#!/bin/bash
# Wait for the Super key to be released
while true; do
# Check if the Super key is pressed
if xdotool getkeystate 133; then
sleep 0.1 # Delay to ensure key release is detected
else
# Trigger the Whisker menu
xfce4-popup-whiskermenu
break
fi
sleep 0.05 # Check every 50ms
done
Save & exit, then chmod +x ~/super_key_menu.sh
Now, change the bash -c
line in ~/.xbindkeysrc
to:
"bash ~/super_key_menu.sh"
Restart xbindkeys or use the xbindkeys -p
(I've run into a case before where a version of xbindkeys didn't have -p.)
xcape
for binding the appropriate keys to "Super": askubuntu.com/a/1356907/618353