1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2024-11-25 13:55:47 -05:00
polybar/include/modules/unsupported.hpp

55 lines
2.4 KiB
C++
Raw Normal View History

2016-10-11 04:05:03 -04:00
#pragma once
#if ENABLE_I3 && ENABLE_MPD && ENABLE_NETWORK && ENABLE_ALSA && ENABLE_CURL && ENABLE_XKEYBOARD
#error "Support has been enabled for all optional modules"
#endif
#include "modules/meta/base.hpp"
2016-11-25 07:55:15 -05:00
#include "modules/meta/base.inl"
POLYBAR_NS
2016-10-11 04:05:03 -04:00
namespace modules {
struct module_interface;
2016-10-11 04:05:03 -04:00
#define DEFINE_UNSUPPORTED_MODULE(MODULE_NAME, MODULE_TYPE) \
class MODULE_NAME : public module_interface { \
2016-10-11 04:05:03 -04:00
public: \
MODULE_NAME(const bar_settings, string) { \
2016-10-11 04:05:03 -04:00
throw application_error("No built-in support for '" + string{MODULE_TYPE} + "'"); \
} \
string name() const { \
return ""; \
} \
bool running() const { \
return false; \
} \
2016-10-11 04:05:03 -04:00
void start() {} \
void stop() {} \
void halt(string) {} \
string contents() { \
return ""; \
} \
2016-10-11 04:05:03 -04:00
}
#if not ENABLE_I3
DEFINE_UNSUPPORTED_MODULE(i3_module, "internal/i3");
#endif
#if not ENABLE_MPD
DEFINE_UNSUPPORTED_MODULE(mpd_module, "internal/mpd");
#endif
#if not ENABLE_NETWORK
DEFINE_UNSUPPORTED_MODULE(network_module, "internal/network");
#endif
#if not ENABLE_ALSA
DEFINE_UNSUPPORTED_MODULE(volume_module, "internal/volume");
#endif
#if not ENABLE_CURL
DEFINE_UNSUPPORTED_MODULE(github_module, "internal/github");
#endif
#if not ENABLE_XKEYBOARD
2016-11-30 08:26:11 -05:00
DEFINE_UNSUPPORTED_MODULE(xkeyboard_module, "internal/xkeyboard");
#endif
2016-10-11 04:05:03 -04:00
}
2016-11-19 00:22:44 -05:00
POLYBAR_NS_END