Skip to content
crocudaPublic

About

A hotkey daemon for elite shinobi.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Mudras: A hotkey daemon for elite shinobi.

A tool for great keyboards shortcuts (on_press, on_release, and submaps 😉). Mudras gives you enough rope to shoot yourself in the foot.

All that script does is executing commands whenever a key combination is matched.

Configuration

Mudras needs a single configuration file in kdl file format at ~/.config/mudras/config.kdl.

Set up a bind (hotkey/binding).

  • A bind is a sequence of keys separated by +:

    Super+Enter
  • You can attach commands on key press and/or on 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"
      "#
  }
}

Set up a submap (or mode, or subbind).

  • The submap is just a named container that contains binds as defined in the upper section.
// Submap definition
@submap name="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 @exit

    In the following example we exit the submap with the same key we use to enter (Super).

// Submap definition
@submap name="niri" {
  Super {
    @release {
     // Exit the submap
      @exit;
    }
  }
}

Special keys

volume_up == xf86AudioRaiseVolume
volume_down == xf86AudioLowerVolume
brightness_up == xf86MonBrightnessUp
brightness_down == f86MonBrightnessDown

Ignore some bind on multiple key release (bug fix).

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 {
  @release backward=false {
    - r#"notify-send "test" "#
  }
}
Super+Alt+T {
  @release {
    - r#"notify-send "test" "#
  }
}

Install

Cargo

cargo install --git https://github.com/pipelight/mudras

Nixos with flakes

# flake.nix
inputs = {
  mudras = {
      url = "github:pipelight/mudras";
  };
};
# default.nix
environment.systemPackages = with pkgs; [
  inputs.mudras.packages.${system}.default;
];

Start with your favorite init script or window manager.

Alternatives

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.

Developers

cargo build --release
sudo RUST_LOG=debug ./target/release/mudras

About

A hotkey daemon for elite shinobi.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages