feat: add wlr-which module and config
This commit is contained in:
@@ -16,6 +16,7 @@ in {
|
||||
./rofi
|
||||
./swaync.nix
|
||||
./waybar.nix
|
||||
./wlr-which-key.nix
|
||||
./wlsunset.nix
|
||||
];
|
||||
|
||||
@@ -28,5 +29,6 @@ in {
|
||||
obs.enable = mkDefault cfg.fullDesktop;
|
||||
qt.enable = mkDefault cfg.fullDesktop;
|
||||
rofi.enable = mkDefault cfg.fullDesktop;
|
||||
wlr-which-key.enable = mkDefault cfg.fullDesktop;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -117,8 +117,8 @@ in {
|
||||
$menu = rofi -combi-modi drun,calc -show combi
|
||||
|
||||
bind = SUPER, Return, exec, ${pkgs.kitty}/bin/kitty ${pkgs.tmux}/bin/tmux
|
||||
bind = SUPER, Space, submap, leader
|
||||
bind = , Print, submap, screenshot
|
||||
bind = SUPER, Space, exec, ${pkgs.wlr-which-key}/bin/wlr-which-key
|
||||
bind = , Print, exec, ${pkgs.wlr-which-key}/bin/wlr-which-key -k s
|
||||
|
||||
submap = leader
|
||||
bind = , l, exec, plock
|
||||
@@ -147,11 +147,13 @@ in {
|
||||
bind = , u, submap, reset
|
||||
bind = , escape, submap, reset
|
||||
bind = CTRL, g, submap, reset
|
||||
|
||||
submap = buffers
|
||||
bind = , d, killactive,
|
||||
bind = , d, submap, reset
|
||||
bind = , escape, submap, reset
|
||||
bind = CTRL, g, submap, reset
|
||||
|
||||
submap = resize
|
||||
binde = , $left, resizeactive, -10 0
|
||||
binde = , $right, resizeactive, 10 0
|
||||
@@ -160,6 +162,7 @@ in {
|
||||
bind = , q, submap, reset
|
||||
bind = , escape, submap, reset
|
||||
bind = CTRL, g, submap, reset
|
||||
|
||||
submap = rofi
|
||||
bind = , b, exec, rofi-bluetooth
|
||||
bind = , b, submap, reset
|
||||
@@ -173,6 +176,7 @@ in {
|
||||
bind = , y, submap, reset
|
||||
bind = , escape, submap, reset
|
||||
bind = CTRL, g, submap, reset
|
||||
|
||||
submap = screenshot
|
||||
bind = , Print, exec, screenshot
|
||||
bind = , Print, submap, reset
|
||||
@@ -188,6 +192,7 @@ in {
|
||||
bind = Shift, s, submap, reset
|
||||
bind = , escape, submap, reset
|
||||
bind = CTRL, g, submap, reset
|
||||
|
||||
submap = windows
|
||||
bind = , period, submap, resize
|
||||
bind = , $left, movefocus, l
|
||||
|
||||
189
users/modules/desktop/wlr-which-key.nix
Normal file
189
users/modules/desktop/wlr-which-key.nix
Normal file
@@ -0,0 +1,189 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit
|
||||
(lib)
|
||||
literalExpression
|
||||
mkIf
|
||||
mkOption
|
||||
mkEnableOption
|
||||
types
|
||||
;
|
||||
cfg = config.home.desktop.wlr-which-key;
|
||||
yamlFormat = pkgs.formats.yaml {};
|
||||
|
||||
# Convert kebab-case to snake_case
|
||||
toSnakeCase = str: builtins.replaceStrings ["-"] ["_"] str;
|
||||
|
||||
# Recursively filter out null values and convert kebab-case keys to snake_case
|
||||
filterNulls = value:
|
||||
if lib.isAttrs value
|
||||
then lib.mapAttrs' (n: v: lib.nameValuePair (toSnakeCase n) (filterNulls v)) (lib.filterAttrs (n: v: v != null) value)
|
||||
else if lib.isList value
|
||||
then map filterNulls value
|
||||
else value;
|
||||
menuEntryType = types.submodule {
|
||||
freeformType = yamlFormat.type;
|
||||
options = with types; {
|
||||
key = mkOption {
|
||||
type = str;
|
||||
example = "p";
|
||||
};
|
||||
desc = mkOption {
|
||||
type = str;
|
||||
example = "Power";
|
||||
};
|
||||
cmd = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
example = "echo example";
|
||||
};
|
||||
keep-open = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
example = true;
|
||||
};
|
||||
submenu = mkOption {
|
||||
type = nullOr (listOf menuEntryType);
|
||||
default = null;
|
||||
example = literalExpression ''
|
||||
[
|
||||
{ key = "s"; desc = "Suspend"; cmd = "systemctl suspend"; }
|
||||
{ key = "r"; desc = "Reboot"; cmd = "systemctl reboot"; }
|
||||
{ key = "o"; desc = "Poweroff"; cmd = "systemctl poweroff"; }
|
||||
]
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
settingsType = types.submodule {
|
||||
freeformType = yamlFormat.type;
|
||||
options = with types; {
|
||||
background = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
example = "#282828FF";
|
||||
};
|
||||
color = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
example = "#FBF1C7FF";
|
||||
};
|
||||
border = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
example = "#8EC07CFF";
|
||||
};
|
||||
anchor = mkOption {
|
||||
type = nullOr (enum ["center" "top" "bottom" "left" "right" "top-left" "top-right" "bottom-left" "bottom-right"]);
|
||||
default = null;
|
||||
example = "top-left";
|
||||
};
|
||||
margin-top = mkOption {
|
||||
type = nullOr int;
|
||||
default = null;
|
||||
example = "0";
|
||||
};
|
||||
margin-right = mkOption {
|
||||
type = nullOr int;
|
||||
default = null;
|
||||
example = "0";
|
||||
};
|
||||
margin-bottom = mkOption {
|
||||
type = nullOr int;
|
||||
default = null;
|
||||
example = "0";
|
||||
};
|
||||
margin-left = mkOption {
|
||||
type = nullOr int;
|
||||
default = null;
|
||||
example = "0";
|
||||
};
|
||||
font = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
example = "monospace 10";
|
||||
};
|
||||
separator = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
example = " ➜ ";
|
||||
};
|
||||
border-width = mkOption {
|
||||
type = nullOr (either float int);
|
||||
default = null;
|
||||
example = 4.0;
|
||||
};
|
||||
corder-r = mkOption {
|
||||
type = nullOr (either float int);
|
||||
default = null;
|
||||
example = 20.0;
|
||||
};
|
||||
padding = mkOption {
|
||||
type = nullOr (either float int);
|
||||
default = null;
|
||||
example = 15.0;
|
||||
};
|
||||
rows-per-column = mkOption {
|
||||
type = nullOr int;
|
||||
default = null;
|
||||
example = 5;
|
||||
};
|
||||
column-padding = mkOption {
|
||||
type = nullOr (either float int);
|
||||
default = null;
|
||||
example = 25.0;
|
||||
};
|
||||
inhibit-compositor-keyboard-shortcuts = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
example = false;
|
||||
};
|
||||
auto_kbd_layout = mkOption {
|
||||
type = bool;
|
||||
default = true;
|
||||
example = false;
|
||||
};
|
||||
namespace = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
example = "wlr_which_key";
|
||||
};
|
||||
menu = mkOption {
|
||||
type = listOf menuEntryType;
|
||||
default = [];
|
||||
example = literalExpression ''
|
||||
[
|
||||
{
|
||||
key = "p";
|
||||
desc = "Power";
|
||||
submenu = [
|
||||
{ key = "s"; desc = "Suspend"; cmd = "systemctl suspend"; }
|
||||
{ key = "r"; desc = "Reboot"; cmd = "systemctl reboot"; }
|
||||
{ key = "o"; desc = "Poweroff"; cmd = "systemctl poweroff"; }
|
||||
];
|
||||
}
|
||||
]
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.home.desktop.wlr-which-key = {
|
||||
enable = mkEnableOption "Enables wlr-which-key";
|
||||
package = lib.mkPackageOption pkgs "wlr-which-key" {};
|
||||
settings = mkOption {
|
||||
type = settingsType;
|
||||
default = {};
|
||||
description = "Configuration written to {file}`$XDG_CONFIG_HOME/wlr-which-key/config.yaml`.";
|
||||
};
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
xdg.configFile = {
|
||||
"wlr-which-key/config.yaml".source = yamlFormat.generate "wlr-which-key-config.yml" (filterNulls cfg.settings);
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -10,31 +10,6 @@ with lib; let
|
||||
with epkgs; [
|
||||
mu4e
|
||||
pdf-tools
|
||||
tree-sitter
|
||||
tree-sitter-langs
|
||||
(treesit-grammars.with-grammars (grammar:
|
||||
with grammar; [
|
||||
tree-sitter-bash
|
||||
tree-sitter-c
|
||||
tree-sitter-cpp
|
||||
tree-sitter-css
|
||||
tree-sitter-dockerfile
|
||||
tree-sitter-http
|
||||
tree-sitter-javascript
|
||||
tree-sitter-jsdoc
|
||||
tree-sitter-json
|
||||
tree-sitter-just
|
||||
tree-sitter-markdown
|
||||
tree-sitter-markdown-inline
|
||||
tree-sitter-nix
|
||||
tree-sitter-rust
|
||||
tree-sitter-sql
|
||||
tree-sitter-toml
|
||||
tree-sitter-typescript
|
||||
tree-sitter-typst
|
||||
tree-sitter-vue
|
||||
tree-sitter-yaml
|
||||
]))
|
||||
]
|
||||
));
|
||||
cfg = config.home.dev.editors.emacs;
|
||||
|
||||
Reference in New Issue
Block a user