Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions bin/omarchy-cmd-mic-mute
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ if omarchy-hw-match "XPS"; then
omarchy-cmd-mic-mute-xps
elif omarchy-hw-match "ThinkPad"; then
omarchy-cmd-mic-mute-thinkpad
elif omarchy-hw-match "ThinkBook"; then
omarchy-cmd-mic-mute-thinkbook
else
omarchy-swayosd-client --input-volume mute-toggle
fi
20 changes: 20 additions & 0 deletions bin/omarchy-cmd-mic-mute-thinkbook
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# Toggle microphone mute on ThinkBook systems. Uses wpctl for reliable toggling
# (swayosd-server on some systems does not propagate input-volume mute-toggle
# to WirePlumber). Syncs the platform::micmute LED, then fires swayosd's native
# input-volume OSD via +0 so the mic-level progress bar is preserved.

wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle >/dev/null

if pactl get-source-mute @DEFAULT_SOURCE@ | grep -q 'yes'; then
led_value=1
else
led_value=0
fi

brightnessctl --device="platform::micmute" set "$led_value" >/dev/null 2>&1 || true

# +0 reads current input volume state and shows the native bar OSD without
# changing anything — swayosd displays muted/unmuted icon + level bar.
omarchy-swayosd-client --input-volume +0
15 changes: 6 additions & 9 deletions bin/omarchy-cmd-mic-mute-thinkpad
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
#!/bin/bash

# Toggle microphone mute on ThinkPad systems. Uses wpctl for reliable toggling
# and syncs the platform::micmute LED via brightnessctl.
# (swayosd-server on some systems does not propagate input-volume mute-toggle
# to WirePlumber). Syncs the platform::micmute LED, then fires swayosd's native
# input-volume OSD via +0 so the mic-level progress bar is preserved.

wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle >/dev/null

if pactl get-source-mute @DEFAULT_SOURCE@ | grep -q 'yes'; then
osd_message='Microphone muted'
osd_icon='microphone-sensitivity-muted-symbolic'
led_value=1
else
osd_message='Microphone on'
osd_icon='audio-input-microphone-symbolic'
led_value=0
fi

brightnessctl --device="platform::micmute" set "$led_value" >/dev/null 2>&1 || true

swayosd-client \
--monitor "$(omarchy-hyprland-monitor-focused)" \
--custom-message "$osd_message" \
--custom-icon "$osd_icon"
# +0 reads current input volume state and shows the native bar OSD without
# changing anything — swayosd displays muted/unmuted icon + level bar.
omarchy-swayosd-client --input-volume +0
15 changes: 15 additions & 0 deletions bin/omarchy-cmd-mute
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# Toggle speaker mute with OSD. On ThinkBook systems, also syncs the
# platform::mute hardware LED to match WirePlumber state.

omarchy-swayosd-client --output-volume mute-toggle

if omarchy-hw-match "ThinkBook"; then
if pactl get-sink-mute @DEFAULT_SINK@ | grep -q 'yes'; then
led_value=1
else
led_value=0
fi
brightnessctl --device="platform::mute" set "$led_value" >/dev/null 2>&1 || true
fi
6 changes: 6 additions & 0 deletions bin/omarchy-hw-thinkbook
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

# Detect Lenovo ThinkBook hardware via DMI product_family.
# Usage: omarchy-hw-thinkbook (returns exit 0 if ThinkBook, non-zero otherwise)

omarchy-hw-match "ThinkBook"
2 changes: 1 addition & 1 deletion default/hypr/bindings/media.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Laptop multimedia keys for volume and LCD brightness (with OSD)
bindeld = ,XF86AudioRaiseVolume, Volume up, exec, omarchy-swayosd-client --output-volume raise
bindeld = ,XF86AudioLowerVolume, Volume down, exec, omarchy-swayosd-client --output-volume lower
bindeld = ,XF86AudioMute, Mute, exec, omarchy-swayosd-client --output-volume mute-toggle
bindeld = ,XF86AudioMute, Mute, exec, omarchy-cmd-mute
bindeld = ,XF86AudioMicMute, Mute microphone, exec, omarchy-cmd-mic-mute
bindeld = ,XF86MonBrightnessUp, Brightness up, exec, omarchy-brightness-display +5%
bindeld = ,XF86MonBrightnessDown, Brightness down, exec, omarchy-brightness-display 5%-
Expand Down
1 change: 1 addition & 0 deletions install/config/all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ run_logged $OMARCHY_INSTALL/config/hardware/apple/fix-spi-keyboard.sh
run_logged $OMARCHY_INSTALL/config/hardware/apple/fix-suspend-nvme.sh
run_logged $OMARCHY_INSTALL/config/hardware/apple/fix-t2.sh

run_logged $OMARCHY_INSTALL/config/hardware/lenovo/fix-thinkbook-led-permissions.sh
run_logged $OMARCHY_INSTALL/config/hardware/fix-bcm43xx.sh
run_logged $OMARCHY_INSTALL/config/hardware/fix-surface-keyboard.sh
run_logged $OMARCHY_INSTALL/config/hardware/fix-yt6801-ethernet-adapter.sh
Expand Down
14 changes: 14 additions & 0 deletions install/config/hardware/lenovo/fix-thinkbook-led-permissions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Grant users in the video group write access to the ThinkBook platform mute LEDs.
# Without this, only root can update platform::mute and platform::micmute,
# so keybinding scripts cannot sync the hardware LED to WirePlumber state.

if omarchy-hw-match "ThinkBook"; then
sudo tee /etc/udev/rules.d/99-lenovo-thinkbook-leds.rules << 'EOF'
# Allow users in the video group to control ThinkBook platform mute LEDs
SUBSYSTEM=="leds", KERNEL=="platform::mute", ACTION=="add|change", RUN+="/usr/bin/chgrp video /sys%p/brightness", RUN+="/usr/bin/chmod 0664 /sys%p/brightness"
SUBSYSTEM=="leds", KERNEL=="platform::micmute", ACTION=="add|change", RUN+="/usr/bin/chgrp video /sys%p/brightness", RUN+="/usr/bin/chmod 0664 /sys%p/brightness"
EOF

sudo udevadm control --reload-rules
sudo udevadm trigger --subsystem-match=leds
Comment thread
Dev-solder124 marked this conversation as resolved.
fi
14 changes: 14 additions & 0 deletions migrations/1777020424.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
echo "Sync ThinkBook hardware mute LEDs with WirePlumber state"

# Install udev rule so users in the video group can write to the platform mute LED nodes.
# On ThinkBook laptops, the kernel exposes platform::mute and platform::micmute
# under /sys/class/leds/ with root-only write permissions by default.
if omarchy-hw-match "ThinkBook"; then
sudo tee /etc/udev/rules.d/99-lenovo-thinkbook-leds.rules > /dev/null << 'EOF'
# Allow users in the video group to control ThinkBook platform mute LEDs
SUBSYSTEM=="leds", KERNEL=="platform::mute", ACTION=="add|change", RUN+="/usr/bin/chgrp video /sys%p/brightness", RUN+="/usr/bin/chmod 0664 /sys%p/brightness"
SUBSYSTEM=="leds", KERNEL=="platform::micmute", ACTION=="add|change", RUN+="/usr/bin/chgrp video /sys%p/brightness", RUN+="/usr/bin/chmod 0664 /sys%p/brightness"
Comment thread
Dev-solder124 marked this conversation as resolved.
EOF
sudo udevadm control --reload-rules
sudo udevadm trigger --subsystem-match=leds
Comment thread
Dev-solder124 marked this conversation as resolved.
fi
Loading