blob: 403aa605c192635e481b8c418646eaa250f3af0e (
plain)
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
53
54
|
{
config,
lib,
pkgs,
...
}:
let
cfg = config.kassouni.palette;
in
{
imports = [
./bluetooth.nix
./reboot.nix
./rebuild.nix
./screenshot.nix
./shutdown.nix
];
options.kassouni.palette.commands = lib.mkOption {
type = lib.types.listOf (
lib.types.submodule {
options = {
name = lib.mkOption {
type = lib.types.str;
description = "Label shown in the palette menu.";
};
icon = lib.mkOption {
type = lib.types.str;
description = "Nerd Font glyph shown before the label.";
};
exe = lib.mkOption {
type = lib.types.package;
description = "Executable to run when the entry is selected.";
};
};
}
);
default = [ ];
description = ''
Entries shown in the rofi command palette.
'';
};
config.home.packages = [
(pkgs.writers.writeBashBin "open-palette" ''
set -eu
exes=(${lib.concatMapStringsSep " " (c: "${c.exe}") cfg.commands})
idx=$(${pkgs.rofi}/bin/rofi -dmenu -i -format i -p palette <<EOF
${lib.concatMapStrings (c: "${c.icon} ${c.name}\n") cfg.commands}EOF
)
exec "''${exes[$idx]}"
'')
];
}
|