elementary / switchboard-plug-keyboard

Switchboard Keyboard Plug
GNU General Public License v2.0
28 stars 22 forks source link

Media keys no longer assignable in eos7 #434

Closed svandragt closed 11 months ago

svandragt commented 1 year ago

What Happened?

In eos6.1 I was able to set my eject key to trigger multitasking view but on eos7 the key is no longer recognised when attempting to capture it (setting a new shortcut key). Instead nothing happens.

Steps to Reproduce

  1. Open Keyboard settings > Shortcuts > Workspaces
  2. Click the cog on Multitasking View > Set New shortcut
  3. Press the eject key

Expected Behavior

Eject key is set as shortcut

OS Version

7.x (Early Access)

Software Version

Latest release (I have run all updates)

Log Output

This is the log of xev for a keypress and release of the eject key:

FocusOut event, serial 38, synthetic NO, window 0x6400001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 38, synthetic NO, window 0x6400001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 38, synthetic NO, window 0x0,
    keys:  2   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

Hardware Info

         eeeeeeeeeeeeeeeee          
      eeeeeeeeeeeeeeeeeeeeeee        
    eeeee  eeeeeeeeeeee   eeeee       OS: elementary OS 7 Horus x86_64 
  eeee   eeeee       eee     eeee     Host: MS-7D15 1.0 
 eeee   eeee          eee     eeee    Kernel: 5.15.0-58-generic 
eee    eee            eee       eee   Uptime: 22 hours, 53 mins 
eee   eee            eee        eee   Packages: 1912 (dpkg), 47 (flatpak), 8 (snap) 
ee    eee           eeee       eeee   Shell: zsh 5.8.1 
ee    eee         eeeee      eeeeee   Resolution: 1920x1080, 1920x1080 
ee    eee       eeeee      eeeee ee   DE: Pantheon 
eee   eeee   eeeeee      eeeee  eee   WM: Mutter(Gala) 
eee    eeeeeeeeee     eeeeee    eee   Theme: io.elementary.stylesheet.blueberry [GTK3] 
 eeeeeeeeeeeeeeeeeeeeeeee    eeeee    Icons: elementary [GTK3] 
  eeeeeeee eeeeeeeeeeee      eeee     Terminal: io.elementary.t 
    eeeee                 eeeee       CPU: 11th Gen Intel i5-11500 (12) @ 4.600GHz 
      eeeeeee         eeeeeee         GPU: Intel RocketLake-S GT1 [UHD Graphics 750] 
         eeeeeeeeeeeeeeeee            Memory: 8808MiB / 31911MiB 

Apple Magic Keyboard model A1644, connected with a usb-lightning cable.

ryonakano commented 1 year ago

I tried the same way with #457 to fix this issue and confirmed I can assign Eject key for shortcuts on my MacBook Air (11-inch, 2010):

screenshot

diff --git a/src/Widgets/Shortcuts/CustomShortcutListBox.vala b/src/Widgets/Shortcuts/CustomShortcutListBox.vala
index 94cb8c15..16ac0e60 100644
--- a/src/Widgets/Shortcuts/CustomShortcutListBox.vala
+++ b/src/Widgets/Shortcuts/CustomShortcutListBox.vala
@@ -338,6 +338,7 @@ class Pantheon.Keyboard.Shortcuts.CustomShortcutListBox : Gtk.ListBox, ShortcutD
                     case Gdk.Key.F12:
                     case Gdk.Key.Menu:
                     case Gdk.Key.Print:
+                    case Gdk.Key.Eject:
                         // Accept certain keys as single key accelerators
                         var shortcut = new Pantheon.Keyboard.Shortcuts.Shortcut (keyval, mods);
                         update_binding (shortcut);
diff --git a/src/Widgets/Shortcuts/ShortcutListBox.vala b/src/Widgets/Shortcuts/ShortcutListBox.vala
index 8136e3f6..957e16b8 100644
--- a/src/Widgets/Shortcuts/ShortcutListBox.vala
+++ b/src/Widgets/Shortcuts/ShortcutListBox.vala
@@ -266,6 +266,7 @@ private class Pantheon.Keyboard.Shortcuts.ShortcutListBox : Gtk.ListBox, Shortcu
                     case Gdk.Key.F12:
                     case Gdk.Key.Menu:
                     case Gdk.Key.Print:
+                    case Gdk.Key.Eject:
                         // Accept certain keys as single key accelerators
                         var shortcut = new Pantheon.Keyboard.Shortcuts.Shortcut (keyval, mods);
                         update_binding (shortcut);

However, the assigned action is not triggered for some reason even if I push Eject key. (might be swallowed by someone like GSD?)

svandragt commented 1 year ago

As a workaround you can use dconf and set the <Eject> string as a value for the keybinding (in my case /org/pantheon/desktop/gala/keybindings/expose-windows) until the settings panel is updated. Interestingly, for me that is triggering once it is assigned.

lenemter commented 1 year ago

However, the assigned action is not triggered for some reason even if I push Eject key. (might be swallowed by someone like GSD?)

Kind of... When gala starts, GSD grabs all media-keys listed as *-static in /org/gnome/settings-daemon/plugins/media-keys/ (such as XF86Eject or XF86AudioLowerVolume) and for that reason the shortcuts are not triggered.

The workaround is to find corresponding *-static shortcut in /org/gnome/settings-daemon/plugins/media-keys/ and remove it. After that the <Eject> (and all the others) should work.

TBH I don't know why *-static exists. Maybe we can move the *-static shortcuts into their normal versions and fix the issue by displaying the shortcuts in the plug.