From 3910bef1bff11cb16c6f1c622f188d64a1d7dd52 Mon Sep 17 00:00:00 2001 From: Hadi <112569860+anotherhadi@users.noreply.github.com> Date: Tue, 15 Oct 2024 14:14:12 +0200 Subject: [PATCH] hyprshot -> grimblast --- docs/TODO.md | 1 - home/scripts/screenshot/default.nix | 24 +++++++++++------------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/docs/TODO.md b/docs/TODO.md index 0deceaf..41989b8 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -11,4 +11,3 @@ feel free to contribute <3 ([CONTRIBUTING.md](CONTRIBUTING.md)) - [ ] nvim dap - [ ] OS Hardening with nix-mineral -- [ ] Move from hyprshot diff --git a/home/scripts/screenshot/default.nix b/home/scripts/screenshot/default.nix index 0610f97..8b5645a 100644 --- a/home/scripts/screenshot/default.nix +++ b/home/scripts/screenshot/default.nix @@ -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 ]; +}