Restructure repo

This commit is contained in:
2025-11-29 20:18:45 +01:00
parent e1e2040deb
commit 1e89b45042
97 changed files with 114 additions and 139 deletions

View File

@@ -0,0 +1,32 @@
# - ## Screenshot
#-
#- 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, ...}: let
screenshot = pkgs.writeShellScriptBin "screenshot" ''
if [[ $2 == "swappy" ]];then
folder="/tmp"
else
folder="$HOME/Pictures"
fi
filename="$(date +%Y-%m-%d_%H:%M:%S).png"
if [[ $1 == "window" ]];then
mode="active"
elif [[ $1 == "region" ]];then
mode="area"
elif [[ $1 == "monitor" ]];then
mode="output"
fi
${pkgs.grimblast}/bin/grimblast --notify --freeze copysave $mode "$folder/$filename" || exit 1
if [[ $2 == "swappy" ]];then
${pkgs.swappy}/bin/swappy -f "$folder/$filename" -o "$HOME/Pictures/$filename"
exit 0
fi
'';
in {
home.packages = [ screenshot pkgs.grim pkgs.grimblast ];
}