Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyModes #167

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft

KeyModes #167

wants to merge 10 commits into from

Conversation

N1x0
Copy link
Contributor

@N1x0 N1x0 commented Jan 3, 2021

This PR adds different user-configurable modes for key & mouse binds.
The user can create different mode objects and Subscribe Keybinds on these.
Modes are activated using context.Keybinds.SetMode(KeyMode mode)

KeyMode takes the following parameter

KeyMode(IConfigContext context, string name, bool defaultsEnabled)

name is used for the label of the accompanying KeyModeWidget,
defaultsEnabled subscribes to the default Keybinds. is false by default

Here an example configuration

    var mod = KeyModifiers.Alt;

    context.AddBar(new BarPluginConfig()
    {
        FontName = "Roboto",
        RightWidgets = () => new IBarWidget[] { 
          new KeyModeWidget() { FontName = "Font Awesome 5 Free Solid" },
         new TimeWidget(1000, "HH:mm  dd/MM/yy") }
    });

   //creating first mode `work`, with default bindings 
    var work = new KeyMode(context, "\uf0b1", true);

    // setting the current mode to `Work`
    context.Keybinds.SetMode(work);

    // creating a second mode `game`, without default bindings
    var game = new KeyMode(context, "\uf11b");

   
    //setting Keybinds to switch between modes 
    work.Subscribe(mod, Keys.Escape, () => context.Keybinds.SetMode(game));
    game.Subscribe(mod, Keys.Escape, () => context.Keybinds.SetMode(work));
  • Updating the KeybindDialog to reflect the bindings of the current mode
  • Adding and subscribing to a default mode object in config.template.csx
  • Documentation on the website

KeyModeWidget screenshots

Work KeyMode
image
Game KeyMode
image

@N1x0
Copy link
Contributor Author

N1x0 commented Jan 20, 2021

Hi @rickbutton , is this something you'd want to include and does the overall implementation approach work for you? There's still a few things that would require fixing but I'd be a tad more motivated to get around to that if I knew that this is something that ultimately could get merged. LMK what you think!

@N1x0 N1x0 closed this Feb 12, 2021
@N1x0 N1x0 reopened this Feb 12, 2021
@dalyIsaac
Copy link
Member

Though I don't think I would use this, I think this is an interesting and valuable idea.

@josteink
Copy link
Member

With regard to compatibility, does this change break existing usage of the existing .Keybinds-property?

@josteink
Copy link
Member

Also: This PR now have merge conflicts against git master.

Those will have to be fixed before we can merge 🙂

@josteink
Copy link
Member

@N1x0 : if you want to follow up on this PR, I’m sure it will get merged faster this time around. Just fix up the merge-conflict and we should be good to go 🤠

@N1x0
Copy link
Contributor Author

N1x0 commented Jun 27, 2021

Will have a look at the conflicts and try to get it implemented without breaking existing configs

@N1x0 N1x0 added the enhancement New feature or request label Jun 29, 2021
@N1x0 N1x0 marked this pull request as draft July 1, 2021 13:32
@josteink
Copy link
Member

josteink commented Nov 2, 2021

Offer still stands. Fix up the conflicts and we can try to get this merged 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants