document rofi, move keyboard shortcuts into it
This commit is contained in:
parent
d6c935bd6c
commit
1931f0dee7
2 changed files with 45 additions and 42 deletions
|
|
@ -36,46 +36,4 @@ in
|
||||||
home = {
|
home = {
|
||||||
packages = defaultPkgs ++ gnomePkgs;
|
packages = defaultPkgs ++ gnomePkgs;
|
||||||
};
|
};
|
||||||
|
|
||||||
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";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,52 @@
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
|
/* Rofi is a dmenu replacement; used for launching, and switching to
|
||||||
|
* applciations or windows by fuzzy search.
|
||||||
|
*/
|
||||||
programs.rofi = {
|
programs.rofi = {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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";
|
||||||
|
}
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue