Capture the entire screen with Return during a region pick
A previous submap attempt was brittle because the script owned the keyboard state: if it died between enter and exit, the submap stuck. This version lets the compositor own both edges. The Lua config binds plain Return when a layer surface with slurp's "selection" namespace opens and unbinds it when the last one closes, so the bind exists exactly while a pick is on screen. slurp dying for any reason (cancel, crash, pkill, SIGKILL of the picker) fires layer.closed and the bind evaporates — there is no code path where it leaks. Return invokes omarchy-capture-region --take-fullscreen, which flags a marker in XDG_RUNTIME_DIR and dismisses slurp; the picker treats an empty slurp result with a fresh marker as the focused monitor, reusing the existing fullscreen path. Since monitor focus follows the cursor, that is the monitor under the slurp crosshair. The recording flow gets monitor:NAME from the existing match, so Return during a recording pick starts a native full-monitor capture. The signal mode no-ops unless slurp is actually running, and both the signal protocol and the layer-scoped bind lifecycle are verified live: bind present only while slurp is open, real picks resolved by the signal on both the screenshot and recording paths, no leftover binds. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
b72aa8f65e
commit
1e996609a0
@@ -41,6 +41,29 @@ o.bind("ALT + PRINT", "Screenrecording", "omarchy-capture-screenrecording --stop
|
||||
o.bind("SUPER + PRINT", "Color picker", "pkill hyprpicker || hyprpicker -a")
|
||||
o.bind("SUPER + CTRL + PRINT", "Extract text (OCR) from screenshot", "omarchy-capture-text-extraction")
|
||||
|
||||
-- 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")
|
||||
|
||||
Reference in New Issue
Block a user