mirror of
https://github.com/thesleepingsage/hypr-lens.git
synced 2026-11-01 06:56:42 +01:00
fix(regionSelector): save swappy-edited screenshots to hypr-lens dir
Capture swappy's final surface via `swappy -f - -o -` (stdout on exit) and route it through hypr-lens's own clipboard/disk handling instead of relying on swappy's Save button, which only writes to swappy's global save_dir (~/Desktop) and is unreachable from hypr-lens. Respects copyAlsoSaves: clipboard always, disk file only when enabled. Removes the fragile wl-paste hack; cleans up the empty output file on failed saves. Diagnosed in swappy-save-button-investigation.md.
This commit is contained in:
1 parent
472152801f
commit
501fec3560
1 file changed
+11
-5
@@ -84,11 +84,14 @@ Singleton {
|
||||
const cropToStdout = `${cropBase} -`;
|
||||
const cleanup = buildCleanup(screenshotPath);
|
||||
|
||||
// swappy -o - prints its final surface to stdout on exit (independent of swappy's
|
||||
// Save button, which is hardwired to swappy's own save_dir). Capture that here so the
|
||||
// result lands in hypr-lens's clipboard/save dir. Mirrors buildCopyCommand.
|
||||
if (!alsoSave) {
|
||||
return [
|
||||
"bash", "-c",
|
||||
`${cropToStdout} | swappy -f -; \
|
||||
${buildNotify("Copied to clipboard", "")}; \
|
||||
`${cropToStdout} | swappy -f - -o - | wl-copy && \
|
||||
{ ${buildNotify("Copied to clipboard", "")}; } && \
|
||||
${cleanup}`
|
||||
];
|
||||
}
|
||||
@@ -97,9 +100,12 @@ Singleton {
|
||||
return [
|
||||
"bash", "-c",
|
||||
`${buildSaveSetup(expandedSaveDir)} && \
|
||||
${cropToStdout} | swappy -f -; \
|
||||
wl-paste > "$savePath" && \
|
||||
${buildNotify("Copied & saved", "$savePath")}; \
|
||||
${cropToStdout} | swappy -f - -o - | tee >(wl-copy) > "$savePath" && \
|
||||
if [ -s "$savePath" ]; then \
|
||||
${buildNotify("Copied & saved", "$savePath")}; \
|
||||
else \
|
||||
rm -f "$savePath"; ${buildNotify("Copy failed", "")}; \
|
||||
fi && \
|
||||
${cleanup}`
|
||||
];
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user