feat: hotkey-only brightness OSD + battery AC plug/unplug indicator#194
Open
jibsta210 wants to merge 1 commit into
Open
feat: hotkey-only brightness OSD + battery AC plug/unplug indicator#194jibsta210 wants to merge 1 commit into
jibsta210 wants to merge 1 commit into
Conversation
5 tasks
b5dd1fb to
e5e7156
Compare
… indicator Three additions to the OSD daemon, batched on a single branch I daily-drive: * **Hotkey-only brightness OSD.** Subscribes to the new `DisplayBrightnessHotkey` D-Bus signal from cosmic-settings-daemon (companion daemon patch) so the brightness slider only appears on hotkey-driven changes — not on every property write. Fixes the dim-on-idle fade flashing the OSD on every frame. The listener also fetches `MaxDisplayBrightness` on connect and pairs it with each signal, so the OSD doesn't depend on a separately-arriving property subscription having populated `max` first (without that, the OSD silently no-ops if the hotkey signal arrives before the property subscription does). * **Device-aware volume OSD icon.** Picks `audio-headphones-symbolic` instead of the generic speaker family when the default sink is Bluetooth (`bluez_output.*` / `bluez_sink.*`) or wired headphones (alsa node name containing `headphone`). Previous behaviour showed a speaker silhouette regardless of where audio was actually going. Mute always shows `audio-volume-muted-symbolic` for clarity. Sink classification uses the default-sink name from the existing pulse subscription — no additional D-Bus / pulse calls. * **Battery AC plug/unplug indicator.** Status pill on AC connect/disconnect showing battery percentage and charge state. Uses UPower; new `BatteryStatus` subscription + `Params::BatteryStatus(percentage, on_battery, charging)` variant in `osd_indicator` mapping to the appropriate `battery-*-symbolic` icon. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
e5e7156 to
a2321da
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related additions to the OSD daemon:
DisplayBrightnessHotkeyD-Bus signal fromcosmic-settings-daemon(feat: Action::Snap variant + DisplayBrightnessHotkey signal cosmic-settings-daemon#144) so the brightness slider only appears when the user actually pressed a brightness key. The default property-change subscription fires on every backlight write, including programmatic ones (dim-on-idle, accessibility tooling, screen savers), which currently makes the OSD pop up every time the screen is about to sleep. This PR keeps the existing property subscription, but adds the hotkey signal as the canonical user-facing trigger so the OSD can suppress noisy programmatic writes cleanly when paired with that daemon change.BatteryStatussubscription on the app side, newParams::BatteryStatus(percentage, charging, plugged)variant inosd_indicatorthat maps to the appropriatebattery-*-symbolicicon and renders the percentage value.Motivation
cosmic-idledim-on-idle PR (pop-os/cosmic-idle), the brightness OSD currently flashes once per fade frame as the backlight is being lowered. There's no clean way today for the OSD to tell who wrote the value. A separate signal for the user-facing path solves this without changing existing behaviour for clients that don't subscribe to it.Implementation
src/components/app.rs:Msg::HotkeyBrightness(u32)and ahotkey_brightness_subscriptionthat listens for the new daemon signal.Msg::BatteryStatus { percentage, charging, plugged }and abattery_status_subscriptionthat watches UPower'sorg.freedesktop.UPower.Deviceproperties forstate/percentagechanges on the primary display device.src/components/osd_indicator.rs:Params::BatteryStatus(percentage, charging, plugged)variant.battery-{level}{-charging}-symbolicbased on percentage bucket and charging flag, falling back to the symbolic family already used for volume/brightness.Testing
Daily-driven for several weeks. Hotkey signal verified by tapping the brightness keys vs. running a backlight fader programmatically — only the former pops the OSD. Battery indicator verified by plugging/unplugging the charger.
Dependencies
The hotkey path requires pop-os/cosmic-settings-daemon#144. The battery indicator is independent — happy to split that into a separate PR if maintainers prefer to review them apart.
AI Disclosure
Patches were drafted with assistance from Claude (Anthropic). Commits include
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>trailers. I understand each change and will respond to review feedback. I'm aware of the AI-PR policy in the template — happy to rework or close if maintainers prefer.