A tool for keyboards shortcuts that gives me enough rope to shoot yourself in the foot.
It executes commands when a key combination is matched.
A single configuration file in kdl at ~/.config/mudras/config.kdl
- Set up a binding as a sequence of keys separated by
+.
Super+Enter- You can attach commands on key press and/or key release.
Super+Enter {
@press @release
}- Set up a list of commands to execute when binding is matched. Commands can be single line strings escaped with "" or multiline strings escaped with r#""#.
Super+Enter {
@press {
-"kitty -e fish" -r#" notify-send "new term" "#
}
}- The submap is just a named container that contains binds as defined in the upper section.
// Submap definition@submapname="niri" {
Ctrl+m {
@press {
-"niri msg move-column-left"
}
}
Ctrl+i {
@press {
-"niri msg move-column-right"
}
}
}
- Enter the submap.
You enter a submap with the special command prefix
@enter, followed by the submap name.
Super {
@release {
// enter a submap @enter"niri";
}
}Exit the submap. You exit a submap with the special command prefix
@exitIn the following example we exit the submap with the same key we use to enter (Super).
// Submap definition@submapname="niri" {
Super {
@release {
// Exit the submap @exit;
}
}
}
When defining binds like Super+Alt+T @release , Super+Alt @release and Super @release.
If you type Super+Alt+T and release keys, actions corresponding to every bind are executed.
You may want to flag the shortest bindings with @release backward=false
Only the longest bind is triggered, therefore Super+Alt+T is executed
and Super+Alt as of Super are ignored.
Super+Alt {
@releasebackward=false {
-r#"notify-send "test" "#
}
}
Super+Alt+T {
@release {
-r#"notify-send "test" "#
}
}cargo install --git https://github.com/pipelight/mudras# flake.nixinputs={mudras={url="github:pipelight/mudras";};};# default.nixenvironment.systemPackages=withpkgs;[inputs.mudras.packages.${system}.default;];Start with your favorite init script or window manager.
Everything in here has been stolen from niri and swhkd which are excellent alternatives to mudras.
Thanks to @YaLTeR, @Shinyzenith and all other contributors for the relentless work and great code quality that benefit mudras.
cargo build --release
sudo RUST_LOG=debug ./target/release/mudras