From e341716e9583c072793a3f396b093bd44d45fe24 Mon Sep 17 00:00:00 2001 From: Antoine Vaure Date: Thu, 27 Feb 2025 15:30:08 +0100 Subject: [PATCH] add screenshot to an image viewer --- bin/screenshot.nix | 12 ++++++++++-- fish.nix | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/bin/screenshot.nix b/bin/screenshot.nix index 66aa2bd..c38dae9 100755 --- a/bin/screenshot.nix +++ b/bin/screenshot.nix @@ -10,9 +10,10 @@ full screen (copy) a selected area current window full screen +viewer """ -cmd = '${pkgs.rofi-wayland}/bin/rofi -dmenu -location 2 -l 6 -i -p "Screenshot which area?"' +cmd = '${pkgs.rofi-wayland}/bin/rofi -dmenu -location 2 -l 7 -i -p "Screenshot which area?"' result = subprocess.run(cmd, input=options, stdout=subprocess.PIPE, @@ -25,7 +26,11 @@ if result.returncode != 0: choice = result.stdout.strip() cmd = "${pkgs.pkgs.sway-contrib.grimshot}/bin/grimshot " -cmd += "copy " if re.match(".*(copy)", choice) else "save " +if choice == "viewer": + filename = subprocess.getoutput("mktemp") + cmd += f"save area {filename}" +else: + cmd += "copy " if re.match(".*(copy)", choice) else "save " for k, v in {"a selected area.*": "area ", "current window.*": "active ", @@ -36,4 +41,7 @@ for k, v in {"a selected area.*": "area ", subprocess.call(cmd, shell=True) + +if choice == "viewer": + subprocess.run(f"nsxiv -b {filename}", shell=True) '' diff --git a/fish.nix b/fish.nix index a790e9d..583d74d 100644 --- a/fish.nix +++ b/fish.nix @@ -110,6 +110,7 @@ pull = "git pull"; m = "meson"; n = "ninja"; + gdb_asan = "gdb -tui -ex='break __asan::ReportGenericError'"; }; plugins = [