1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2024-11-11 13:50:56 -05:00
Commit graph

11 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
julio-b
751c21cd37 feat(pulse): Show volume in decibels (#1894)
Adds `%decibels%` token to the pulseaudio module
2019-10-09 02:13:57 +02:00
NBonaparte
fba87227c7 feat(pulseaudio): add volume interval option 2018-08-07 11:52:38 +02:00
patrick96
3ea60ace91 fix(pulse): Use distinct event names
volup, voldow, volmute, are caught by the alsa module, if there is an
alsa module on the bar.
2018-03-27 11:28:54 -07:00
NBonaparte
8be5427c33 refactor(pulseaudio): remove headphone ramp 2018-01-20 12:37:41 -08:00
NBonaparte
6e8b9dea29 fix(pulseaudio): Move pulseaudio to separate module 2018-01-20 12:37:41 -08:00