Add screenshotting

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2024-06-26 14:49:19 +03:00
parent c1ad1ee640
commit cc2fb93a4a
2 changed files with 35 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
{ user ? throw "user argument is required" }: { config, lib, pkgs, ... }:
let
hmConfig = config.home-manager.users."${user.name}";
in
{
home-manager.users."${user.name}" = {
home = {
packages = with pkgs; [ hyprshot swappy ];
sessionVariables.HYPRSHOT_DIR = "${hmConfig.xdg.userDirs.pictures}/screenshots";
};
wayland.windowManager.hyprland.settings.bind =
let
hyprshot = lib.meta.getExe pkgs.hyprshot;
date = "${pkgs.coreutils-full}/bin/date";
filename = "\"$(${date} +'%Y-%m-%d-%H%M%S.png')\"";
swappyWrapper = lib.meta.getExe (pkgs.writeShellApplication {
name = "swappy-wrapper";
runtimeInputs = with pkgs; [ swappy ];
text = ''
swappy -f "$1"
'';
});
in
[
", Print, exec, ${hyprshot} -m output -m active -f ${filename}"
"SHIFT, Print, exec, ${hyprshot} -m output -m active -f ${filename} -- ${swappyWrapper}"
", XF86SelectiveScreenshot, exec, ${hyprshot} -m region -z -f ${filename}"
"SHIFT, XF86SelectiveScreenshot, exec, ${hyprshot} -m region -z -f ${filename} -- ${swappyWrapper}"
];
};
}

View File

@@ -10,6 +10,7 @@ in
(import ../configs/matugen { inherit user; })
(import ../configs/firefox { inherit user; })
(import ../configs/hyprland { inherit user; })
(import ../configs/hyprshot { inherit user; })
(import ../configs/wev { inherit user; })
(import ../configs/brightnessctl { inherit user; })
(import ../configs/pavucontrol { inherit user; })