Screen brightness +/- with keyboard shorcuts & OSD

On Fedora Silverblue 35 & using a keyboard with no media keys, currently adding Custom Keyboard Shortcuts for Brightness Up/Down using, e.g., the command:

gdbus call --session --dest org.gnome.SettingsDaemon.Power --object-path /org/gnome/SettingsDaemon/Power --method org.gnome.SettingsDaemon.Power.Screen.StepUp

This works, however the OSD is not triggered.

Ideally it seems, org.gnome.Settings would include Brightness Up/Down with its inbuilt keyboard symbols (analogous to XF86KbdBrightnessUp), as it does with Volume Up/Down in the Keyboard Shortcuts / Sound and Media Section.

Can this be added/modified with a change to dbus:/org/gnome/desktop/input-sources/xkb-options ? (I’d prefer doing so rather than changing ~/.config/xkb).

Short of these changes, is there a way to trigger the OSD for Screen Brightness with and additional command in the same keyboard shortcut mentioned above?


This is because it’s not the settings daemon that sends a request to show the OSD, it’s GNOME Shell itself when it notices a brightness up/down key press. If you open dbus-monitor --session then press the brightness key, it’ll give you something like this:

dbus-monitor output log
signal time=1645539568.611688 sender=:1.16 -> destination=:1.58 serial=1740 path=/org/gnome/Shell; interface=org.gnome.Shell; member=AcceleratorActivated
   uint32 126
   array [
      dict entry(
         string "timestamp"
         variant             uint32 13992990
      dict entry(
         string "action-mode"
         variant             uint32 1
      dict entry(
         string "device-node"
         variant             string "/dev/input/event11"
method call time=1645539568.612719 sender=:1.58 -> destination=:1.61 serial=88 path=/org/gnome/SettingsDaemon/Power; interface=org.gnome.SettingsDaemon.Power.Screen; member=StepUp
method return time=1645539568.613831 sender=:1.61 -> destination=:1.58 serial=96 reply_serial=88
   int32 77
   string "eDP-1"
method call time=1645539568.614846 sender=:1.58 -> destination=:1.16 serial=89 path=/org/gnome/Shell; interface=org.gnome.Shell; member=ShowOSD
   array [
      dict entry(
         string "icon"
         variant             string "display-brightness-symbolic"
      dict entry(
         string "level"
         variant             double 0.77
      dict entry(
         string "connector"
         variant             string "eDP-1"

At the beginning a dbus signal is sent to destination 1.58 here (to the media keys daemon, as checked in d-feet) from GNOME Shell (1.16), and in the later two method calls you can see it’s the media keys daemon (1.58) which asks to the settings daemon to change the brightness, and which also asks GNOME Shell (1.16) to show the correct OSD. Hence it is not your call to org.gnome.SettingsDaemon.Power.Screen.StepUp which triggers the OSD, but it’s the media keys daemon itself, so that’s why you’re not seeing the OSD.

In any case, even if changing the brightness key is not available in the keyboard shortcuts settings, they are still accessible by changing the gsettings key (which are all listed with gsettings list-keys, and here the gsettings keys you’ll need to change are screen-brightness-up and screen-brightness-down. For example, gsettings set screen-brightness-up "['equal']" will make the = key toggle the brightness up.

Since the settings app already allow changing the keyboard shortcuts for volume up/down, I don’t see a reason why it could not include brightness up/down too. Now, there probably needs to be some limit to the amount of shortcuts that should be included in the UI, some kind of rule, but this particular one seems sensible enough. There is already an issue opened for your particular issue of not having those shortcuts included in the Settings, so maybe you can give your use-case there and some informations on e.g. your hardware.

I do think it would be nice that when one installs GNOME it asks whether you want to assign some particular keys to such action when no dedicated key with the proper marking on it is detected (i.e. screen brightness drawing on one of the Fn keys), and hence not available as a “screen brightness” key from the kernel. But that’s a separate issue anyway.

1 Like

Thank you. I did not know where to look for those available gsettings keys.

For this solution, using my chosen keys which happen to belong to a Chromebook keyboard, the only necessary step is:

gsettings set screen-brightness-down "['<Super>F6']" 
gsettings set screen-brightness-up "['<Super>F7']"

I’ll add to the GNOME gitlab issue with a link back here.

Small note from the sideline: It’s a bit more complicated than that.

  1. mutter detects an externally registered keybinding
  2. gnome-shell signals via D-Bus that the corresponding action ID was activated
  3. gnome-settings-daemon’s media-plugin matches the ID to a brightness action and
    a) calls out to the power plugin to change the brightness
    b) asks gnome-shell to show an OSD with a specified icon and progress

Your main point that it’s not gnome-settings-daemon’s power plugin that requests the OSD is correct though.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.