2

I want to know whether there is a way to use super(win) key alone as shortcut without change its function as a modifier.

On ubuntu, by default, pressing and then releasing super key, without pressing other keys, will invoke activity overview. But I want it to invoke a shell script written by me. And when super key and other key are pressed simultaneously, I want it to function as before.

I know how to disable super key from invoking activity overview in dconf-editor, but I do not know how to remap it.

2
  • did you try xcape ?? sudo apt install xcape
    – UnKNOWn
    Nov 20, 2020 at 10:27
  • @UnKNOWn xcape works, thank you!
    – Simon
    Nov 20, 2020 at 11:34

1 Answer 1

1

You can indeed put pressing and releasing Super to your own use with a utility like xcape (present in the default Ubuntu repositories) or ksuperkey.

You first need to disable the default assignment of Super in Gnome Shell:

gsettings set org.gnome.desktop.wm.keybindings panel-main-menu []

Then you can use xcape to redirect pressing and releasing Super alone to a regular shortcut key combination, in particular the regular keyboard combination you use to launch your script.

For example, suppose we want Super to display the application overview. That action is already bound to Super+a, so to achieve that, we autostart the following command on login:

xcape -e "Super_L=Super_L|a"  #Load 

For your custom script, assign it a regular shortcut first using "Settings - Keyboard Shortcuts" and substitute Super_L|a by that shortcut key.

To undo, disable the autostart command and reset the dconf key to default with the command gsettings reset org.gnome.desktop.wm.keybindings panel-main-menu.

1
  • Thank you very much, it works perfect! And I never thought I could receive a reply in such a short time! But just one more thing to mention, the setting of super key for activity overview is not set at org.gnome.desktop.wm.keybindings panel-main-menu, but org.gnome.mutter.overlay-key, at least on my machine.
    – Simon
    Nov 20, 2020 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.