Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gnome 3 - dconf / gsettings - how to assign multiple keybindings?

Goal: Assign both the Super_L or Super_R keys as triggers for the overlay menu.

Environment: Gnome 3.26.2, Fedora 27, Dell XPS 9550, Kinesis Advantage2

Why: For work I use a laptop either by itself or in conjunction with external monitors, keyboard, and mouse. The laptop keyboard has a left super (windows) key and no right super (windows) key. However, the external keyboard has a right super (windows) key but no left super (windows) key.

Currently, I have to open the gnome-tweak-tool or dconf-editor to swap between the Super_L and Super_R key each time I switch between using the laptop in isolation or with my external devices (or perform the gsettings equivalent: gsettings set org.gnome.mutter overlay-key 'Super_{L/R}').

Status: I've attempted to assign both the Super_L and Super_R for the org.gnome.mutter.overlay-key value through both the GUI based dconf-editor tool (as well as through the CLI driven gsettings alternative) utilizing many different syntax strategies, but without success.

A listing of all gsettings can be output through the following command: gsettings list-recursively > gsettings.txt. According to this file, the appropriate syntax for multi-key values is the following: ['value1', 'value2']. However, attempting to set values according to this format (gsettings set org.gnome.mutter overlay-key ['Super_L', 'Super_R']) yields the gsettings usage menu, implying an invalid command format.

I'm less concerned about using the GUI based dconf-editor as ultimately, I'll be using configuration management software to perform the configuration (via gsettings) for me (I utilize Chef to build and configure my laptop).

Question: How can I enable both Super_L or Super_R to trigger the Fedora overlay menu using the gsettings configuration tool?

Formats I've tried which do not work:

  • dconf write /org/gnome/mutter/overlay-key
  • gsettings set org.gnome.mutter overlay-key

with

  • "['Super_L','Super_R']"
  • "['Super_L', 'Super_R']"
  • ['Super_L','Super_R']
  • ['Super_L', 'Super_R']
  • 'Super_L','Super_R'
  • 'Super_L', 'Super_R'

Any tips, hints, or suggestions would be greatly appreciated!

-- Informatician

P.S. - I didn't mention it explicitly, but I did search exhaustively on how to enter multi-valued key bindings via gsettings but was unable to discover an example that I could replicate without error.

References:

  • Ensured my super keys are mod4 as appropriate via xmodmap -pm. https://askubuntu.com/questions/5095/typing-using-key-combinations.
like image 283
Informatician Avatar asked Nov 22 '17 16:11

Informatician


1 Answers

The follow process got both super buttons working to open the main panel menu (although I'm on Pop!_OS with Gnome v3.38):

Firstly, open Gnome Tweaks (you may need to install it), navigate to Keyboard & Mouse, and set the Overview Shortcut to Left Super.

enter image description here

Next, either use the dconf editor or your terminal to set one of the following (setting both will result in one being ignored):

# Worked on Pop!_OS v20.10 with Gnome v3.38.2
gsettings set org.gnome.desktop.wm.keybindings panel-main-menu "['Super_R']"

# OR (don't set both)

# Worked on Pop!_OS v21.04 with Gnome v3.38.5
gsettings set org.gnome.settings-daemon.plugins.media-keys search "['Super_R']"

Note that this will have some implications on shortcuts: at this point, my left-hand super key works when combining it with other characters (e.g.: Super+m to maximize), while the right will always just show the panel main menu (or app search menu), no matter the key combination. You can obviously reverse this using the steps above.

like image 71
vee Avatar answered Sep 20 '22 08:09

vee