From 115c7d396c27840ce47a3eb4b7470f77995d8472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20R=C3=B6ger?= Date: Sun, 16 Mar 2025 14:41:07 +0100 Subject: [PATCH] Home Gen469 @ 2025-03-16-14:41 --- modules/home/hyprland/config.nix | 35 +++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/modules/home/hyprland/config.nix b/modules/home/hyprland/config.nix index 2734bcb..9ac82e8 100644 --- a/modules/home/hyprland/config.nix +++ b/modules/home/hyprland/config.nix @@ -3,7 +3,34 @@ pkgs, lib, ... -}: { +}: let + screenshot = pkgs.writeShellScriptBin "screenshot" '' + region=0 + clip=0 + while [[ "$#" -gt 0 ]]; do + case $1 in + --region) region=1; ;; + --clip) clip=1; ;; + *) echo "Unknown parameter passed: $1"; exit 1 ;; + esac + shift + done + + if [[ $region -eq 1 ]]; then + if [[ $clip -eq 1 ]]; then + ${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp)" | ${pkgs.wl-clipboard}/bin/wl-copy + else + ${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp)" ~/Pictures/Screenshots/$(${pkgs.coreutils}/bin/date +'%Y-%m-%d_%H-%M-%S').png + fi + else + if [[ $clip -eq 1 ]]; then + ${pkgs.grim}/bin/grim | ${pkgs.wl-clipboard}/bin/wl-copy + else + ${pkgs.grim}/bin/grim ~/Pictures/Screenshots/$(${pkgs.coreutils}/bin/date +'%Y-%m-%d_%H-%M-%S').png + fi + fi + ''; +in { services.hypridle.settings = { general = { # lock_cmd = notify-send "lock!" # dbus/sysd lock command (loginctl lock-session) @@ -190,8 +217,10 @@ "$mod, 9, exec, ${pkgs.hyprlock}/bin/hyprlock" "$mod, 0, exec, ${pkgs.wlogout}/bin/wlogout -b 5" "$mod, n, exec, ${pkgs.swaynotificationcenter}/bin/swaync-client -t" - ", Print, exec, ${pkgs.grim}/bin/grim -g \"\$(${pkgs.slurp}/slurp)\" ~/Pictures/Screenshots/$(date +'%Y-%m-%d_%H-%M-%S').png" - "CTRL, Print, exec, ${pkgs.grim}/bin/grim -g \"\$(${pkgs.slurp}/slurp)\" | wl-copy" + ", Print, exec, ${screenshot}/bin/screenshot" + "CTRL, Print, exec, ${screenshot}/bin/screenshot --region" + "SHIFT, Print, exec, ${screenshot}/bin/screenshot --clip" + "CTRL SHIFT, Print, exec, ${screenshot}/bin/screenshot --region --clip" ] ++ ( # workspaces