Closing the lid could suspend the machine with the session still exposed. omarchy-sleep-lock held a delay inhibitor and waited for Quickshell to report the session secure, but a delay inhibitor is a timer rather than a promise: logind suspends once InhibitDelayMaxSec expires, locked or not. The default is five seconds, and closing the lid also reconfigures displays -- exactly when the lock service is waiting for the screen set to settle before it can secure. The race is now off the critical path. switch:on:Lid Switch runs omarchy-system-lid-close, which requests the lock the moment the lid closes, before logind has decided to suspend at all, so the inhibitor window usually finds the session already secure. A docked lid close does not suspend (HandleLidSwitchDocked defaults to ignore) and must not lock either, since that is clamshell mode still in use on the external display, so the handler gates on the same closed-and-undocked pair logind itself keys on. Suspends that never touch the lid -- idle timeout, the system menu, low battery -- still arrive through the inhibitor, so that path gets room to work too. The shipped drop-in raises InhibitDelayMaxSec to 15s, and the helper derives its budget from logind's live InhibitDelayMaxUSec rather than assuming the drop-in landed: a machine that has not reloaded logind yet, or that carries its own override, gets a budget that fits what logind will actually allow. It leaves logind a fifth of its own window and caps at 12s, so a hand-raised window cannot strand a closed laptop awake in a bag. The wait itself had three defects. Its deadline arithmetic read EPOCHREALTIME assuming a period, so under any comma-decimal locale the subtraction parsed as bash's comma operator and silently voided the deadline, leaving only the attempt counter to stop it. The lock request shared the status polls' timeout and exited on first failure, so a shell 300ms slow meant suspending unlocked; it now has its own budget and is simply retried, since asking again is idempotent. And a refusal the shell reports on stdout with a zero exit -- missing-pam -- read as success, burning the whole window on a lock that could never happen. Every call is bounded by what is left of the budget rather than by an estimate of what the step should cost, so the deadline holds on hardware slower than anything the constants were fitted to. Failure is still possible and it used to be silent. It now writes to the journal and raises a critical notification, which lands on the screen the user unlocks into. Incidentally, monitor-recovery-test asserted lid probing against omarchy-hw-clamshell after that logic moved to omarchy-hw-laptop-closed. It aborted the file under set -e, skipping the nine assertions behind it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
94 lines
5.3 KiB
Lua
94 lines
5.3 KiB
Lua
o.bind("SUPER + SPACE", "Omarchy menu", "omarchy-menu toggle")
|
|
o.bind("SUPER + CTRL + E", "Emojis", "omarchy-shell shell toggle omarchy.emojis")
|
|
o.bind("SUPER + CTRL + C", "Capture menu", "omarchy-menu toggle capture")
|
|
o.bind("SUPER + CTRL + O", "Toggle menu", "omarchy-menu toggle toggle")
|
|
o.bind("SUPER + CTRL + H", "Hardware menu", "omarchy-menu toggle hardware")
|
|
o.bind("SUPER + SHIFT + code:201", "Omarchy menu", "omarchy-menu toggle root")
|
|
o.bind("SUPER + ESCAPE", "System menu", "omarchy-menu toggle system")
|
|
o.bind("XF86PowerOff", "Power menu", "omarchy-menu toggle system", { locked = true })
|
|
o.bind("SUPER + K", "Show key bindings", "omarchy-menu-keybindings")
|
|
o.bind("SUPER + ALT + K", "Show Tmux key bindings", "omarchy-menu-tmux-keybindings")
|
|
o.bind("SUPER + CTRL + J", "Jump to waiting Tmux pane", "omarchy-tmux-alert focus")
|
|
o.bind("XF86Calculator", "Calculator", "gnome-calculator")
|
|
|
|
o.bind_toggle("SUPER + SHIFT + SPACE", "Toggle top bar", "bar")
|
|
o.bind("SUPER + CTRL + SPACE", "Background switcher", "omarchy-menu toggle background")
|
|
o.bind("SUPER + SHIFT + CTRL + SPACE", "Theme menu", "omarchy-menu toggle theme")
|
|
o.bind("SUPER + BACKSPACE", "Toggle window transparency", "omarchy-hyprland-window-transparency-toggle")
|
|
o.bind("SUPER + SHIFT + BACKSPACE", "Toggle window gaps", "omarchy-hyprland-window-gaps-toggle")
|
|
o.bind("SUPER + CTRL + BACKSPACE", "Toggle single-window square aspect", "omarchy-hyprland-window-single-square-aspect-toggle")
|
|
|
|
-- xkbcommon names the comma keysym "comma"; the upper-case "COMMA" does not match.
|
|
o.bind("SUPER + comma", "Dismiss last notification", "omarchy-shell notifications dismissOne")
|
|
o.bind("SUPER + SHIFT + comma", "Dismiss all notifications", "omarchy-shell notifications dismissAll")
|
|
o.bind_toggle("SUPER + CTRL + comma", "Toggle silencing notifications", "notification-silencing")
|
|
o.bind("SUPER + ALT + comma", "Invoke last notification", "omarchy-shell notifications invokeLast")
|
|
o.bind("SUPER + SHIFT + ALT + comma", "Open notification history", "omarchy-shell notifications showHistory")
|
|
|
|
o.bind_toggle("SUPER + CTRL + I", "Toggle locking on idle", "idle")
|
|
o.bind_toggle("SUPER + CTRL + N", "Toggle nightlight", "nightlight")
|
|
o.bind("SUPER + CTRL + Delete", "Toggle laptop display", "omarchy-hyprland-monitor-internal toggle")
|
|
o.bind("SUPER + CTRL + ALT + Delete", "Toggle laptop display mirroring", "omarchy-hyprland-monitor-internal-mirror toggle")
|
|
o.bind("switch:on:Lid Switch", nil, "omarchy-system-lid-close", { locked = true })
|
|
o.bind("switch:off:Lid Switch", nil, "omarchy-hyprland-monitor-clamshell", { locked = true })
|
|
|
|
o.bind("PRINT", "Screenshot", "omarchy-capture-screenshot")
|
|
o.bind("ALT + PRINT", "Screenrecording", "omarchy-capture-screenrecording --stop-recording || omarchy-menu toggle trigger.capture.screenrecord")
|
|
o.bind("SUPER + ALT + code:34", "Make webcam overlay smaller", "omarchy-capture-webcam-resize smaller")
|
|
o.bind("SUPER + ALT + code:35", "Make webcam overlay larger", "omarchy-capture-webcam-resize larger")
|
|
o.bind("SUPER + PRINT", "Color picker", "pkill hyprpicker || hyprpicker -a")
|
|
o.bind("SUPER + CTRL + PRINT", "Extract text (OCR) from screenshot", "omarchy-capture-text")
|
|
|
|
-- While the slurp region picker is open, Return captures the entire focused
|
|
-- monitor. The bind lives exactly as long as a selection layer is on screen
|
|
-- (slurp opens one per monitor), so it cannot leak or get stuck.
|
|
local selection_layers = 0
|
|
|
|
hl.on("layer.opened", function(layer)
|
|
if layer.namespace == "selection" then
|
|
selection_layers = selection_layers + 1
|
|
if selection_layers == 1 then
|
|
hl.bind("RETURN", hl.dsp.exec_cmd("omarchy-capture-region --take-fullscreen"), { description = "Capture entire screen" })
|
|
end
|
|
end
|
|
end)
|
|
|
|
hl.on("layer.closed", function(layer)
|
|
if layer.namespace == "selection" and selection_layers > 0 then
|
|
selection_layers = selection_layers - 1
|
|
if selection_layers == 0 then
|
|
hl.unbind("RETURN")
|
|
end
|
|
end
|
|
end)
|
|
|
|
o.bind("SUPER + CTRL + S", "Share", "omarchy-menu toggle share")
|
|
|
|
o.bind("SUPER + CTRL + PERIOD", "Transcode", "omarchy-transcode")
|
|
|
|
o.bind("SUPER + CTRL + R", "Set reminder", "omarchy-menu toggle reminder-set")
|
|
o.bind("SUPER + CTRL + ALT + R", "Show reminders", "omarchy-reminder show")
|
|
o.bind("SUPER + SHIFT + CTRL + R", "Clear reminders", "omarchy-reminder clear")
|
|
|
|
o.bind("SUPER + CTRL + ALT + T", "Show time", "omarchy-notification-time")
|
|
o.bind("SUPER + CTRL + ALT + B", "Show battery remaining", "omarchy-notification-battery")
|
|
o.bind("SUPER + CTRL + ALT + W", "Toggle weather", "omarchy-notification-weather")
|
|
|
|
o.bind("SUPER + CTRL + A", "Audio", "omarchy-shell shell toggle omarchy.audio")
|
|
o.bind("SUPER + CTRL + B", "Bluetooth", "omarchy-shell shell toggle omarchy.bluetooth")
|
|
o.bind("SUPER + CTRL + D", "Display", "omarchy-shell shell toggle omarchy.monitor")
|
|
o.bind("SUPER + CTRL + W", "Network", "omarchy-shell shell toggle omarchy.network")
|
|
o.bind("SUPER + CTRL + P", "Power", "omarchy-shell shell toggle omarchy.power")
|
|
o.bind("SUPER + CTRL + T", "Activity", { tui = "btop" })
|
|
|
|
o.bind("SUPER + CTRL + Z", "Zoom in", function()
|
|
local zoom = hl.get_config("cursor.zoom_factor") or 1
|
|
hl.config({ cursor = { zoom_factor = zoom + 1 } })
|
|
end)
|
|
|
|
o.bind("SUPER + CTRL + ALT + Z", "Reset zoom", function()
|
|
hl.config({ cursor = { zoom_factor = 1 } })
|
|
end)
|
|
|
|
o.bind("SUPER + CTRL + L", "Lock system", "omarchy-system-lock")
|