Skip to content

Fix keyboard backlight, USB-C power switching, and waybar timezone#5417

Closed
kuro-toji wants to merge 2 commits intobasecamp:devfrom
kuro-toji:fix/keyboard-backlight-usbc-timezone
Closed

Fix keyboard backlight, USB-C power switching, and waybar timezone#5417
kuro-toji wants to merge 2 commits intobasecamp:devfrom
kuro-toji:fix/keyboard-backlight-usbc-timezone

Conversation

@kuro-toji
Copy link
Copy Markdown

Summary

This PR fixes 3 additional bugs reported by users:

1. Keyboard backlight brightness steps inconsistent (#5414)

Problem: Brightness increases in steps of 9/10, but decreases in steps of 10/11, making it impossible to set low values.

Solution: Changed to percentage-based stepping (0%, 10%, 20%, ..., 100%) for consistent behavior in both directions.

2. Auto power profile switching broken on USB-C machines (#5412)

Problem: USB-C only machines (ThinkPads, etc.) don't fire udev events on the AC device, only on ucsi-source-psy-* devices.

Solution: Added udev rules for USB power supplies (POWER_SUPPLY_TYPE=USB) alongside existing Mains rules. Also ensures power-profiles-daemon is enabled.

3. Waybar clock displays UTC instead of local time (#5380)

Problem: Clock module defaults to UTC even when system timezone is set correctly.

Solution: Added timezone parameter to waybar clock config. Empty string uses system local time.

Files Changed

  • bin/omarchy-brightness-keyboard - Percentage-based brightness stepping
  • install/config/powerprofilesctl-rules.sh - USB-C power supply support
  • install/config/waybar-timezone-fix.sh - New installer for timezone fix
  • migrations/1777007400.sh - USB-C power profile fix migration
  • migrations/1777007401.sh - Waybar timezone fix migration
  • migrations/1777007402.sh - Keyboard backlight fix migration

Testing

  1. Keyboard backlight: Press brightness up/down keys - should see consistent percentage values
  2. USB-C power: Unplug/replug charger on USB-C only laptop - profile should switch
  3. Waybar clock: Verify clock shows local time, not UTC

…ability

This commit addresses 4 bugs reported by users:

1. Power profile GUI not switching when clicked (#power-profile)
   - Fix omarchy-launch-walker to properly pass through --width,
     --maxheight, --minheight arguments to walker
   - Prevents walker defaults from overriding menu-specific arguments
   - Users can now properly select power profiles from the GUI menu

2. Screen sharing notification bar 'Hide' button not responding
   - Add window rules for Chromium/Chrome WebRTC indicator windows
   - Ensure notification popups receive input events properly
   - Fixes: basecamp#5373

3. Screenshot regression with hyprpicker on HDR displays
   - Add wayfreeze fallback for HDR displays
   - wayfreeze provides proper color handling for HDR screenshots
   - Add migration to reinstall wayfreeze for HDR users
   - Fixes: basecamp#5376

4. NVIDIA GPU system lockups on media-heavy sites
   - Add NVIDIA-specific environment variables for Wayland stability
   - Add chromium flags installer for NVIDIA GPU optimization
   - Helps prevent DMA allocation errors and system lockups
   - Fixes: basecamp#5372
Copilot AI review requested due to automatic review settings April 24, 2026 05:46
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

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.

This PR updates Omarchy’s migration and install-time configuration to address reported user issues around keyboard backlight stepping, power profile switching on USB‑C–only laptops, and Waybar clock timezone handling (and also includes several additional, unrelated UX/system tweaks via migrations and default configs).

Changes:

  • Update keyboard backlight stepping logic to use percent-based levels.
  • Extend power-supply udev rules to react to USB-C power events (in addition to Mains).
  • Add Waybar clock timezone insertion scripts/migrations (plus additional migrations for screenshot/NVIDIA/screen-sharing, and a walker launcher change).

Reviewed changes

Copilot reviewed 11 out of 14 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
bin/omarchy-brightness-keyboard Changes keyboard backlight stepping algorithm and cycle behavior.
bin/omarchy-cmd-screenshot Adds wayfreeze-based screenshot path and helper logic.
bin/omarchy-launch-walker Adjusts walker launch arguments and defaults.
default/hypr/apps.conf Sources the new screen-sharing app rules.
default/hypr/apps/screen-sharing.conf Adds Hyprland rules intended to fix screen-sharing UI interaction.
install/config/nvidia-chromium-flags.sh Adds a new NVIDIA/Chromium flags helper script.
install/config/powerprofilesctl-rules.sh Installs udev rules for power profile switching (now including USB-C).
install/config/waybar-timezone-fix.sh Installer-time Waybar timezone insertion using timedatectl.
migrations/1777007316.sh Migration to add screen-sharing Hyprland rules for existing users.
migrations/1777007317.sh Migration adding NVIDIA environment tweaks.
migrations/1777007318.sh Migration offering wayfreeze install for HDR screenshot compatibility.
migrations/1777007400.sh Migration updating power profile udev rules and enabling PPD.
migrations/1777007401.sh Migration attempting to inject Waybar clock timezone.
migrations/1777007402.sh Migration that overwrites the keyboard brightness script with the new logic.

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

Comment thread migrations/1777007316.sh
Comment on lines +17 to +19
windowrule = float, class:^(chrome|chromium|brave|microsoft-edge),title:.*(screen sharing|Sharing|is sharing|Stop sharing|Hide)
windowrule = noborder, class:^(chrome|chromium|brave|microsoft-edge),title:.*(screen sharing|Sharing|is sharing|Stop sharing|Hide)
windowrule = noblur, class:^(chrome|chromium|brave|microsoft-edge),title:.*(screen sharing|Sharing|is sharing|Stop sharing|Hide)
Comment thread migrations/1777007400.sh
Comment on lines +23 to +24
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_TYPE}=="USB", ATTR{online}=="0", RUN+="/usr/bin/systemd-run --no-block --collect --unit=omarchy-power-profile-battery --property=After=power-profiles-daemon.service $HOME/.local/share/omarchy/bin/omarchy-powerprofiles-set battery"
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_TYPE}=="USB", ATTR{online}=="1", RUN+="/usr/bin/systemd-run --no-block --collect --unit=omarchy-power-profile-ac --property=After=power-profiles-daemon.service $HOME/.local/share/omarchy/bin/omarchy-powerprofiles-set ac"
Comment thread migrations/1777007402.sh
Comment on lines +62 to +69
# Cycle through brightness levels: 0 -> 50% -> 100% -> 0
if [[ $current_brightness -eq 0 ]]; then
new_brightness=$((max_brightness / 2))
elif [[ $current_brightness -eq $((max_brightness / 2)) ]]; then
new_brightness=$max_brightness
else
new_brightness=0
fi
Copy link
Copy Markdown

@sockbot sockbot Apr 24, 2026

Choose a reason for hiding this comment

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

This change doesn't address setting the brightness to the minimum value of 1 as one of the settings. Also, although the setting of 50% is mathematically at the midpoint between 0 and 100, the keyboard light doesn't scale linearly. On my hardware, a setting of 25% is close to "mid" brightness.

I've addressed both of these issues in an alternative PR #5424, as well as changed the OSD indicators to OFF LOW MED HIGH.

Could we consider splitting the 3 issues resolved by this PR into 3 separate PRs?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actually, since I have already created a PR that specifically addresses the keyboard backlight issue, could you remove that fix from the scope of this PR so that this PR is more targeted?

Comment on lines +6 to +16
windowrule = opacity 1.0 1.0, class:^(chrome-shill-webui|chrome-webui-media-router|chrome-extension),title:.*(screen|sharing|tab|cast).*
windowrule = nofocus, class:^(chrome-shill-webui|chrome-webui-media-router),title:.*indicator.*

# Ensure notification popups from browsers receive input
windowrule = float, class:^(chrome|chromium|brave|microsoft-edge),title:.*(screen sharing|Sharing|is sharing|Stop sharing|Hide)
windowrule = noborder, class:^(chrome|chromium|brave|microsoft-edge),title:.*(screen sharing|Sharing|is sharing|Stop sharing|Hide)
windowrule = noblur, class:^(chrome|chromium|brave|microsoft-edge),title:.*(screen sharing|Sharing|is sharing|Stop sharing|Hide)

# Force the WebRTC indicator to be focusable and receive mouse events
layerrule = ignore_zero_containers on, class:^(chrome-shill-webui|chrome-webui-media-router)$
layerrule = no_anim on, class:^(chrome-shill-webui|chrome-webui-media-router)$
Comment on lines +6 to +24
CHROMIUM_FLAGS_DIR="$HOME/.config/chromium-flags"
mkdir -p "$CHROMIUM_FLAGS_DIR"

# Create a helper script that sets NVIDIA-optimized flags
cat > "$HOME/.config/chromium-flags/set-flags" << 'EOF'
#!/bin/bash
# NVIDIA-optimized Chromium flags for Wayland
# Prevents system lockups on media-heavy sites

# Use X11 backend instead of Wayland for Chromium on NVIDIA
# Wayland + NVIDIA + Chromium can cause lockups
export CHROMIUM_FLAGS="--ozone-platform=x11 --enable-features=VaapiVideoDecoder,VaapiVideoEncoder --disable-features=Vulkan, VulkanFromANGLE, DefaultANGLEVulkan"

# Apply to Electron apps too
export ELECTRON_OZONE_PLATFORM_HINT=x11
EOF

chmod +x "$HOME/.config/chromium-flags/set-flags"

Comment on lines +22 to +23
SUBSYSTEM=="power_supply", ATTR{type}=="USB", ATTR{online}=="0", RUN+="/usr/bin/systemd-run --no-block --collect --unit=omarchy-power-profile-battery --property=After=power-profiles-daemon.service $HOME/.local/share/omarchy/bin/omarchy-powerprofiles-set battery"
SUBSYSTEM=="power_supply", ATTR{type}=="USB", ATTR{online}=="1", RUN+="/usr/bin/systemd-run --no-block --collect --unit=omarchy-power-profile-ac --property=After=power-profiles-daemon.service $HOME/.local/share/omarchy/bin/omarchy-powerprofiles-set ac"
Comment on lines +6 to +10
echo "Installing power profile udev rules..."

# Create udev rules for power profile switching
# Supports both Mains (traditional) and USB-C power supplies
cat << 'EOF' | sudo tee "/etc/udev/rules.d/99-power-profile.rules" > /dev/null
Comment thread migrations/1777007400.sh
Comment on lines +16 to +28
# Update the udev rules for power profile switching
cat << 'EOF' | sudo tee "/etc/udev/rules.d/99-power-profile.rules" > /dev/null
# Power profile switching for traditional AC (Mains) power supplies
SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="0", RUN+="/usr/bin/systemd-run --no-block --collect --unit=omarchy-power-profile-battery --property=After=power-profiles-daemon.service $HOME/.local/share/omarchy/bin/omarchy-powerprofiles-set battery"
SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="1", RUN+="/usr/bin/systemd-run --no-block --collect --unit=omarchy-power-profile-ac --property=After=power-profiles-daemon.service $HOME/.local/share/omarchy/bin/omarchy-powerprofiles-set ac"

# Power profile switching for USB-C Power Delivery
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_TYPE}=="USB", ATTR{online}=="0", RUN+="/usr/bin/systemd-run --no-block --collect --unit=omarchy-power-profile-battery --property=After=power-profiles-daemon.service $HOME/.local/share/omarchy/bin/omarchy-powerprofiles-set battery"
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_TYPE}=="USB", ATTR{online}=="1", RUN+="/usr/bin/systemd-run --no-block --collect --unit=omarchy-power-profile-ac --property=After=power-profiles-daemon.service $HOME/.local/share/omarchy/bin/omarchy-powerprofiles-set ac"

