From 0cd9eea75ba59e59ab51e23480c227980b928dbc Mon Sep 17 00:00:00 2001 From: ltadeu6 Date: Mon, 20 Apr 2026 18:44:39 -0300 Subject: [PATCH] Add Hyprland screenshot shortcuts --- configs/hypr/hyprland.conf | 9 +++++++-- home/ltadeu6.nix | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/configs/hypr/hyprland.conf b/configs/hypr/hyprland.conf index 490f40b..3dae18c 100644 --- a/configs/hypr/hyprland.conf +++ b/configs/hypr/hyprland.conf @@ -16,8 +16,8 @@ $ULTRA = desc:LG Electronics LG ULTRAWIDE 512AZWSDD473 $SIDE = desc:STD Computer Inc LED -monitor = $ULTRA,3440x1440@159.96,0x0,1, bitdepth, 10, cm, hdr, sdrbrightness, 1.3 -# monitor = $ULTRA,3440x1440@159.96,0x0,1 +monitor = $ULTRA,3440x1440@159.96,0x0,1 +# monitor = $ULTRA,3440x1440@159.96,0x0,1, bitdepth, 10, cm, hdr, sdrbrightness, 1.3 monitor = $SIDE,1920x1080@60,-1400x-1080,1 @@ -218,6 +218,11 @@ bind = $mainMod, F, fullscreen bind = $mainMod CTRL, F, fullscreenstate, 0, 2 bind = $mainMod, C, centerwindow, 1 +# Screenshots to clipboard +bind = , Print, exec, sh -lc 'grim -g "$(slurp)" - | wl-copy --type image/png' +bind = CTRL, Print, exec, sh -lc 'grim - | wl-copy --type image/png' +bind = ALT, Print, exec, ~/.config/hypr/scripts/screenshot-active-window.sh + # Focus and movement # Move focus with mainMod + arrow keys bind = $mainMod, right, movefocus, l diff --git a/home/ltadeu6.nix b/home/ltadeu6.nix index 52e629b..e9de3b5 100644 --- a/home/ltadeu6.nix +++ b/home/ltadeu6.nix @@ -269,6 +269,8 @@ isort pipenv jq + grim + slurp wl-clipboard nodejs texlab @@ -282,6 +284,20 @@ home.file = { ".config/hypr/hyprland.conf".source = ../configs/hypr/hyprland.conf; ".config/hypr/hyprpaper.conf".source = ../configs/hypr/hyprpaper.conf; + ".config/hypr/scripts/screenshot-active-window.sh" = { + executable = true; + text = '' + #!/usr/bin/env sh + set -eu + + GEOMETRY="$( + hyprctl activewindow -j \ + | jq -r '"\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"' + )" + + grim -g "$GEOMETRY" - | wl-copy --type image/png + ''; + }; ".config/hyfetch.json".text = builtins.toJSON { preset = "voidgirl";