repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

Remove udev uaccess rule, promote polkit option B as recommended fix

7c5af020ee6b908482aadf9f5391c2eb759946ed

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (2)

ironbar/PLAN.md

Modified
390 390 Known issue (scroll does not change brightness):
392 392 - `ironbar.service` runs under the user manager, so the process is in a sessionless scope. Ironbar's `systemd` brightness backend calls `org.freedesktop.login1` `SetBrightness`, which is rejected with `org.freedesktop.login1.NotYourDevice: Session is not in foreground, refusing.`
393 +- Root cause is session ownership, not config. The Ironbar config is already correct (`mode.type = systemd`, `smooth_scroll_speed = 0.5`); changing it cannot fix this. The fix is host-side, requires root, and the agent cannot apply it.
394 -Note (Option A may not be enough on multi-seat/greeter installs):
395 +Note on `udev` `uaccess`:
396 -- On this host the seat's `ActiveSession=4` is the greeter (Type=wayland, Class=greeter) and the user session 5 is `Idle=yes`. udev `uaccess` flips the device to whichever session holds the seat, not the user session ironbar runs in. After applying Option A, `SetBrightness` still returned `NotYourDevice`. Use Option B for this seat layout, or also configure the seat to bind the user session as active.
397 -- Root cause is session ownership, not config: the seat's `ActiveSession` is the greeter and the user session shows `Idle=yes`, so logind does not grant the unit foreground status.
398 -- The Ironbar config is already correct (`mode.type = systemd`, `smooth_scroll_speed = 0.5`); changing it cannot fix this. The fix is host-side, requires root, and the agent cannot apply it. One of the following must be run by the user:
397 +- Rejected for this host: the seat's `ActiveSession` is the greeter (Type=wayland, Class=greeter) and the user session is `Idle=yes`. udev `uaccess` hands the device to the session that owns the seat, not the user session ironbar runs in. Live test: after installing `ACTION=="add", SUBSYSTEM=="backlight", TAG+="uaccess"`, `SetBrightness` still returned `NotYourDevice`. Rule was removed. Skip on this seat layout, or also reconfigure seat ownership.
399 +Recommended fix (Option B): polkit rule for `login1.set-brightness`.
401 - # Option A: udev uaccess for the backlight device (recommended, no root service needed)
402 - sudo tee /etc/udev/rules.d/90-backlight-uaccess.rules <<'EOF'
403 - ACTION=="add", SUBSYSTEM=="backlight", TAG+="uaccess"
404 - EOF
405 - sudo udevadm control --reload && sudo udevadm trigger
402 + doas install -m 0644 /home/oli/Workspace/dotfiles/polkit/10-brightness.rules /etc/polkit-1/rules.d/10-brightness.rules
403 + systemctl --user restart ironbar.service
409 - # Option B: polkit rule for login1 SetBrightness
410 - sudo tee /etc/polkit-1/rules.d/10-brightness.rules <<'EOF'
407 + # /etc/polkit-1/rules.d/10-brightness.rules
411 408 polkit.addRule(function(action, subject) {
412 409 if (action.id == "org.freedesktop.login1.set-brightness" &&
413 410 subject.local && subject.active) {
414 411 return polkit.Result.YES;
417 - EOF
416 +Alternative Option C: write access via group `video` (last resort; not staged, because `chmod` does not survive sysfs re-creation and `usermod -aG video` requires a re-login):
421 - # Option C: uaccess group on the backlight files + add user to video group
422 - sudo chgrp video /sys/class/backlight/intel_backlight/brightness
423 - sudo chmod 664 /sys/class/backlight/intel_backlight/brightness
424 - sudo usermod -aG video oli
419 + doas chgrp video /sys/class/backlight/intel_backlight/brightness
420 + doas chmod 664 /sys/class/backlight/intel_backlight/brightness
421 + doas usermod -aG video oli
427 -- The agent does not run `sudo` and does not edit `/etc`. The user must pick one option and run it. After that, restart `ironbar.service` and physical scroll on the brightness module will change `intel_backlight`/brightness without a logind `NotYourDevice` error.
429 424 ### Step 9 — bindmode
431 426 Difficulty: easy-medium.

udev/90-backlight-uaccess.rules

Deleted
deleted file mode 100644
1 -ACTION=="add", SUBSYSTEM=="backlight", TAG+="uaccess"