# Additional support for USB-C Power Source devices
SUBSYSTEM=="power_supply", ATTR{type}=="USB", ATTR{online}=="0", RUN+="/usr/bin/systemd-run --no-block --collect --unit=omarchy-power-profile-battery --property=After=power-profiles-daemon.service $HOME/.local/share/omarchy/bin/omarchy-powerprofiles-set battery"
SUBSYSTEM=="power_supply", ATTR{type}=="USB", ATTR{online}=="1", RUN+="/usr/bin/systemd-run --no-block --collect --unit=omarchy-power-profile-ac --property=After=power-profiles-daemon.service $HOME/.local/share/omarchy/bin/omarchy-powerprofiles-set ac"
Comment thread migrations/1777007401.sh Outdated
Comment on lines +28 to +31
awk '
/"clock":/ { found_clock=1 }
found_clock && /"format":/ && !timezone_added {
print " \"timezone\": \"" ($SYSTEM_TZ != "" ? $SYSTEM_TZ : "") "\","
Comment on lines +19 to +22
# Use sed to add timezone to clock config
# Add timezone after the format line in the clock section
sed -i "/\"clock\":/{
n;s/\"format\"/\"timezone\": \"$SYSTEM_TZ\",\n \"format\"/
This commit addresses 3 additional bugs reported by users:

1. Keyboard backlight brightness steps inconsistent (basecamp#5414)
   - Fix brightness stepping to use percentage-based values
   - Brightness now consistently goes: 0%, 10%, 20%, ..., 100%
   - Works the same when going up or down

2. Auto power profile switching broken on USB-C machines (basecamp#5412)
   - Add udev rules for USB-C power supplies (POWER_SUPPLY_TYPE=USB)
   - Supports ThinkPads and other USB-C only laptops
   - Ensures power-profiles-daemon is enabled

3. Waybar clock displays UTC instead of local time (basecamp#5380)
   - Add timezone parameter to waybar clock config
   - Clock now uses system local timezone correctly
   - Add migration to fix existing configs
@kuro-toji
Copy link
Copy Markdown
Author

This PR is superseded by #5422 which combines all fixes with proper Copilot review feedback addressed. Please review that PR instead.

@kuro-toji kuro-toji closed this Apr 26, 2026
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.

3 participants