daitj / gnome-display-brightness-ddcutil

Display brightness slider for gnome shell using ddcutil backend
GNU General Public License v3.0
311 stars 39 forks source link

Brightness level reported by the extension not upated. #140

Open joaocandre opened 6 months ago

joaocandre commented 6 months ago

Describe the bug The slider in Gnome menu does not update brightness level if adjustments are made without the extension.

To Reproduce Adjust display brightness through any alternative means, such as: physical controls on the display, daemons such as clight or call ddcutil directly (e.g. ddcutil setvcp 10 90). Regardless of how brightness is set, the level reported by the extension won't change.

Delete cache file if it exists and try again No ~/.cache/ddcutil_detect on my system.

Journal logs

May 02 17:54:31 laptop gnome-shell[1662]: display-brightness-ddcutil extension:
                                               this.settings change detected, reloading widgets
May 02 17:54:31 laptop gnome-shell[1662]: display-brightness-ddcutil extension:
                                               Remove keyboard shortcuts
May 02 17:54:31 laptop gnome-shell[1662]: display-brightness-ddcutil extension:
                                               Add keyboard shortcuts
May 02 17:54:31 laptop gnome-shell[1662]: display-brightness-ddcutil extension:
                                               {"allow-zero-brightness":false,"disable-display-state-check":true,"hide-system-indicator":true,"only-all-slider":true,"show-all-slider":false,"show-display-name":true,"show-value-label":false,"verbose-debugging":true,"ddcutil-queue-ms":130,"ddcutil-sleep-multiplier":40,"position-system-indicator":1,"position-system-menu":4,"step-change-keyboard":2,"button-location":1,"ddcutil-additional-args":"","ddcutil-binary-path":"/usr/bin/ddcutil","decrease-brightness-shortcut":["<Control>XF86MonBrightnessDown"],"increase-brightness-shortcut":["<Control>XF86MonBrightnessUp"]}
May 02 17:54:32 laptop gnome-shell[1662]: display-brightness-ddcutil extension:
                                               Skipping reloadMenuWidgets because extensions is reloading, timer ref: [boxed instance wrapper GIName:GLib.Source jsobj@0x1dfa6489ec90 native@0x654979c1d5c0]
May 02 17:54:32 laptop gnome-shell[1662]: display-brightness-ddcutil extension:
                                               Reload extension
May 02 17:54:32 laptop gnome-shell[1662]: display-brightness-ddcutil extension:
                                               Remove keyboard shortcuts
May 02 17:54:32 laptop gnome-shell[1662]: display-brightness-ddcutil extension:
                                               Destroy all quick settings items
May 02 17:54:32 laptop gnome-shell[1662]: display-brightness-ddcutil extension:
                                               Adding to system menu
May 02 17:54:32 laptop gnome-shell[1662]: display-brightness-ddcutil extension:
                                               Add keyboard shortcuts
May 02 17:54:33 laptop gnome-shell[1662]: display-brightness-ddcutil extension:
                                               ddcutil brief info:
                                               Display 1
                                                  I2C bus:          /dev/i2c-1
                                                  DRM connector:    card1-HDMI-A-1
                                                  Monitor:          ACI:ASUS VX239:G8LMTJ005744

                                               Invalid display
                                                  I2C bus:          /dev/i2c-3
                                                  DRM connector:    card1-eDP-1
                                                  Monitor:          AUO::

May 02 17:54:33 laptop gnome-shell[1662]: display-brightness-ddcutil extension:
                                               ddcutil brief info found bus line:
                                                   I2C bus:          /dev/i2c-1
May 02 17:54:33 laptop gnome-shell[1662]: display-brightness-ddcutil extension:
                                               ddcutil reading display state for bus: 1
May 02 17:54:33 laptop gnome-shell[1662]: display-brightness-ddcutil extension:
                                               ddcutil brief info found bus line:
                                                   I2C bus:          /dev/i2c-3
