From 85e7a5b22f95f1015fbfcda28ce01af898093b55 Mon Sep 17 00:00:00 2001 From: Zephrynis Date: Wed, 5 Nov 2025 00:28:09 +0000 Subject: [PATCH] feat: add screenshot functionality with customizable options for Hyprland --- home/home.nix | 10 ++++++++++ home/hyprland.nix | 9 +++++++-- home/scripts/screenshot.sh | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 home/scripts/screenshot.sh diff --git a/home/home.nix b/home/home.nix index 237361e..181608f 100644 --- a/home/home.nix +++ b/home/home.nix @@ -46,6 +46,9 @@ # vlc # spotify + # Gaming + prismlauncher # Minecraft launcher + # Communication legcord teams-for-linux @@ -55,6 +58,7 @@ # Screenshots and screen recording grim # Screenshot tool for Wayland slurp # Screen area selector for Wayland + jq # JSON processor for window info # obs-studio # Hyprland essentials @@ -223,6 +227,12 @@ # Waybar configuration with glassmorphic theme home.file.".config/waybar/config".source = ./waybar-config.json; home.file.".config/waybar/style.css".source = ./waybar-style.css; + + # Screenshot script + home.file.".local/bin/screenshot" = { + source = ./scripts/screenshot.sh; + executable = true; + }; # Flatpaks are managed in system/flatpak.nix diff --git a/home/hyprland.nix b/home/hyprland.nix index 2b0a176..fb3aa42 100644 --- a/home/hyprland.nix +++ b/home/hyprland.nix @@ -65,8 +65,8 @@ gaps_in = 5; gaps_out = 10; border_size = 2; - "col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg"; - "col.inactive_border" = "rgba(595959aa)"; + "col.active_border" = "rgba(4a7aa1ee) rgba(2a5d82ee) 45deg"; # Dark pale blue gradient + "col.inactive_border" = "rgba(3d4955aa)"; # Darker blue-gray layout = "dwindle"; allow_tearing = false; @@ -172,6 +172,11 @@ "$mod, S, togglespecialworkspace, magic" "$mod SHIFT, S, movetoworkspace, special:magic" + # Screenshots + ", Print, exec, $HOME/.local/bin/screenshot area" # Area selection (default) + "$mod, Print, exec, $HOME/.local/bin/screenshot full" # Full screen + "$mod SHIFT, Print, exec, $HOME/.local/bin/screenshot window" # Active window + # Scroll through workspaces "$mod, mouse_down, workspace, e+1" "$mod, mouse_up, workspace, e-1" diff --git a/home/scripts/screenshot.sh b/home/scripts/screenshot.sh new file mode 100644 index 0000000..5bf85fe --- /dev/null +++ b/home/scripts/screenshot.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# Screenshot script for Hyprland using grim and slurp + +SCREENSHOT_DIR="$HOME/Pictures/Screenshots" +mkdir -p "$SCREENSHOT_DIR" + +FILENAME="$SCREENSHOT_DIR/screenshot_$(date +%Y%m%d_%H%M%S).png" + +case "$1" in + full) + # Full screen screenshot + grim "$FILENAME" && \ + wl-copy < "$FILENAME" && \ + notify-send "Screenshot" "Full screen captured and copied to clipboard" -i camera-photo + ;; + area) + # Area selection screenshot + grim -g "$(slurp)" "$FILENAME" && \ + wl-copy < "$FILENAME" && \ + notify-send "Screenshot" "Area captured and copied to clipboard" -i camera-photo + ;; + window) + # Active window screenshot + WINDOW_GEOMETRY=$(hyprctl activewindow -j | jq -r '"\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"') + grim -g "$WINDOW_GEOMETRY" "$FILENAME" && \ + wl-copy < "$FILENAME" && \ + notify-send "Screenshot" "Window captured and copied to clipboard" -i camera-photo + ;; + *) + echo "Usage: $0 {full|area|window}" + exit 1 + ;; +esac