From 94bb4997642b62406fcd717ac18b5afb9307cf6b Mon Sep 17 00:00:00 2001 From: Uyanide Date: Fri, 28 Nov 2025 10:36:46 +0100 Subject: [PATCH] fix: also copy output of grim to clipboard --- config/ghostty/.config/.alt/ghostty-default/config | 3 +++ config/ghostty/.config/.alt/ghostty-niri/config | 2 ++ config/scripts/.local/scripts/ghostty-capture | 2 +- config/scripts/.local/scripts/screenshot-script | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/config/ghostty/.config/.alt/ghostty-default/config b/config/ghostty/.config/.alt/ghostty-default/config index c3941d1..bfc586a 100644 --- a/config/ghostty/.config/.alt/ghostty-default/config +++ b/config/ghostty/.config/.alt/ghostty-default/config @@ -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 diff --git a/config/ghostty/.config/.alt/ghostty-niri/config b/config/ghostty/.config/.alt/ghostty-niri/config index 6e06fdd..0f7b99e 100644 --- a/config/ghostty/.config/.alt/ghostty-niri/config +++ b/config/ghostty/.config/.alt/ghostty-niri/config @@ -22,3 +22,5 @@ cursor-style = bar adjust-cursor-thickness = 3 custom-shader = cursor-shaders/cursor-smear.glsl + +quit-after-last-window-closed = false \ No newline at end of file diff --git a/config/scripts/.local/scripts/ghostty-capture b/config/scripts/.local/scripts/ghostty-capture index 45df8a9..de7929f 100755 --- a/config/scripts/.local/scripts/ghostty-capture +++ b/config/scripts/.local/scripts/ghostty-capture @@ -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 } diff --git a/config/scripts/.local/scripts/screenshot-script b/config/scripts/.local/scripts/screenshot-script index 7846671..0679324 100755 --- a/config/scripts/.local/scripts/screenshot-script +++ b/config/scripts/.local/scripts/screenshot-script @@ -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():