From 9910a2fddb0bf0c76a84fb9714abde4126b720b9 Mon Sep 17 00:00:00 2001 From: Kiana Sheibani Date: Mon, 4 Nov 2024 16:43:04 -0500 Subject: [PATCH] add: new hyprland keybinding for saving screenshots --- home-manager/wayland/hyprland.nix | 3 +++ home-manager/wayland/scripts/screenshot-save | 10 ++++++++++ 2 files changed, 13 insertions(+) create mode 100755 home-manager/wayland/scripts/screenshot-save diff --git a/home-manager/wayland/hyprland.nix b/home-manager/wayland/hyprland.nix index d36efe2..c75bc03 100644 --- a/home-manager/wayland/hyprland.nix +++ b/home-manager/wayland/hyprland.nix @@ -155,6 +155,9 @@ in { "$mod Shift, 8, hy3:movetoworkspace, 8" "$mod Shift, 9, hy3:movetoworkspace, 9" "$mod Shift, 0, hy3:movetoworkspace, 10" + + # Screenshot + "$mod, P, exec, ${scripts}/screenshot-save" ]; bindn = [ diff --git a/home-manager/wayland/scripts/screenshot-save b/home-manager/wayland/scripts/screenshot-save new file mode 100755 index 0000000..cf89ff0 --- /dev/null +++ b/home-manager/wayland/scripts/screenshot-save @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +if test $(wl-paste -l) = "image/png"; then + name=$(date '+%Y-%m-%d_%H-%M-%S').png + wl-paste -t "image/png" > ~/Pictures/"$name" + notify-send "Image stored at $name" \ + -a grim -c screenshot -u low -t 3000 +else + notify-send "No image in clipboard" \ + -a grim -c screenshot -u low -t 3000 +fi