macbook: add wob OSD for keyboard backlight keys
wob (Wayland OSD Bar) runs as a systemd user service listening on a FIFO. Keyboard brightness keybindings now pipe the new brightness percentage to the FIFO after each adjustment, showing a progress bar overlay. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
b4be9a9339
commit
43c251b90d
2 changed files with 33 additions and 3 deletions
|
|
@ -33,10 +33,30 @@
|
||||||
HandleLidSwitchExternalPower = "suspend";
|
HandleLidSwitchExternalPower = "suspend";
|
||||||
};
|
};
|
||||||
|
|
||||||
home-manager.users.fred = { ... }: {
|
home-manager.users.fred = { pkgs, ... }: {
|
||||||
wayland.windowManager.hyprland.settings.monitor =
|
wayland.windowManager.hyprland.settings.monitor =
|
||||||
[ ",preferred,auto,auto" ];
|
[ ",preferred,auto,auto" ];
|
||||||
|
|
||||||
|
# wob reads 0-100 integers from a FIFO and shows a progress bar overlay
|
||||||
|
systemd.user.services.wob = {
|
||||||
|
Unit = {
|
||||||
|
Description = "Wayland OSD Bar";
|
||||||
|
After = [ "graphical-session.target" ];
|
||||||
|
PartOf = [ "graphical-session.target" ];
|
||||||
|
};
|
||||||
|
Service = {
|
||||||
|
Type = "simple";
|
||||||
|
ExecStart = "${pkgs.writeShellScript "wob-start" ''
|
||||||
|
rm -f "%t/wob.fifo"
|
||||||
|
mkfifo "%t/wob.fifo"
|
||||||
|
tail -f "%t/wob.fifo" | ${pkgs.wob}/bin/wob
|
||||||
|
''}";
|
||||||
|
ExecStopPost = "${pkgs.coreutils}/bin/rm -f %t/wob.fifo";
|
||||||
|
Restart = "on-failure";
|
||||||
|
};
|
||||||
|
Install.WantedBy = [ "graphical-session.target" ];
|
||||||
|
};
|
||||||
|
|
||||||
systemd.user.services.kbd-backlight-init = {
|
systemd.user.services.kbd-backlight-init = {
|
||||||
Unit = {
|
Unit = {
|
||||||
Description = "Set keyboard backlight to 10% on login";
|
Description = "Set keyboard backlight to 10% on login";
|
||||||
|
|
|
||||||
|
|
@ -313,8 +313,18 @@ in
|
||||||
", XF86MonBrightnessUp, exec, swayosd-client --brightness raise"
|
", XF86MonBrightnessUp, exec, swayosd-client --brightness raise"
|
||||||
", XF86MonBrightnessDown, exec, swayosd-client --brightness lower"
|
", XF86MonBrightnessDown, exec, swayosd-client --brightness lower"
|
||||||
] ++ lib.optionals isMacbook [
|
] ++ lib.optionals isMacbook [
|
||||||
", XF86KbdBrightnessUp, exec, brightnessctl -d smc::kbd_backlight set +10%"
|
", XF86KbdBrightnessUp, exec, ${pkgs.writeShellScript "kbd-bright-up" ''
|
||||||
", XF86KbdBrightnessDown, exec, brightnessctl -d smc::kbd_backlight set 10%-"
|
${pkgs.brightnessctl}/bin/brightnessctl -d smc::kbd_backlight set +10%
|
||||||
|
brightness=$(${pkgs.brightnessctl}/bin/brightnessctl -d smc::kbd_backlight get)
|
||||||
|
max=$(${pkgs.brightnessctl}/bin/brightnessctl -d smc::kbd_backlight max)
|
||||||
|
echo $(( brightness * 100 / max )) > "$XDG_RUNTIME_DIR/wob.fifo"
|
||||||
|
''}"
|
||||||
|
", XF86KbdBrightnessDown, exec, ${pkgs.writeShellScript "kbd-bright-down" ''
|
||||||
|
${pkgs.brightnessctl}/bin/brightnessctl -d smc::kbd_backlight set 10%-
|
||||||
|
brightness=$(${pkgs.brightnessctl}/bin/brightnessctl -d smc::kbd_backlight get)
|
||||||
|
max=$(${pkgs.brightnessctl}/bin/brightnessctl -d smc::kbd_backlight max)
|
||||||
|
echo $(( brightness * 100 / max )) > "$XDG_RUNTIME_DIR/wob.fifo"
|
||||||
|
''}"
|
||||||
];
|
];
|
||||||
|
|
||||||
bindl = [
|
bindl = [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue