waycrate / swhkd

Sxhkd clone for Wayland (works on TTY and X11 too)
https://git.sr.ht/~shinyzenith/swhkd
BSD 2-Clause "Simplified" License
679 stars 47 forks source link

[feat] implment mode options #170

Closed EdenQwQ closed 1 year ago

EdenQwQ commented 1 year ago

Mode options:

pub struct Mode {
    pub name: String,
    pub hotkeys: Vec<Hotkey>,
    pub unbinds: Vec<KeyBinding>,
    pub options: ModeOptions,
}

pub struct ModeOptions {
    pub swallow: bool,
    pub onceoff: bool,
}

Mode options are declared after the mode name. Syntax: mode modename option1 option2

Currently, two options are implemented: swallow and onceoff

swallow: Don't emit any event through uinput. onceoff: Automatically escape a mode when a keybinding defined in it is evoked. @BlueDrink9 This may solve #164.

We can add more options by adding members to the ModeOptions struct.

EdenQwQ commented 1 year ago

Thanks for the changes, this looks great!

Would you mind updating the config file docs also? (swhkd.5.scd)

I can also add an issue to make us remember to update it in the future.

Updated

Shinyzenith commented 1 year ago

Yeah sure, go for the merge! Thanks for all the work guys. ❤️ @ajanon @EdenQwQ