{ config, lib, pkgs, ... }: let
inherit (lib) mkIf;
screenshot = pkgs.writeShellScriptBin "screenshot" ''
'';
screenshot-full = pkgs.writeShellScriptBin "screenshot-full" ''
'';
in mkIf config.isDesktop {
environment.systemPackages = [
pkgs.grim # Screenshot utility.
pkgs.slurp # Screen area selection.
pkgs.swappy # Screenshot editor/annotator.
screenshot
screenshot-full
];
}
home-manager.sharedModules = [{
# Desktop entries allow them to appear in Fuzzel.
xdg.desktopEntries.screenshot = {
name = "Screenshot";
exec = "screenshot";
terminal = false;
};
xdg.desktopEntries.screenshot-clip = {
name = "Screenshot Clipboard";
exec = "screenshot-clip";
terminal = false;
};
xdg.desktopEntries.screenshot-full = {
name = "Screenshot Full";
exec = "screenshot-full";
terminal = false;
};
}];
icon = "camera-web";
icon = "camera-web";
icon = "camera-web";
screenshot-clip
if ${pkgs.grim}/bin/grim - | ${pkgs.wl-clipboard}/bin/wl-copy --type image/png; then
else
fi
${pkgs.libnotify}/bin/notify-send "Screenshot" "Failed to take screenshot" --icon=dialog-error --urgency=critical
${pkgs.libnotify}/bin/notify-send "Screenshot" "Full screen screenshot copied to clipboard" --icon=image-x-generic
${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp)" - | ${pkgs.swappy}/bin/swappy -f -
'';
screenshot-clip = pkgs.writeShellScriptBin "screenshot-clip" ''
if ${pkgs.grim}/bin/grim -g "$(${pkgs.slurp}/bin/slurp)" - | ${pkgs.wl-clipboard}/bin/wl-copy --type image/png; then
else
fi
${pkgs.libnotify}/bin/notify-send "Screenshot" "Failed to take screenshot" --icon=dialog-error --urgency=critical
${pkgs.libnotify}/bin/notify-send "Screenshot" "Area screenshot copied to clipboard" --icon=image-x-generic