hyprshot -> grimblast

This commit is contained in:
Hadi 2024-10-15 14:14:12 +02:00
parent 92dded9cc6
commit 3910bef1bf
2 changed files with 11 additions and 14 deletions

View File

@ -11,4 +11,3 @@ feel free to contribute <3 ([CONTRIBUTING.md](CONTRIBUTING.md))
- [ ] nvim dap
- [ ] OS Hardening with nix-mineral
- [ ] Move from hyprshot

View File

@ -1,6 +1,6 @@
# - ## Screenshot
#-
#- This module provides a script to take screenshots using `hyprshot` and `swappy`.
#- This module provides a script to take screenshots using `grimblast` and `swappy`.
#-
#- - `screenshot [region|window|monitor] [swappy]` - Take a screenshot of the region, window, or monitor. Optionally, use `swappy` to copy the screenshot to the clipboard.
{ pkgs, ... }:
@ -9,28 +9,26 @@ let
if [[ $2 == "swappy" ]];then
folder="/tmp"
else
folder="$HOME/Pictures/screenshots"
folder="$HOME/Pictures"
fi
filename="$(date +%Y-%m-%d_%H:%M:%S).png"
mode="region" # Default to region
if [[ $1 == "window" ]];then
mode="window"
mode="active"
elif [[ $1 == "region" ]];then
mode="area"
elif [[ $1 == "monitor" ]];then
mode="output"
fi
${pkgs.hyprshot}/bin/hyprshot -m $mode -o $folder -f $filename -s || exit 1
${pkgs.grimblast}/bin/grimblast --notify --freeze save $mode "$folder/$filename" || exit 1
if [[ $2 == "swappy" ]];then
${pkgs.swappy}/bin/swappy -f "$folder/$filename" -o "$HOME/Pictures/screenshots/$filename"
${pkgs.swappy}/bin/swappy -f "$folder/$filename" -o "$HOME/Pictures/$filename"
exit 0
fi
message=" Screenshot saved"
${pkgs.libnotify}/bin/notify-send "$message" \
--icon="$folder/$filename" \
--replace-id="$(cat "/tmp/nixy-notification" 2>/dev/null || echo 0)" --print-id > "/tmp/nixy-notification"
'';
in { home.packages = [ pkgs.hyprshot screenshot ]; }
in {
home.packages =
[ pkgs.hyprshot screenshot pkgs.slurp pkgs.grim pkgs.grimblast ];
}