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:
David Heinemeier HanssonandClaude Opus 5.5 authored and GitHub committed 2026-09-27 19:34:36 +02:00
1 parent 25ead28f90
commit d3fb0284a8
8 files changed
+184 -12

No files matched your search

+6 -2
View File
@@ -20,6 +20,7 @@ ShellRoot {
property PluginRegistry pluginRegistry: PluginRegistry { }
property BarWidgetRegistry barWidgetRegistry: BarWidgetRegistry { }
property AppLibrary appLibrary: AppLibrary { }
property BrightnessKeys brightnessKeys: BrightnessKeys { host: shell }
property string home: Quickshell.env("HOME")
@@ -1526,7 +1527,7 @@ ShellRoot {
var lines = String(raw || "").split("\n")
for (var i = 0; i < lines.length; i++) {
var match = /^([A-Za-z]+)\s+(\S+)\s*$/.exec(lines[i])
if (match && ["menu", "panel", "audio", "ipc"].indexOf(match[1]) !== -1)
if (match && ["menu", "panel", "audio", "brightness", "ipc"].indexOf(match[1]) !== -1)
entries.push({ kind: match[1], target: match[2], name: match[1] + "." + match[2] })
}
return entries
@@ -1546,6 +1547,9 @@ ShellRoot {
var service = shell.serviceFor(shell.ipcShortcutServices[target] || "")
if (!service || !service.runShortcut(method))
Util.execArgv(["omarchy-shell", target, method])
} else if (entry.kind === "brightness") {
if (!shell.brightnessKeys.handle(entry.target))
Util.execArgv(["omarchy-brightness-display", entry.target === "raise" ? "+5%" : "5%-"])
} else if (entry.kind === "audio") {
var media = shell.serviceFor("omarchy.media")
if (!media || !media.handleVolumeKey(entry.target))
@@ -1570,7 +1574,7 @@ ShellRoot {
appid: "omarchy"
name: modelData.name
description: modelData.kind === "audio" ? "Volume " + modelData.target : (modelData.kind === "ipc" ? "Run " + modelData.target : "Toggle the " + modelData.target + " " + modelData.kind)
description: modelData.kind === "audio" || modelData.kind === "brightness" ? (modelData.kind === "audio" ? "Volume " : "Brightness ") + modelData.target : (modelData.kind === "ipc" ? "Run " + modelData.target : "Toggle the " + modelData.target + " " + modelData.kind)
onPressed: shell.runShortcut(modelData)
}
}