May 02 17:54:33 laptop gnome-shell[1662]: display-brightness-ddcutil extension:
                                               ddcutil reading display state for bus: 3
May 02 17:54:33 laptop gnome-shell[1662]: display-brightness-ddcutil extension:
                                               ddcutil reading display status for bus: 3 is: DDC communication failed for monitor on bus /dev/i2c-3
May 02 17:54:33 laptop gnome-shell[1662]: display-brightness-ddcutil extension:
                                               ddcutil reading display status for bus: 1 is: VCP D6 SNC x01
May 02 17:54:35 laptop gnome-shell[1662]: display-brightness-ddcutil extension:
                                               Reloading widgets
May 02 17:54:36 laptop gnome-shell[1662]: display-brightness-ddcutil extension:
                                               Remove keyboard shortcuts
May 02 17:54:36 laptop gnome-shell[1662]: display-brightness-ddcutil extension:
                                               Destroy all quick settings items
May 02 17:54:38 laptop gnome-shell[1662]: display-brightness-ddcutil extension:
                                               Adding to system menu
May 02 17:54:38 laptop gnome-shell[1662]: display-brightness-ddcutil extension:
                                               Add keyboard shortcuts
May 02 17:54:38 laptop gnome-shell[1662]: display-brightness-ddcutil extension:
                                               ddcutil brief info:
                                               Display 1
                                                  I2C bus:          /dev/i2c-1
                                                  DRM connector:    card1-HDMI-A-1
                                                  Monitor:          ACI:ASUS VX239:G8LMTJ005744

                                               Invalid display
                                                  I2C bus:          /dev/i2c-3
                                                  DRM connector:    card1-eDP-1
                                                  Monitor:          AUO::

May 02 17:54:38 laptop gnome-shell[1662]: display-brightness-ddcutil extension:
                                               ddcutil brief info found bus line:
                                                   I2C bus:          /dev/i2c-1
May 02 17:54:38 laptop gnome-shell[1662]: display-brightness-ddcutil extension:
                                               ddcutil reading display state for bus: 1
May 02 17:54:38 laptop gnome-shell[1662]: display-brightness-ddcutil extension:
                                               ddcutil brief info found bus line:
                                                   I2C bus:          /dev/i2c-3
May 02 17:54:38 laptop gnome-shell[1662]: display-brightness-ddcutil extension:
                                               ddcutil reading display state for bus: 3
May 02 17:54:39 laptop gnome-shell[1662]: display-brightness-ddcutil extension:
                                               ddcutil reading display status for bus: 3 is: DDC communication failed for monitor on bus /dev/i2c-3
May 02 17:54:39 laptop gnome-shell[1662]: display-brightness-ddcutil extension:
                                               ddcutil reading display status for bus: 1 is: VCP D6 SNC x01
May 02 17:54:41 laptop gnome-shell[1662]: display-brightness-ddcutil extension:
                                               Reloading widgets

Desktop (please complete the following information):

daitj commented 5 months ago

Yeah this is expected, refreshing slider when you open will be slow as ddcutil itself takes some time to report these values back. Perhaps if we use ddccontrol, like mentioned in #137, there might be a way to listen for changes, don't know yet, this needs some investgation.

joaocandre commented 5 months ago

It being slow is, as you say, expected. But what I reported was that it doesn't update at all if you adjust brightness using the physical buttons on the display (or just run ddcutil separately).

I'm assuming the brightness level is only updated on each manual increment using the slider, while perhaps for it reflect the actual state of the display you'd need to be frequently polling the level on the background (or, for less overhead, just trigger an update whenever the system menu is opened).

daitj commented 4 months ago

During initial developement I tried to fetch the values when after menu was open, it introduced some lag between the slider is visible with old value and then gets updated with current value set manually.

Frequent polling is not the answer. But adding an extra fetch when menu is opened is not a big deal, if you can live with the lag.