Step the internal backlight in the shell instead of a script per keypress (#13427)
Each brightness key ran omarchy-brightness-display: resolving the focused monitor and backlight device, checking for an Apple display, reading, writing and reading back through brightnessctl, then omarchy-osd over a qs IPC client. That is 64-133ms from keypress to OSD depending on load, on keys that repeat while held. The brightness up and down keys now dispatch global shortcuts. On an internal panel the shell reads the level from sysfs, steps it by the script's rules, writes it with one brightnessctl, and shows the OSD from the level read back. A press overlapping one still being applied is dropped, as the script's flock drops it. External and Apple displays fall back to the script, which drives them over DDC or their own helper. The absolute and precise brightness keys still run the script. Across 24 steps from eight starting levels the shell and the script land on identical levels, and keypress to OSD drops to ~31ms. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
25ead28f90
commit
d3fb0284a8
8 files changed
+184
-12
No files matched your search
@@ -3,8 +3,8 @@ o.bind("XF86AudioRaiseVolume", "Volume up", { audio = "raise" }, { locked = true
|
||||
o.bind("XF86AudioLowerVolume", "Volume down", { audio = "lower" }, { locked = true, repeating = true })
|
||||
o.bind("XF86AudioMute", "Mute", { audio = "mute-toggle" }, { locked = true })
|
||||
o.bind("XF86AudioMicMute", "Mute microphone", "omarchy-audio-input-mute", { locked = true })
|
||||
o.bind("XF86MonBrightnessUp", "Brightness up", "omarchy-brightness-display +5%", { locked = true, repeating = true })
|
||||
o.bind("XF86MonBrightnessDown", "Brightness down", "omarchy-brightness-display 5%-", { locked = true, repeating = true })
|
||||
o.bind("XF86MonBrightnessUp", "Brightness up", { brightness = "raise" }, { locked = true, repeating = true })
|
||||
o.bind("XF86MonBrightnessDown", "Brightness down", { brightness = "lower" }, { locked = true, repeating = true })
|
||||
o.bind("SHIFT + XF86MonBrightnessUp", "Brightness maximum", "omarchy-brightness-display 100%", { locked = true, repeating = true })
|
||||
o.bind("SHIFT + XF86MonBrightnessDown", "Brightness minimum", "omarchy-brightness-display 1%", { locked = true, repeating = true })
|
||||
o.bind("XF86KbdBrightnessUp", "Keyboard brightness up", "omarchy-brightness-keyboard up", { locked = true, repeating = true })
|
||||
|
||||
@@ -100,6 +100,9 @@ local function command_from(value, description)
|
||||
return shell_dispatcher("panel", value.panel, "omarchy-shell shell toggle " .. shell_quote(value.panel))
|
||||
elseif value.audio then
|
||||
return shell_dispatcher("audio", value.audio, "omarchy-audio-output-volume " .. shell_quote(value.audio))
|
||||
elseif value.brightness then
|
||||
local step = value.brightness == "raise" and "+5%" or "5%-"
|
||||
return shell_dispatcher("brightness", value.brightness, "omarchy-brightness-display " .. step)
|
||||
elseif value.ipc then
|
||||
local target, method = value.ipc:match("^([^.]+)%.(.+)$")
|
||||
return shell_dispatcher("ipc", value.ipc, "omarchy-shell " .. shell_quote(target) .. " " .. shell_quote(method))
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
# Hyprland global shortcuts the Omarchy shell registers, one per line: a menu
|
||||
# route to toggle, a panel plugin to toggle, a volume key, or an argument-free
|
||||
# IPC call as target.method. A binding written as o.bind(keys, description,
|
||||
# { menu = "theme" }), { panel = "omarchy.emojis" }, { audio = "raise" } or
|
||||
# { ipc = "media.next" } dispatches the matching shortcut straight to the shell,
|
||||
# with no process to spawn per keypress. Anything missing here still binds,
|
||||
# through the omarchy-menu, omarchy-shell or omarchy-audio-output-volume
|
||||
# command instead.
|
||||
# route to toggle, a panel plugin to toggle, a volume or brightness key, or an
|
||||
# argument-free IPC call as target.method. A binding written as o.bind(keys,
|
||||
# description, { menu = "theme" }), { panel = "omarchy.emojis" },
|
||||
# { audio = "raise" }, { brightness = "raise" } or { ipc = "media.next" }
|
||||
# dispatches the matching shortcut straight to the shell, with no process to
|
||||
# spawn per keypress. Anything missing here still binds, through the
|
||||
# omarchy-menu, omarchy-shell, omarchy-audio-output-volume or
|
||||
# omarchy-brightness-display command instead.
|
||||
menu root
|
||||
menu apps
|
||||
menu capture
|
||||
@@ -27,6 +28,8 @@ panel omarchy.power
|
||||
audio raise
|
||||
audio lower
|
||||
audio mute-toggle
|
||||
brightness raise
|
||||
brightness lower
|
||||
ipc media.playPause
|
||||
ipc media.next
|
||||
ipc media.previous
|
||||
|
||||
Reference in new issue
Block a user