Keymap manager for wlroots-based compositors. Inspired by which-key.nvim.
cargo install wlr-which-key --locked
This repository provides the flake outputs:
packages.${system}.wlr-which-key
homeManagerModules.wlr-which-key
Or you can use the version from nixpkgs (pkgs.wlr-which-key)
If you use the package in this flake, you will have to build it locally.
nix profile install github:MaxVerevkin/wlr-which-key
Example flake
{
inputs = {
# other inputs...
wlr-which-key = {
url = "github:MaxVerevkin/wlr-which-key";
# Optionally, pin the nixpkgs version to the one in your flake:
inputs.nixpkgs.follows = "nixpkgs"; # Replace "nixpkgs" with the name of your nixpkgs flake input
};
};
# the rest of your flake, outputs, etc ...
}
You can then use the package in your flake by referencing inputs.wlr-which-key.packages.${pkgs.system}.wlr-which-key.
Example module
{
pkgs,
inputs,
...
}:
{
imports = [
inputs.wlr-which-key.homeManagerModules.wlr-which-key
];
programs.wlr-which-key = {
enable = true;
package = inputs.wlr-which-key.${pkgs.system}.wlr-which-key; # Optional, the default is the package the flake provides
# The following is equivelent to the example config, but in nix
settings = {
font = "JetBrainsMono Nerd Font 12";
background = "#282828d0";
color = "#fbf1c7";
border = "#8ec07c";
separator = " ➜ ";
border_width = 2;
corner_r = 10;
padding = 15;
rows_per_column = 5;
column_padding = 25;
anchor = "center";
margin_right = 0;
margin_bottom = 0;
margin_left = 0;
margin_top = 0;
inhibit_compositor_keyboard_shortcuts = true;
menu = [
{
key = "p";
desc = "Power";
submenu = [
{
key = "s";
desc = "Sleep";
cmd = "systemctl suspend";
}
{
key = "r";
desc = "Reboot";
cmd = "reboot";
}
{
key = "o";
desc = "Off";
cmd = "poweroff";
}
];
}
{
key = "l";
desc = "Laptop Screen";
submenu = [
{
key = "t";
desc = "Toggle On/Off";
cmd = "toggle-laptop-display.sh";
}
{
key = "s";
desc = "Scale";
submenu = [
{
key = "1";
desc = "Set Scale to 1.0";
cmd = "wlr-randr --output eDP-1 --scale 1";
}
{
key = "2";
desc = "Set Scale to 1.1";
cmd = "wlr-randr --output eDP-1 --scale 1.1";
}
{
key = "3";
desc = "Set Scale to 1.2";
cmd = "wlr-randr --output eDP-1 --scale 1.2";
}
{
key = "4";
desc = "Set Scale to 1.3";
cmd = "wlr-randr --output eDP-1 --scale 1.3";
}
];
}
];
}
];
};
};
}
Default config file: $XDG_CONFIG_HOME/wlr-which-key/config.yaml or ~/.config/wlr-which-key/config.yaml. Run wlr-which-key --help for more info.
Keybindings may be single characters (e.g. a, B) or xkb key labels (without the XKB_KEY_ prefix, e.g. Return, Insert). Ctrl, Alt, and Mod4/Logo modifiers are supported (like Ctrl+Return or Ctrl+Alt+a or Mod4+Return or Logo+Return). A key may also be a list of strings, in which case a keybinding will match if any of the keys match (e.g. key: [Left, h]) will match both left arrow and 'h'.
When executed a command will normally end the wlr_which_key process. If you want certain commands to keep the UI open after they execute then
configure those specific commands with (keep_open: true).
Example config:
# Theming
font: JetBrainsMono Nerd Font 12
background: "#282828d0"
color: "#fbf1c7"
border: "#8ec07c"
separator: " ➜ "
border_width: 2
corner_r: 10
padding: 15 # Defaults to corner_r
rows_per_column: 5 # No limit by default
column_padding: 25 # Defaults to padding
# Anchor and margin
anchor: center # One of center, left, right, top, bottom, bottom-left, top-left, etc.
# Only relevant when anchor is not center
margin_right: 0
margin_bottom: 0
margin_left: 0
margin_top: 0
# Permits key bindings that conflict with compositor key bindings.
# Default is `false`.
inhibit_compositor_keyboard_shortcuts: true
menu:
- key: "p"
desc: Power
submenu:
- key: "s"
desc: Sleep
cmd: systemctl suspend
- key: "r"
desc: Reboot
cmd: reboot
- key: "o"
desc: Off
cmd: poweroff
- key: "l"
desc: Laptop Screen
submenu:
- key: "t"
desc: Toggle On/Off
cmd: toggle-laptop-display.sh
- key: "s"
desc: Scale
submenu:
- key: "1"
desc: Set Scale to 1.0
cmd: wlr-randr --output eDP-1 --scale 1
- key: "2"
desc: Set Scale to 1.1
cmd: wlr-randr --output eDP-1 --scale 1.1
- key: "3"
desc: Set Scale to 1.2
cmd: wlr-randr --output eDP-1 --scale 1.2
- key: "4"
desc: Set Scale to 1.3
cmd: wlr-randr --output eDP-1 --scale 1.3
Old config format (v1.1.0 and earlier)
# Theming
font: JetBrainsMono Nerd Font 12
background: "#282828d0"
color: "#fbf1c7"
border: "#8ec07c"
separator: " ➜ "
border_width: 2
corner_r: 10
padding: 15 # Defaults to corner_r
# Anchor and margin
anchor: center # One of center, left, right, top, bottom, bottom-left, top-left, etc.
# Only relevant when anchor is not center
margin_right: 0
margin_bottom: 0
margin_left: 0
margin_top: 0
menu:
"w":
desc: WiFi
submenu:
"t": { desc: Toggle, cmd: wifi_toggle.sh }
"c": { desc: Connections, cmd: kitty --class nmtui-connect nmtui-connect }
"p":
desc: Power
submenu:
"s": { desc: Sleep, cmd: systemctl suspend }
"r": { desc: Reboot, cmd: reboot }
"o": { desc: Off, cmd: poweroff }
"t":
desc: Theme
submenu:
"d": { desc: Dark, cmd: dark-theme on }
"l": { desc: Light, cmd: dark-theme off }
"t": { desc: Toggle, cmd: dark-theme toggle, keep_open: true }
"l":
desc: Laptop Screen
submenu:
"t": { desc: Toggle On/Off, cmd: toggle-laptop-display.sh }
"s":
desc: Scale
submenu:
"1": { desc: Set Scale to 1.0, cmd: wlr-randr --output eDP-1 --scale 1 }
"2": { desc: Set Scale to 1.1, cmd: wlr-randr --output eDP-1 --scale 1.1 }
"3": { desc: Set Scale to 1.2, cmd: wlr-randr --output eDP-1 --scale 1.2 }
"4": { desc: Set Scale to 1.3, cmd: wlr-randr --output eDP-1 --scale 1.3 }

