35 lines
1.2 KiB
Nix
35 lines
1.2 KiB
Nix
{ 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}"
|
|
];
|
|
};
|
|
}
|