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

Event system #258

Open
TimUntersberger opened this issue Apr 2, 2021 · 2 comments
Open

Event system #258

TimUntersberger opened this issue Apr 2, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@TimUntersberger
Copy link
Owner

TimUntersberger commented Apr 2, 2021

What if we replace rules with an event handler system.

So instead of writing the following

nog.config.rules = {
  ["notepad.exe"] = {
    ignore: true
  }
}

we could do this

nog.events.on("win_detected", function (event)
  -- event has the settings as payload so it would look like this:
  -- {
  --   type: "win_detected",
  --   payload: {
  --     ignore: false,
  --     workspace: nil,
  --     ...
  --   }
  -- }
  event.payload.ignore = true
end)

I am not too sure about how we could implement rules with such a system. The things I mentioned above are my first ideas.

We could then have more events for different things. A few examples:

  • win_unmanaged
  • win_managed
  • error (This could be interesting?)

Maybe a plugin could even emit custom events through here? Not too sure about this one as they could provide their own event management (Having one central place for events could be cleaner I guess)

@TimUntersberger TimUntersberger added the enhancement New feature or request label Apr 2, 2021
@keepitsane
Copy link
Contributor

This could also be useful for installers. Not sure if you guys have this issue as well, but anytime I run an installer most of the time it is jumping all over the place. Not sure if there would be a way to detect this, but would be nice if possible.

@ramirezmike
Copy link
Collaborator

This could also be useful for installers. Not sure if you guys have this issue as well, but anytime I run an installer most of the time it is jumping all over the place. Not sure if there would be a way to detect this, but would be nice if possible.

Yeah, I had a similar problem and added the minHeight/minWidth settings here https://timuntersberger.github.io/nog/configuration/settings.html to handle that. It's not a perfect solution but it helps.

I'm not sure how we could detect an installer but an event system would totally help attack issues like that.

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

No branches or pull requests

3 participants