mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
21 lines
629 B
C++
21 lines
629 B
C++
#include "factory.hpp"
|
|
|
|
waybar::Factory::Factory(Bar &bar, Json::Value config)
|
|
: _bar(bar), _config(config)
|
|
{}
|
|
|
|
waybar::IModule &waybar::Factory::makeModule(std::string name)
|
|
{
|
|
if (name == "battery")
|
|
return *new waybar::modules::Battery(_config[name]);
|
|
if (name == "workspaces")
|
|
return *new waybar::modules::Workspaces(_bar);
|
|
if (name == "memory")
|
|
return *new waybar::modules::Memory(_config[name]);
|
|
if (name == "cpu")
|
|
return *new waybar::modules::Cpu(_config[name]);
|
|
if (name == "clock")
|
|
return *new waybar::modules::Clock(_config[name]);
|
|
throw std::runtime_error("Unknown module: " + name);
|
|
}
|