Skip to content

feat(hardware): sync ThinkBook mute LEDs with WirePlumber state#5431

Open
Dev-solder124 wants to merge 1 commit intobasecamp:devfrom
Dev-solder124:feat/thinkbook-led-sync
Open

feat(hardware): sync ThinkBook mute LEDs with WirePlumber state#5431
Dev-solder124 wants to merge 1 commit intobasecamp:devfrom
Dev-solder124:feat/thinkbook-led-sync

Conversation

@Dev-solder124
Copy link
Copy Markdown

@Dev-solder124 Dev-solder124 commented Apr 24, 2026

Description

This PR bridges the gap between WirePlumber's software audio state and the physical hardware LEDs (platform::mute and platform::micmute) on Lenovo ThinkBook laptops, ensuring that pressing the hardware mute keys accurately toggles the built-in LED indicators.

Previously, ThinkBook users fell through to the generic mute path, resulting in no LED feedback, and the generic swayosd implementation had some limitations regarding accurate visual feedback on mute states.

What's Changed

  • ThinkBook Hardware LED Support:
    • Added a udev rule (99-lenovo-thinkbook-leds.rules) to grant users in the video group write permissions (0664) to the /sys/class/leds/platform::mute and platform::micmute brightness nodes.
    • Added omarchy-hw-thinkbook hardware detection script (matching via DMI product_family).
    • Created omarchy-cmd-mic-mute-thinkbook to intercept mic mute events and accurately sync the platform::micmute LED.
    • Wrapped the global speaker mute (XF86AudioMute) via omarchy-cmd-mute to sync the platform::mute LED for ThinkBooks (acts as a safe no-op on other hardware).
  • SwayOSD Mic Level Bar Fix (ThinkBook & ThinkPad):
    • Fixed an issue where the native swayosd mic-level progress bar was lost during toggling.
    • Migrated the ThinkPad and ThinkBook mic mute scripts to use wpctl for reliable, synchronous muting, while triggering omarchy-swayosd-client --input-volume +0. This preserves the native OSD mic-level bar while accurately updating the LED and audio state.
  • Migration Script: Added a migration script (1777020424.sh) so existing ThinkBook users receive the necessary udev rules without needing a clean install.

Motivation and Context

Without this change, ThinkBook users receive no physical LED feedback when muting their microphone or speakers. Additionally, it resolves a visual regression in the OSD where custom icons were replacing the native SwayOSD volume progress bars for microphone muting on ThinkPads.

Verification

  • Verified udev rule correctly applies 0664 permissions and video group ownership to platform::mute and platform::micmute.
  • Verified omarchy-hw-match "ThinkBook" correctly identifies hardware.
  • Tested mic mute (Fn+F1) successfully toggles WirePlumber state, syncs the LED, and triggers the SwayOSD native level bar.
  • Tested speaker mute (Fn+F4) successfully toggles WirePlumber state, syncs the LED, and triggers the SwayOSD popup.
  • Verified existing ThinkPad logic remains intact while gaining the SwayOSD native level bar fix.

Copilot AI review requested due to automatic review settings April 24, 2026 14:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds Lenovo ThinkBook-specific glue to keep the platform::mute / platform::micmute hardware LEDs in sync with the current WirePlumber mute state, while also adjusting mic-mute handling to preserve SwayOSD’s native input-level bar (notably for ThinkPad/ThinkBook).

Changes:

  • Install + migrate a ThinkBook udev rule to allow user-level writes to the platform mute LED brightness sysfs nodes.
  • Add ThinkBook-specific mic-mute handler and wrap global speaker mute to additionally update the ThinkBook LED.
  • Update ThinkPad mic-mute handling to use wpctl + trigger SwayOSD native OSD via --input-volume +0.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 4 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
migrations/1777020424.sh Migration to install ThinkBook LED udev rule and reload/trigger udev.
install/config/hardware/lenovo/fix-thinkbook-led-permissions.sh Installer-time setup of ThinkBook LED udev rule.
install/config/all.sh Ensures the ThinkBook LED permission fix runs during install config.
default/hypr/bindings/media.conf Routes speaker mute keybinding through the new wrapper command.
bin/omarchy-hw-thinkbook Adds a ThinkBook hardware detection helper.
bin/omarchy-cmd-mute Wraps speaker mute toggle and syncs ThinkBook platform::mute LED.
bin/omarchy-cmd-mic-mute-thinkpad Uses wpctl toggle + native SwayOSD bar trigger; syncs ThinkPad mic LED.
bin/omarchy-cmd-mic-mute-thinkbook New ThinkBook mic mute toggle + LED sync + native SwayOSD bar trigger.
bin/omarchy-cmd-mic-mute Routes mic-mute handling to ThinkBook-specific implementation when detected.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread migrations/1777020424.sh
Comment thread migrations/1777020424.sh Outdated
Comment thread install/config/hardware/lenovo/fix-thinkbook-led-permissions.sh
Comment thread install/config/hardware/lenovo/fix-thinkbook-led-permissions.sh Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 9 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread install/config/hardware/lenovo/fix-thinkbook-led-permissions.sh Outdated
- Added udev rule to allow user control over ThinkBook `platform::mute` and `platform::micmute` LEDs
- Added `omarchy-hw-thinkbook` hardware detection script
- Hooked mic mute dispatch to new `omarchy-cmd-mic-mute-thinkbook`
- Wrapped speaker mute with `omarchy-cmd-mute` to sync platform::mute LED
- Fixed swayosd OSD on ThinkPad and ThinkBook scripts to preserve native mic-level progress bar using `--input-volume +0` while relying on `wpctl` for the toggle
- Added migration script to deploy udev rule to existing installations
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 9 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread migrations/1777020424.sh
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.

2 participants