Bug 353032

Summary: Add ability to set screen brightness for non-laptop displays so I can adjust to the room's lighting
Product: [Plasma] Powerdevil Reporter: Michael Ziegler <diese-addy>
Component: generalAssignee: Plasma Development Mailing List <plasma-devel>
Status: RESOLVED FIXED    
Severity: wishlist CC: bugseforuns, hockeymikey, jpetso, kde.milrind, kde, kde, nate, picotmathieu
Priority: NOR    
Version: 5.4.0   
Target Milestone: ---   
Platform: Debian unstable   
OS: Linux   
Latest Commit: Version Fixed In: 6.2.0
Sentry Crash Report:

Description Michael Ziegler 2015-09-22 09:20:39 UTC
When using a projector to work on a task with multiple people, we turn off the lights in the office so we can better see the projector's image. However my screens are configured for when the lights are on, so I'm then staring into two enormously bright displays. On a laptop, I'd simply adjust the backlight, but on desktop displays, this is cumbersome because it requires fiddling with the monitor's configuration, which usually sucks.

Googling reveals that display brightness can also be tuned in software using a command such as this:

xrandr --output HDMI1 --brightness 1.0 --output HDMI2 --brightness 1.0

Xrandr can also find out whether or not a specific display has a backlight that can be controlled. I'd love if the laptop widget would simply also be there on a desktop and adjust the brightness of all attached screens, either by adjusting the backlight or the brightness, without me even need to think about laptop or no.


Reproducible: Always
Comment 1 Martin Flöser 2016-07-20 13:10:06 UTC
Reassign to powerdevil which is responsible for screen brightness
Comment 2 Kai Uwe Broulik 2016-09-04 11:14:57 UTC
Thanks for the tip with xrandr brightness, I only knew using DDC (which I made an experimental backend for). However, PowerDevil (or Plasma in general) is currently in no way equipped to handle multiple brightness controls.
Comment 3 Patrick Silva 2018-04-04 13:42:06 UTC
good request. Currently brightness slider is available in power menu from system tray when I use a desktop computer but it does not work.
Comment 4 Jakob Petsovits 2024-05-06 19:21:03 UTC
Had a quick look, apparently xrandr's `--brightness` option works by modifying the gamma, i.e. a color transformation thing. This is probably not something we want to implement as long as brightness adjustments are part of PowerDevil, but very much in scope once we manage to move brightness adjustments from PowerDevil to KWin.

Support for per-display brightness in general (i.e. for backlight and DDC displays simultaneously) is on its way, slowly.
Comment 5 Bug Janitor Service 2024-05-20 17:02:45 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/powerdevil/-/merge_requests/361
Comment 6 Jakob Petsovits 2024-08-23 19:39:38 UTC
Git commit 0bfc76473105819c66ce0240a9cf9406739c0202 by Jakob Petsovits.
Committed on 23/08/2024 at 19:36.
Pushed by jpetso into branch 'master'.

daemon: Introduce per-display ScreenBrightnessControl D-Bus API

In addition to a new ScreenBrightnessControl action to expose the
eponymous D-Bus API, this commit also adds the necessary plumbing
to relay display label, the is-internal boolean, as well as client
source name/context through ScreenBrightnessController.
Related: bug 431994

M  +14   -6    daemon/actions/bundled/CMakeLists.txt
M  +19   -4    daemon/actions/bundled/brightnesscontrol.cpp
M  +4    -1    daemon/actions/bundled/brightnesscontrol.h
A  +205  -0    daemon/actions/bundled/org.kde.Solid.PowerManagement.Actions.ScreenBrightnessControl.xml
A  +106  -0    daemon/actions/bundled/powerdevilscreenbrightnesscontrolaction.json
A  +199  -0    daemon/actions/bundled/screenbrightnesscontrol.cpp     [License: GPL(v2.0+)]
A  +92   -0    daemon/actions/bundled/screenbrightnesscontrol.h     [License: GPL(v2.0+)]
M  +44   -11   daemon/controllers/screenbrightnesscontroller.cpp
M  +37   -10   daemon/controllers/screenbrightnesscontroller.h

https://invent.kde.org/plasma/powerdevil/-/commit/0bfc76473105819c66ce0240a9cf9406739c0202
Comment 7 Jakob Petsovits 2024-08-23 19:39:48 UTC
Git commit 88aa87f7e6c291de02e6a585a04ccb0ebfcfd006 by Jakob Petsovits.
Committed on 23/08/2024 at 19:36.
Pushed by jpetso into branch 'master'.

applets/brightness: Per-display brightness controls

This uses the new per-display D-Bus API from PowerDevil.

Following this change, the applet does not use the old
BrightnessControl D-Bus interface anymore, only the new
ScreenBrightnessControl interface. A new ScreenBrightnessDisplayModel
class is added to allow the use of QML Repeater objects in the UI.

For scrolling on the icon, the applet does not need to know or
specify which displays are changed, this responsibility now lies with
the daemon and its AdjustBrightnessRatio/AdjustBrightnessSteps methods.

Autotests are adapted accordingly, including changes by Fushan Wen.
Note that reported brightness for the mocked backlight display will
be lower by 1 in the new API, because minimum brightness of 1
(default for internal displays) is subtracted from the underlying
brightness value. Hence we now test for values from 0 to 254.
Related: bug 431994, bug 481927, bug 487812

M  +15   -7    applets/brightness/package/contents/ui/BrightnessItem.qml
M  +0    -1    applets/brightness/package/contents/ui/CompactRepresentation.qml
M  +65   -40   applets/brightness/package/contents/ui/PopupDialog.qml
M  +44   -18   applets/brightness/package/contents/ui/main.qml
M  +1    -0    applets/brightness/plugin/CMakeLists.txt
M  +158  -53   applets/brightness/plugin/screenbrightnesscontrol.cpp
M  +39   -13   applets/brightness/plugin/screenbrightnesscontrol.h
A  +103  -0    applets/brightness/plugin/screenbrightnessdisplaymodel.cpp     [License: GPL(v2.0+)]
A  +49   -0    applets/brightness/plugin/screenbrightnessdisplaymodel.h     [License: GPL(v2.0+)]
M  +13   -4    autotests/applets/brightnesstest.py

https://invent.kde.org/plasma/powerdevil/-/commit/88aa87f7e6c291de02e6a585a04ccb0ebfcfd006
Comment 8 Jakob Petsovits 2024-08-25 21:21:03 UTC
Closing as fixed: in addition to per-monitor brightness controls, Plasma 6.2 on Wayland also includes KWin software brightness (similar to xrandr gamma) for displays that don't support hardware brightness. Those are the two required ingredients for this feature. It did take almost 8 years to implement this, better late than never.

I don't think this feature will make it into X11 sessions, but there's always a chance that some other dedicated developer cares a lot about X11 support and submits a mergeable change.
Comment 9 Michael Ziegler 2024-09-23 18:17:38 UTC
Thanks for all the work :) I'm actually still interested in this and can't wait to try it out :D Much appreciated.