update: modules/hypr/hyprland.nix

This commit is contained in:
2026-02-25 09:02:03 +01:00
parent ba4f3f5ada
commit 09e31ebfd8
2 changed files with 49 additions and 6 deletions

View File

@@ -44,6 +44,7 @@
pathConfig = { pathConfig = {
wallpaper = "Obrazy/tapety/catppuccin"; wallpaper = "Obrazy/tapety/catppuccin";
screenshot = "Obrazy/zrzuty/";
}; };
}; };

View File

@@ -102,9 +102,14 @@
}; };
permission = [ permission = [
".*(grim), screencopy, allow" "${if isNixOS then "^${pkgs.grim}/bin/grim$" else "^/usr/bin/grim$"}"
".*(hyprlock), screencopy, allow" "^${if isNixOS then "${pkgs.hyprlock}/bin/hyprlock" else "/usr/bin/hyprlock"}$, screencopy, allow"
".*(xdg-desktop-portal-hyprland), screencopy, allow" "^${
if isNixOS then
"${pkgs.xdg-desktop-portal-hyprland}/libexec/xdg-desktop-portal-hyprland"
else
"/usr/lib/xdg-desktop-portal-hyprland"
}$, screencopy, allow"
]; ];
input = { input = {
@@ -308,9 +313,46 @@
]; ];
bindt = [ bindt = [
", PRINT, exec, ~/.local/bin/screenshot.sh region" ", PRINT, exec, ${pkgs.writeShellScript "region" ''
"$mainMod, PRINT, exec, ~/.local/bin/screenshot.sh fullscreen" "$mainMod, PRINT, exec, ${pkgs.writeShellScript "screenshot-region" ''
"alt_l, PRINT, exec, ~/.local/bin/screenshot.sh window" MONITOR=$(hyprctl monitors -j | ${
if isNixOS then "${pkgs.jq}/bin/jq" else "/usr/bin/jq"
} -r '.[] | select(.focused == true) | .name')
${if isNixOS then "${pkgs.grim}/bin/grim" else "/usr/bin/grim"} -o "$MONITOR" - | ${
if isNixOS then "${pkgs.satty}/bin/satty" else "/usr/bin/satty"
} -f -
''}"
''}"
"$mainMod, PRINT, exec, ${pkgs.writeShellScript "screenshot-fullscreen" ''
target_path=${userConfig.pathConfig.screenshot}/$(date +'%d-%m-%Y_%H:%M:%S')
MONITOR=$(hyprctl monitors -j | ${
if isNixOS then "${pkgs.jq}/bin/jq" else "/usr/bin/jq"
} -r '.[] | select(.focused == true) | .name') ${
if isNixOS then "${pkgs.grim}/bin/grim" else "/usr/bin/grim"
} -o "$MONITOR" "$target_path"
${if isNixOS then "${pkgs.wl-clipboard}/bin/wl-copy" else "/usr/bin/wl-copy"} < "$target_path"
${
if isNixOS then "${pkgs.libnotify}/bin/notify-send" else "/usr/bin/notify-send"
} -i "$target_path" -u low -a "Screenshot" "Screenshot fullscreen" "Saved and copied"
''}"
"alt_l, PRINT, exec, ${pkgs.writeShellScript "screenshot-window" ''
target_path="~/${userConfig.pathConfig.screenshot}/$(date +'%d-%m-%Y_%H-%M-%S').png"
mkdir -p "$(dirname "$target_path")"
GEOMETRY=$(hyprctl activewindow -j | ${
if isNixOS then "${pkgs.jq}/bin/jq" else "/usr/bin/jq"
} -r '"\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"')
${if isNixOS then "${pkgs.grim}/bin/grim" else "/usr/bin/grim"} -g "$GEOMETRY" "$target_path"
${if isNixOS then "${pkgs.wl-clipboard}/bin/wl-copy" else "/usr/bin/wl-copy"} < "$target_path"
${
if isNixOS then "${pkgs.libnotify}/bin/notify-send" else "/usr/bin/notify-send"
} -i "$target_path" -u low -a "Screenshot" "Screenshot window" "Saved and copied"
''}"
]; ];
bindm = [ bindm = [