feat: basic config file

This commit is contained in:
Alexis
2018-08-09 12:05:48 +02:00
parent 4cec0f390b
commit 39a0ae04a8
18 changed files with 176 additions and 61 deletions

20
src/factory.cpp Normal file
View File

@ -0,0 +1,20 @@
#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();
if (name == "workspaces")
return *new waybar::modules::Workspaces(_bar);
if (name == "memory")
return *new waybar::modules::Memory();
if (name == "cpu")
return *new waybar::modules::Cpu();
if (name == "clock")
return *new waybar::modules::Clock();
throw std::runtime_error("Unknown module: " + name);
}