Add screenshotting
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
34
users/configs/hyprshot/default.nix
Normal file
34
users/configs/hyprshot/default.nix
Normal 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}"
|
||||
];
|
||||
};
|
||||
}
|
@@ -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; })
|
||||
|
Reference in New Issue
Block a user