-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.nix
executable file
·52 lines (44 loc) · 1.22 KB
/
test.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{
config,
lib,
pkgs,
my_lib,
...
}: let
inherit (lib) mkIf;
inherit (my_lib.opt) mkEnableOpt;
cfg = config.modules.home.cli-apps.clr-pckr;
in {
options.modules.home.cli-apps.clr-pckr =
mkEnableOpt
"Whether or not to add the clr-pckr command";
config = mkIf cfg.enable {
home.packages = [
(pkgs.writeShellScriptBin "clr-pckr"
/*
bash
*/
''
color=$(hyprpicker -n)
if test -z "$color"; then
echo "Program aborted by user. Exiting..."
exit 1
fi
wl-copy "$color"
echo "$color"
# Generated with https://interfacecraft.online/squircle-svg-generator/
# However it is far from perfect so I have also made som manual changes
# using inkscape.
squircle_black="${./squircle.svg}"
squircle_color=$(mktemp --suffix=.svg)
if test -z "$squircle_color"; then
echo "Failed to generate tmp file. Exiting..."
exit 1
fi
sed "s/#000000/$color/" "$squircle_black" > "$squircle_color"
notify-send --icon "$squircle_color" "Hyprpicker" "$color"
rm "$squircle_color"
'')
];
};
}