1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2024-11-03 04:33:30 -05:00
Commit graph

7 commits

Author SHA1 Message Date
Patrick Ziegler
26be83f893
module: Implement action router (#2336)
* module: Implement proof of concept action router

Action implementation inside module becomes much cleaner because each
module just registers action names together with a callback (pointer to
member function) and the action router does the rest.

* Make input function final

This forces all modules to use the action router

* modules: Catch exceptions in action handlers

* Use action router for all modules

* Use action_ prefix for function names

The mpd module's 'stop' action overwrote the base module's stop function
which caused difficult to debug behavior.

To prevent this in the future we now prefix each function that is
responsible for an action with 'action_'

* Cleanup

* actions: Throw exception when re-registering action

Action names are unique inside modules. Unfortunately there is no way to
ensure this statically, the next best thing is to crash the module and
let the user know that this is a bug.

* Formatting

* actions: Ignore data for actions without data

This is the same behavior as before.

* action_router: Write tests
2021-01-04 10:25:52 +01:00
patrick96
9fb75779f3 Incorporate reviews 2020-11-26 20:53:53 +01:00
patrick96
bc1b86c584 actions: Separate data from action string
Modules now no longer need to manually parse the action string and
extract data from it.
2020-11-26 20:53:53 +01:00
patrick96
ae2350167b actions: Switch all modules over to new system
All modules now expose their actions as public static constants

Issues: The menu module no longer closes when an item is clicked (before
it would intercept any executed command and look if it matches one of
its exec commands)
2020-11-26 20:53:53 +01:00
patrick96
d592eea966 refactor: Move module type string into modules
This allows us to identify module by their type and it is also better to
store the module type as part of the module instead of having it
hardcoded in factory.hpp
2020-11-26 20:53:53 +01:00
patrick96
4b5007294b refactor(modules): Make all modules input handlers
By default they will return false for calls to `input`
2020-11-26 20:53:53 +01:00
Michael Carlberg
e0688307f3 wip(systray): Add module base 2017-01-01 21:28:28 +01:00