2021-10-05 23:42:21 -07:00
|
|
|
{ pkgs, ... }:
|
|
|
|
|
|
|
|
|
|
{
|
2022-03-19 19:37:05 -07:00
|
|
|
/* Rofi is a dmenu replacement; used for launching, and switching to
|
|
|
|
|
* applciations or windows by fuzzy search.
|
|
|
|
|
*/
|
2021-10-05 23:42:21 -07:00
|
|
|
programs.rofi = {
|
|
|
|
|
enable = true;
|
|
|
|
|
};
|
2022-03-19 19:37:05 -07:00
|
|
|
|
|
|
|
|
dconf.settings =
|
|
|
|
|
let
|
|
|
|
|
inherit (builtins) length head tail listToAttrs genList;
|
|
|
|
|
range = a: b: if a < b then [ a ] ++ range (a + 1) b else [ ];
|
|
|
|
|
# TODO: something similar for org/gnome/desktop/wm/keybindings
|
|
|
|
|
globalPath = "org/gnome/settings-daemon/plugins/media-keys";
|
|
|
|
|
path = "${globalPath}/custom-keybindings";
|
|
|
|
|
mkPath = id: "${globalPath}/custom${toString id}";
|
|
|
|
|
isEmpty = list: length list == 0;
|
|
|
|
|
mkSettings = settings:
|
|
|
|
|
let
|
|
|
|
|
checkSettings = { name, command, binding }@this: this;
|
|
|
|
|
aux = i: list:
|
|
|
|
|
if isEmpty list then [ ] else
|
|
|
|
|
let
|
|
|
|
|
hd = head list;
|
|
|
|
|
tl = tail list;
|
|
|
|
|
name = mkPath i;
|
|
|
|
|
in
|
|
|
|
|
aux (i + 1) tl ++ [{
|
|
|
|
|
name = mkPath i;
|
|
|
|
|
value = checkSettings hd;
|
|
|
|
|
}];
|
|
|
|
|
settingsList = (aux 0 settings);
|
|
|
|
|
in
|
|
|
|
|
listToAttrs (settingsList ++ [
|
|
|
|
|
{
|
|
|
|
|
name = globalPath;
|
|
|
|
|
value = {
|
|
|
|
|
custom-keybindings = genList (i: "/${mkPath i}/") (length settingsList);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
]);
|
|
|
|
|
in
|
|
|
|
|
mkSettings [
|
|
|
|
|
{
|
|
|
|
|
name = "rofi-run";
|
|
|
|
|
command = "rofi -show run -normal-window";
|
|
|
|
|
binding = "<Primary>d";
|
|
|
|
|
}
|
|
|
|
|
];
|
2021-10-05 23:42:21 -07:00
|
|
|
}
|