fix: also copy output of grim to clipboard

This commit is contained in:
2025-11-28 10:36:46 +01:00
parent 1bf6921992
commit 94bb499764
4 changed files with 7 additions and 2 deletions

View File

@@ -8,6 +8,9 @@ window-padding-y = 10
keybind = ctrl+shift+r=reload_config
keybind = ctrl+shift+h=write_screen_file:copy
keybind = ctrl+shift+j=text:ghostty-capture\n
command = exec fish
confirm-close-surface = false

View File

@@ -22,3 +22,5 @@ cursor-style = bar
adjust-cursor-thickness = 3
custom-shader = cursor-shaders/cursor-smear.glsl
quit-after-last-window-closed = false

View File

@@ -25,7 +25,7 @@ file=${1:-$(wl-paste --no-newline)}
exit 1
}
[ -f "$file" ] || {
[ -e "$file" ] || {
echo "File does not exist: $file" >&2
exit 1
}

View File

@@ -78,7 +78,7 @@ def take_screenshot(filepath: Path, typeStr: str):
# and the selection ui is drawn inside of niri without its state exposed to external programs.
# so we use grim + slurp for area mode and niri's built-in commands for others.
ScreenshotType.FULL: "niri msg action screenshot-screen",
ScreenshotType.AREA: f" grim -g \"$(slurp)\" -t png {niriScreenshotPath}",
ScreenshotType.AREA: f" grim -g \"$(slurp)\" -t png {niriScreenshotPath} && cat {niriScreenshotPath} | wl-copy",
ScreenshotType.WINDOW: "niri msg action screenshot-window",
}
if niriScreenshotPath.exists():