Skip to content

panel: Backlight control widget#327

Draft
AKArien wants to merge 1 commit intoWayfireWM:masterfrom
AKArien:backlight
Draft

panel: Backlight control widget#327
AKArien wants to merge 1 commit intoWayfireWM:masterfrom
AKArien:backlight

Conversation

@AKArien
Copy link
Contributor

@AKArien AKArien commented Jan 21, 2026

Add backlight widget to control display brightness.
Handles devices exposed in sysfs and external external monitors that implement MCCS.
MCCS depends on libddcutil, and is not built if it is not detected.

@AKArien AKArien marked this pull request as draft January 21, 2026 17:30
@AKArien AKArien mentioned this pull request Jan 22, 2026
@AKArien AKArien force-pushed the backlight branch 2 times, most recently from 0bc1aa9 to 3671414 Compare January 31, 2026 17:34
@trigg trigg changed the title Backlight control widget panel: Backlight control widget Jan 31, 2026
@AKArien AKArien force-pushed the backlight branch 3 times, most recently from 1447a40 to 5bbaafa Compare March 4, 2026 17:41
@trigg
Copy link
Collaborator

trigg commented Mar 4, 2026

So I start with this message
Cannot read/write brightness for "/sys/class/backlight/amdgpu_bl1", ignoring.

And then find I can cause a segfault by scrolling on the widget ;)

@AKArien
Copy link
Contributor Author

AKArien commented Mar 5, 2026

@trigg latest commits fix this segfault and add a fallback to use the systemd-logind dbus method as a fallback

@AKArien AKArien force-pushed the backlight branch 2 times, most recently from 1ef5069 to f11f94b Compare March 6, 2026 23:47
@trigg
Copy link
Collaborator

trigg commented Mar 6, 2026

diff --git a/src/panel/widgets/backlight/sysfs.cpp b/src/panel/widgets/backlight/sysfs.cpp
index 2db42c2..5dcddac 100644
--- a/src/panel/widgets/backlight/sysfs.cpp
+++ b/src/panel/widgets/backlight/sysfs.cpp
@@ -133,6 +133,7 @@ class WfLightSysfsDbusSystemdControl : public WfLightSysfsControl
 
     void set_brightness(double brightness) override
     {
+        brightness = std::clamp(brightness, 0.0, 1.0);
         auto params = Glib::VariantContainerBase::create_tuple({
             Glib::Variant<Glib::ustring>::create("backlight"),
             Glib::Variant<Glib::ustring>::create(name),

A fix for the out-of-range GDBUS errors

@AKArien
Copy link
Contributor Author

AKArien commented Mar 7, 2026

don’t take it as rebelling against authority, but i just changed the scrolling itself ;)

i’m actually quite confused as to why it wasn’t doing errors with others, but… oh well, now should be safe.

@soreau
Copy link
Member

soreau commented Mar 7, 2026

Why are there changes to 18 files here? I see changes to all of the wp-mixer files and some addition of icons.cpp in until with a header, amongst other changes not related to the title of this PR.

@AKArien
Copy link
Contributor Author

AKArien commented Mar 7, 2026

Why are there changes to 18 files here? I see changes to all of the wp-mixer files and some addition of icons.cpp in until with a header, amongst other changes not related to the title of this PR.

Because to not copypaste code, the way icons that scale with a numeric value (so, volumes and brightness) is handled was changed. for now this new way was carelessly thrown together to get working, please read them and make suggestions.

@trigg
Copy link
Collaborator

trigg commented Mar 7, 2026

@soreau makes a good point here.

Can you split the icon-from-ranges work to a different PR which we will take first?

@AKArien
Copy link
Contributor Author

AKArien commented Mar 7, 2026

Can you split the icon-from-ranges work to a different PR which we will take first?

sure, seemed a bit pointless to me given there’s no other thing using it, but if you want

AKArien added a commit to AKArien/wf-shell that referenced this pull request Mar 8, 2026
AKArien added a commit to AKArien/wf-shell that referenced this pull request Mar 8, 2026
AKArien added a commit to AKArien/wf-shell that referenced this pull request Mar 8, 2026
@AKArien AKArien force-pushed the backlight branch 2 times, most recently from 5e8544d to 9f363a6 Compare March 25, 2026 18:14
Add backlight widget to control display brightness.
Handles sysfs devices and external external monitors that implement MCCS.
MCCS depends on libddcutil, and is not built if it is not detected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants