mirror of
https://github.com/zephrynis/nix-flake.git
synced 2026-02-18 20:21:53 +00:00
feat: add screenshot functionality with customizable options for Hyprland
This commit is contained in:
@@ -46,6 +46,9 @@
|
|||||||
# vlc
|
# vlc
|
||||||
# spotify
|
# spotify
|
||||||
|
|
||||||
|
# Gaming
|
||||||
|
prismlauncher # Minecraft launcher
|
||||||
|
|
||||||
# Communication
|
# Communication
|
||||||
legcord
|
legcord
|
||||||
teams-for-linux
|
teams-for-linux
|
||||||
@@ -55,6 +58,7 @@
|
|||||||
# Screenshots and screen recording
|
# Screenshots and screen recording
|
||||||
grim # Screenshot tool for Wayland
|
grim # Screenshot tool for Wayland
|
||||||
slurp # Screen area selector for Wayland
|
slurp # Screen area selector for Wayland
|
||||||
|
jq # JSON processor for window info
|
||||||
# obs-studio
|
# obs-studio
|
||||||
|
|
||||||
# Hyprland essentials
|
# Hyprland essentials
|
||||||
@@ -224,6 +228,12 @@
|
|||||||
home.file.".config/waybar/config".source = ./waybar-config.json;
|
home.file.".config/waybar/config".source = ./waybar-config.json;
|
||||||
home.file.".config/waybar/style.css".source = ./waybar-style.css;
|
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
|
# Flatpaks are managed in system/flatpak.nix
|
||||||
|
|
||||||
# Let Home Manager manage itself
|
# Let Home Manager manage itself
|
||||||
|
|||||||
@@ -65,8 +65,8 @@
|
|||||||
gaps_in = 5;
|
gaps_in = 5;
|
||||||
gaps_out = 10;
|
gaps_out = 10;
|
||||||
border_size = 2;
|
border_size = 2;
|
||||||
"col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg";
|
"col.active_border" = "rgba(4a7aa1ee) rgba(2a5d82ee) 45deg"; # Dark pale blue gradient
|
||||||
"col.inactive_border" = "rgba(595959aa)";
|
"col.inactive_border" = "rgba(3d4955aa)"; # Darker blue-gray
|
||||||
|
|
||||||
layout = "dwindle";
|
layout = "dwindle";
|
||||||
allow_tearing = false;
|
allow_tearing = false;
|
||||||
@@ -172,6 +172,11 @@
|
|||||||
"$mod, S, togglespecialworkspace, magic"
|
"$mod, S, togglespecialworkspace, magic"
|
||||||
"$mod SHIFT, S, movetoworkspace, special: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
|
# Scroll through workspaces
|
||||||
"$mod, mouse_down, workspace, e+1"
|
"$mod, mouse_down, workspace, e+1"
|
||||||
"$mod, mouse_up, workspace, e-1"
|
"$mod, mouse_up, workspace, e-1"
|
||||||
|
|||||||
33
home/scripts/screenshot.sh
Normal file
33
home/scripts/screenshot.sh
Normal file
@@ -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
|
||||||
Reference in New Issue
Block a user