refactor: move screenshot to scripts

This commit is contained in:
Nickolaj Jepsen 2026-01-20 23:45:33 +01:00
parent d45f6a9359
commit 1a899dc894
4 changed files with 21 additions and 25 deletions

View file

@ -19,7 +19,6 @@
./greetd.nix ./greetd.nix
./niri.nix ./niri.nix
./qt.nix ./qt.nix
./screenshot.nix
./gtk/default.nix ./gtk/default.nix
./dms/default.nix ./dms/default.nix
]; ];

View file

@ -1,17 +0,0 @@
{
config,
lib,
pkgs,
...
}: let
screenshotPkg = pkgs.writeShellScriptBin "screenshot" ''
AREA=$(${lib.getExe pkgs.slurp} -d)
${lib.getExe pkgs.grim} -t ppm -g "$AREA" - | ${lib.getExe pkgs.satty} -f - --initial-tool=arrow --early-exit --copy-command=${pkgs.wl-clipboard}/bin/wl-copy --action-on-enter="save-to-clipboard" --disable-notifications
'';
in {
config = lib.mkIf config.fireproof.desktop.enable {
environment.systemPackages = [
screenshotPkg
];
};
}

View file

@ -1,6 +1,7 @@
{ {
pkgs, pkgs,
lib, lib,
config,
... ...
}: let }: let
makeScript = { makeScript = {
@ -13,13 +14,23 @@
text = builtins.readFile path; text = builtins.readFile path;
}; };
in { in {
environment.systemPackages = [ environment.systemPackages =
(makeScript { [
path = ./reboot-windows.bash; (makeScript {
path = ./reboot-windows.bash;
runtimeInputs = with pkgs; [
jq
systemd # for bootctl and systemctl
];
})
]
++ lib.optional config.fireproof.desktop.enable (makeScript {
path = ./screenshot.bash;
runtimeInputs = with pkgs; [ runtimeInputs = with pkgs; [
jq slurp
systemd # for bootctl and systemctl grim
satty
wl-clipboard
]; ];
}) });
];
} }

View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
AREA=$(slurp -d)
grim -t ppm -g "$AREA" - | satty -f - --initial-tool=arrow --early-exit --copy-command="wl-copy" --action-on-enter="save-to-clipboard" --disable-notifications