Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 937028 - x11-misc/polybar: backlight module is broken by default
Summary: x11-misc/polybar: backlight module is broken by default
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: John Helmert III
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-08-01 00:07 UTC by Emanuele Torre
Modified: 2024-08-31 06:51 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
test.ini (test.ini,104 bytes, text/plain)
2024-08-04 09:47 UTC, Emanuele Torre
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Emanuele Torre 2024-08-01 00:07:30 UTC
The backlight module requires /sys/class/backlight/*/brightness files
to be owned and read/writable by the video group.

That will only be the case if the sys-power/acpilight package (or
alternatively the dev-libs/light while it still worked) is installed and
installs the 90-backlight.rules udev rule.

So polybar should either also package the 90-backlight.rules udev rule
or depend on sys-power/acpilight, which is a bit unfortunate since that
will mean having to install the xbacklight utility from that package,
and cause a conflict with x11-apps/xbacklight. But without also
installing that package (and rebooting), polybar's backlight module will
currently not work.

The more ideal solution in my opinion would be to package a udev rule
that makes /sys/class/backlight/*/brightness 0664 root:video as a
separate package, and make dev-libs/light, sys-power/acpilight, and
x11-misc/polybar all depend from it.
That way dev-libs/light+sys-power/acpilight, and
x11-misc/polybar+x11-apps/xbacklight don't have to conflict with each
other, and the backlight module can work without having to install
sys-power/acpilight's xbacklight utility for no reason.

o/
 emanuele6
Comment 1 Emanuele Torre 2024-08-04 09:47:20 UTC
Created attachment 898970 [details]
test.ini
Comment 2 Emanuele Torre 2024-08-04 09:53:31 UTC
Sorry, I've just noticed I didn't post reproduce steps:

1. create a test.ini file with the following content (attachment)

    [bar/test]
    modules-center = backlight
    [module/backlight]
    type = internal/backlight
    enable-scroll = true

2. run that test bar with    polybar -c ./test.ini test

3. try to change the brightness of the screen using the scroll whell on
   the brightness percentage.

If sys-power/acpilight is not installed (before the system is turned
on), /usr/lib/udev/rules.d/90-backlight.rules will not be present and
the backlight file used by polybar to set the brightness will only be
readable and not writable by your larry:video user, so the backlight
module will only be able to read the current brightness value, but not
change it.

o/
 emanuele6
Comment 3 John Helmert III archtester Gentoo Infrastructure gentoo-dev Security 2024-08-18 20:52:57 UTC
Thanks for the investigation!

I'm not sure that this really warrants a separate package, but I also agree that we don't want a new dependency on a package providing this rule given the side effect (and because not everyone uses brightness from polybar).

What about a "brightness" optfeature that indicates acpilight as enabling unprivileged brightness changes from the video group?
Comment 4 Emanuele Torre 2024-08-19 12:30:59 UTC
It is not clear why a separate package is not good idea since there are
multiple packages that want that file, and light and acpilight are
conflicting just because they both install that same file.

An optfeature does not fix forcing the user to uninstall xbacklight to
get this rule, but at least the user will now know they will need to
install acpilight to make the backlight module work, so that is better
than the current version where the user has to figure it out.

o/
 emanuele6
Comment 5 Larry the Git Cow gentoo-dev 2024-08-31 06:47:56 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2a33cda7f3b228048597d721970d163da5e7dbfa

commit 2a33cda7f3b228048597d721970d163da5e7dbfa
Author:     John Helmert III <ajak@gentoo.org>
AuthorDate: 2024-08-31 06:23:11 +0000
Commit:     John Helmert III <ajak@gentoo.org>
CommitDate: 2024-08-31 06:47:29 +0000

    x11-misc/polybar: optfeature for backlight udev rule
    
    Closes: https://bugs.gentoo.org/937028
    Signed-off-by: John Helmert III <ajak@gentoo.org>

 x11-misc/polybar/polybar-3.7.1-r1.ebuild | 6 +++++-
 x11-misc/polybar/polybar-3.7.2.ebuild    | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)