polybar/include/modules
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
..
meta module: Implement action router (#2336) 2021-01-04 10:25:52 +01:00
alsa.hpp module: Implement action router (#2336) 2021-01-04 10:25:52 +01:00
backlight.hpp module: Implement action router (#2336) 2021-01-04 10:25:52 +01:00
battery.hpp feat: Warn state for cpu, memory, fs, battery modules (#2199) 2020-12-02 15:55:13 +01:00
bspwm.hpp module: Implement action router (#2336) 2021-01-04 10:25:52 +01:00
counter.hpp refactor: Move module type string into modules 2020-11-26 20:53:53 +01:00
cpu.hpp feat: Warn state for cpu, memory, fs, battery modules (#2199) 2020-12-02 15:55:13 +01:00
date.hpp module: Implement action router (#2336) 2021-01-04 10:25:52 +01:00
fs.hpp feat: Warn state for cpu, memory, fs, battery modules (#2199) 2020-12-02 15:55:13 +01:00
github.hpp refactor: Move module type string into modules 2020-11-26 20:53:53 +01:00
i3.hpp module: Implement action router (#2336) 2021-01-04 10:25:52 +01:00
ipc.hpp refactor: Move module type string into modules 2020-11-26 20:53:53 +01:00
memory.hpp feat: Warn state for cpu, memory, fs, battery modules (#2199) 2020-12-02 15:55:13 +01:00
menu.hpp module: Implement action router (#2336) 2021-01-04 10:25:52 +01:00
mpd.hpp module: Implement action router (#2336) 2021-01-04 10:25:52 +01:00
network.hpp feat(network): Ability to change speed unit text (B/s) (#2068) 2020-11-29 14:15:27 +01:00
pulseaudio.hpp module: Implement action router (#2336) 2021-01-04 10:25:52 +01:00
script.hpp refactor: Move module type string into modules 2020-11-26 20:53:53 +01:00
systray.hpp module: Implement action router (#2336) 2021-01-04 10:25:52 +01:00
temperature.hpp feat: Warn state for cpu, memory, fs, battery modules (#2199) 2020-12-02 15:55:13 +01:00
text.hpp refactor: Move module type string into modules 2020-11-26 20:53:53 +01:00
unsupported.hpp feat: Module Visibility (#2320) 2020-12-27 16:05:26 +01:00
xbacklight.hpp module: Implement action router (#2336) 2021-01-04 10:25:52 +01:00
xkeyboard.hpp module: Implement action router (#2336) 2021-01-04 10:25:52 +01:00
xwindow.hpp refactor: Move module type string into modules 2020-11-26 20:53:53 +01:00
xworkspaces.hpp module: Implement action router (#2336) 2021-01-04 10:25:52 +01:00