parent
38f9ba81cd
commit
88c8bbd940
32 changed files with 110 additions and 84 deletions
include
components
modules
src
|
@ -4,7 +4,6 @@
|
||||||
#include "components/config.hpp"
|
#include "components/config.hpp"
|
||||||
#include "components/types.hpp"
|
#include "components/types.hpp"
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
#include "drawtypes/label.hpp"
|
|
||||||
|
|
||||||
POLYBAR_NS
|
POLYBAR_NS
|
||||||
|
|
||||||
|
@ -14,6 +13,14 @@ POLYBAR_NS
|
||||||
#define BUILDER_SPACE_TOKEN "%__"
|
#define BUILDER_SPACE_TOKEN "%__"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// fwd decl
|
||||||
|
namespace drawtypes {
|
||||||
|
class label;
|
||||||
|
using label_t = shared_ptr<label>;
|
||||||
|
using icon = label;
|
||||||
|
using icon_t = label_t;
|
||||||
|
}
|
||||||
|
|
||||||
using namespace drawtypes;
|
using namespace drawtypes;
|
||||||
|
|
||||||
class builder {
|
class builder {
|
||||||
|
|
|
@ -2,9 +2,6 @@
|
||||||
|
|
||||||
#include "components/config.hpp"
|
#include "components/config.hpp"
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
#include "drawtypes/label.hpp"
|
|
||||||
#include "drawtypes/progressbar.hpp"
|
|
||||||
#include "drawtypes/ramp.hpp"
|
|
||||||
#include "modules/meta.hpp"
|
#include "modules/meta.hpp"
|
||||||
|
|
||||||
POLYBAR_NS
|
POLYBAR_NS
|
||||||
|
|
|
@ -2,14 +2,7 @@
|
||||||
|
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
#include "drawtypes/animation.hpp"
|
|
||||||
#include "drawtypes/label.hpp"
|
|
||||||
#include "drawtypes/progressbar.hpp"
|
|
||||||
#include "drawtypes/ramp.hpp"
|
|
||||||
#include "modules/meta.hpp"
|
#include "modules/meta.hpp"
|
||||||
#include "utils/file.hpp"
|
|
||||||
#include "utils/inotify.hpp"
|
|
||||||
#include "utils/string.hpp"
|
|
||||||
|
|
||||||
POLYBAR_NS
|
POLYBAR_NS
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "drawtypes/iconset.hpp"
|
|
||||||
#include "drawtypes/label.hpp"
|
|
||||||
#include "modules/meta.hpp"
|
#include "modules/meta.hpp"
|
||||||
#include "utils/bspwm.hpp"
|
#include "utils/bspwm.hpp"
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
|
|
||||||
POLYBAR_NS
|
POLYBAR_NS
|
||||||
|
|
||||||
using namespace drawtypes;
|
|
||||||
|
|
||||||
namespace modules {
|
namespace modules {
|
||||||
class counter_module : public timer_module<counter_module> {
|
class counter_module : public timer_module<counter_module> {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -3,9 +3,6 @@
|
||||||
#include <istream>
|
#include <istream>
|
||||||
|
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
#include "drawtypes/label.hpp"
|
|
||||||
#include "drawtypes/progressbar.hpp"
|
|
||||||
#include "drawtypes/ramp.hpp"
|
|
||||||
#include "modules/meta.hpp"
|
#include "modules/meta.hpp"
|
||||||
|
|
||||||
POLYBAR_NS
|
POLYBAR_NS
|
||||||
|
|
|
@ -2,9 +2,6 @@
|
||||||
|
|
||||||
#include "components/config.hpp"
|
#include "components/config.hpp"
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
#include "drawtypes/label.hpp"
|
|
||||||
#include "drawtypes/progressbar.hpp"
|
|
||||||
#include "drawtypes/ramp.hpp"
|
|
||||||
#include "modules/meta.hpp"
|
#include "modules/meta.hpp"
|
||||||
|
|
||||||
POLYBAR_NS
|
POLYBAR_NS
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
|
|
||||||
#include "components/config.hpp"
|
#include "components/config.hpp"
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
#include "drawtypes/iconset.hpp"
|
|
||||||
#include "drawtypes/label.hpp"
|
|
||||||
#include "modules/meta.hpp"
|
#include "modules/meta.hpp"
|
||||||
#include "utils/i3.hpp"
|
#include "utils/i3.hpp"
|
||||||
#include "utils/io.hpp"
|
#include "utils/io.hpp"
|
||||||
|
@ -31,9 +29,7 @@ namespace modules {
|
||||||
i3_workspace(int index_, i3_flag flag_, label_t&& label_)
|
i3_workspace(int index_, i3_flag flag_, label_t&& label_)
|
||||||
: index(index_), flag(flag_), label(forward<decltype(label_)>(label_)) {}
|
: index(index_), flag(flag_), label(forward<decltype(label_)>(label_)) {}
|
||||||
|
|
||||||
operator bool() {
|
operator bool();
|
||||||
return label && *label;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
using i3_workspace_t = unique_ptr<i3_workspace>;
|
using i3_workspace_t = unique_ptr<i3_workspace>;
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
#include <istream>
|
#include <istream>
|
||||||
|
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
#include "drawtypes/label.hpp"
|
|
||||||
#include "drawtypes/progressbar.hpp"
|
|
||||||
#include "modules/meta.hpp"
|
#include "modules/meta.hpp"
|
||||||
|
|
||||||
POLYBAR_NS
|
POLYBAR_NS
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "drawtypes/label.hpp"
|
|
||||||
#include "modules/meta.hpp"
|
#include "modules/meta.hpp"
|
||||||
|
|
||||||
POLYBAR_NS
|
POLYBAR_NS
|
||||||
|
|
|
@ -20,6 +20,22 @@ POLYBAR_NS
|
||||||
#define CONST_MOD(name) static_cast<name const&>(*this)
|
#define CONST_MOD(name) static_cast<name const&>(*this)
|
||||||
#define CAST_MOD(name) static_cast<name*>(this)
|
#define CAST_MOD(name) static_cast<name*>(this)
|
||||||
|
|
||||||
|
// fwd decl
|
||||||
|
namespace drawtypes {
|
||||||
|
class label;
|
||||||
|
using label_t = shared_ptr<label>;
|
||||||
|
class ramp;
|
||||||
|
using ramp_t = shared_ptr<ramp>;
|
||||||
|
class progressbar;
|
||||||
|
using progressbar_t = shared_ptr<progressbar>;
|
||||||
|
class animation;
|
||||||
|
using animation_t = shared_ptr<animation>;
|
||||||
|
using icon = label;
|
||||||
|
using icon_t = label_t;
|
||||||
|
class iconset;
|
||||||
|
using iconset_t = shared_ptr<iconset>;
|
||||||
|
}
|
||||||
|
|
||||||
namespace modules {
|
namespace modules {
|
||||||
using namespace drawtypes;
|
using namespace drawtypes;
|
||||||
|
|
||||||
|
@ -81,8 +97,7 @@ namespace modules {
|
||||||
|
|
||||||
class module_formatter {
|
class module_formatter {
|
||||||
public:
|
public:
|
||||||
explicit module_formatter(const config& conf, string modname)
|
explicit module_formatter(const config& conf, string modname) : m_conf(conf), m_modname(modname) {}
|
||||||
: m_conf(conf), m_modname(modname) {}
|
|
||||||
|
|
||||||
void add(string name, string fallback, vector<string>&& tags, vector<string>&& whitelist = {}) {
|
void add(string name, string fallback, vector<string>&& tags, vector<string>&& whitelist = {}) {
|
||||||
auto format = make_unique<module_format>();
|
auto format = make_unique<module_format>();
|
||||||
|
@ -495,8 +510,7 @@ namespace modules {
|
||||||
}
|
}
|
||||||
} catch (const system_error& e) {
|
} catch (const system_error& e) {
|
||||||
watches.clear();
|
watches.clear();
|
||||||
this->m_log.err(
|
this->m_log.err("%s: Error while creating inotify watch (what: %s)", CONST_MOD(Impl).name(), e.what());
|
||||||
"%s: Error while creating inotify watch (what: %s)", CONST_MOD(Impl).name(), e.what());
|
|
||||||
CAST_MOD(Impl)->sleep(0.1s);
|
CAST_MOD(Impl)->sleep(0.1s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,6 @@
|
||||||
#include <csignal>
|
#include <csignal>
|
||||||
|
|
||||||
#include "adapters/mpd.hpp"
|
#include "adapters/mpd.hpp"
|
||||||
#include "drawtypes/iconset.hpp"
|
|
||||||
#include "drawtypes/label.hpp"
|
|
||||||
#include "drawtypes/progressbar.hpp"
|
|
||||||
#include "modules/meta.hpp"
|
#include "modules/meta.hpp"
|
||||||
#include "utils/threading.hpp"
|
#include "utils/threading.hpp"
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
|
|
||||||
#include "adapters/net.hpp"
|
#include "adapters/net.hpp"
|
||||||
#include "components/config.hpp"
|
#include "components/config.hpp"
|
||||||
#include "drawtypes/animation.hpp"
|
|
||||||
#include "drawtypes/animation.hpp"
|
|
||||||
#include "drawtypes/label.hpp"
|
|
||||||
#include "drawtypes/ramp.hpp"
|
|
||||||
#include "modules/meta.hpp"
|
#include "modules/meta.hpp"
|
||||||
|
|
||||||
POLYBAR_NS
|
POLYBAR_NS
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
#include <istream>
|
#include <istream>
|
||||||
|
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
#include "drawtypes/label.hpp"
|
|
||||||
#include "drawtypes/ramp.hpp"
|
|
||||||
#include "modules/meta.hpp"
|
#include "modules/meta.hpp"
|
||||||
|
|
||||||
POLYBAR_NS
|
POLYBAR_NS
|
||||||
|
|
|
@ -3,9 +3,6 @@
|
||||||
#include "adapters/alsa.hpp"
|
#include "adapters/alsa.hpp"
|
||||||
#include "components/config.hpp"
|
#include "components/config.hpp"
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
#include "drawtypes/label.hpp"
|
|
||||||
#include "drawtypes/progressbar.hpp"
|
|
||||||
#include "drawtypes/ramp.hpp"
|
|
||||||
#include "modules/meta.hpp"
|
#include "modules/meta.hpp"
|
||||||
|
|
||||||
POLYBAR_NS
|
POLYBAR_NS
|
||||||
|
|
|
@ -5,9 +5,6 @@
|
||||||
#include "x11/randr.hpp"
|
#include "x11/randr.hpp"
|
||||||
#include "x11/xutils.hpp"
|
#include "x11/xutils.hpp"
|
||||||
#include "config.hpp"
|
#include "config.hpp"
|
||||||
#include "drawtypes/label.hpp"
|
|
||||||
#include "drawtypes/progressbar.hpp"
|
|
||||||
#include "drawtypes/ramp.hpp"
|
|
||||||
#include "modules/meta.hpp"
|
#include "modules/meta.hpp"
|
||||||
|
|
||||||
POLYBAR_NS
|
POLYBAR_NS
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
|
|
||||||
#include "components/config.hpp"
|
#include "components/config.hpp"
|
||||||
#include "drawtypes/label.hpp"
|
|
||||||
#include "modules/meta.hpp"
|
#include "modules/meta.hpp"
|
||||||
#include "x11/connection.hpp"
|
#include "x11/connection.hpp"
|
||||||
#include "x11/ewmh.hpp"
|
#include "x11/ewmh.hpp"
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
#include "components/builder.hpp"
|
#include "components/builder.hpp"
|
||||||
|
|
||||||
|
#include "drawtypes/label.hpp"
|
||||||
#include "utils/math.hpp"
|
#include "utils/math.hpp"
|
||||||
#include "utils/string.hpp"
|
#include "utils/string.hpp"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
#include "modules/backlight.hpp"
|
#include "modules/backlight.hpp"
|
||||||
|
#include "drawtypes/label.hpp"
|
||||||
|
#include "drawtypes/progressbar.hpp"
|
||||||
|
#include "drawtypes/ramp.hpp"
|
||||||
#include "utils/file.hpp"
|
#include "utils/file.hpp"
|
||||||
|
|
||||||
POLYBAR_NS
|
POLYBAR_NS
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
#include "modules/battery.hpp"
|
#include "modules/battery.hpp"
|
||||||
|
#include "drawtypes/animation.hpp"
|
||||||
|
#include "drawtypes/label.hpp"
|
||||||
|
#include "drawtypes/progressbar.hpp"
|
||||||
|
#include "drawtypes/ramp.hpp"
|
||||||
|
#include "utils/file.hpp"
|
||||||
#include "utils/math.hpp"
|
#include "utils/math.hpp"
|
||||||
|
|
||||||
POLYBAR_NS
|
POLYBAR_NS
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
#include "modules/bspwm.hpp"
|
#include "modules/bspwm.hpp"
|
||||||
|
|
||||||
|
#include "drawtypes/iconset.hpp"
|
||||||
|
#include "drawtypes/label.hpp"
|
||||||
|
|
||||||
POLYBAR_NS
|
POLYBAR_NS
|
||||||
|
|
||||||
namespace modules {
|
namespace modules {
|
||||||
|
@ -31,14 +34,14 @@ namespace modules {
|
||||||
m_statelabels.insert(
|
m_statelabels.insert(
|
||||||
make_pair(state_ws::WORKSPACE_EMPTY, load_optional_label(m_conf, name(), "label-empty", DEFAULT_WS_LABEL)));
|
make_pair(state_ws::WORKSPACE_EMPTY, load_optional_label(m_conf, name(), "label-empty", DEFAULT_WS_LABEL)));
|
||||||
m_statelabels.insert(make_pair(state_ws::WORKSPACE_DIMMED, load_optional_label(m_conf, name(), "label-dimmed")));
|
m_statelabels.insert(make_pair(state_ws::WORKSPACE_DIMMED, load_optional_label(m_conf, name(), "label-dimmed")));
|
||||||
m_statelabels.insert(make_pair(
|
m_statelabels.insert(
|
||||||
state_ws::WORKSPACE_DIMMED_ACTIVE, load_optional_label(m_conf, name(), "label-dimmed-active")));
|
make_pair(state_ws::WORKSPACE_DIMMED_ACTIVE, load_optional_label(m_conf, name(), "label-dimmed-active")));
|
||||||
m_statelabels.insert(make_pair(
|
m_statelabels.insert(
|
||||||
state_ws::WORKSPACE_DIMMED_URGENT, load_optional_label(m_conf, name(), "label-dimmed-urgent")));
|
make_pair(state_ws::WORKSPACE_DIMMED_URGENT, load_optional_label(m_conf, name(), "label-dimmed-urgent")));
|
||||||
m_statelabels.insert(make_pair(
|
m_statelabels.insert(
|
||||||
state_ws::WORKSPACE_DIMMED_EMPTY, load_optional_label(m_conf, name(), "label-dimmed-empty")));
|
make_pair(state_ws::WORKSPACE_DIMMED_EMPTY, load_optional_label(m_conf, name(), "label-dimmed-empty")));
|
||||||
m_statelabels.insert(make_pair(
|
m_statelabels.insert(
|
||||||
state_ws::WORKSPACE_DIMMED_OCCUPIED, load_optional_label(m_conf, name(), "label-dimmed-occupied")));
|
make_pair(state_ws::WORKSPACE_DIMMED_OCCUPIED, load_optional_label(m_conf, name(), "label-dimmed-occupied")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_formatter->has(TAG_LABEL_MODE)) {
|
if (m_formatter->has(TAG_LABEL_MODE)) {
|
||||||
|
@ -257,20 +260,20 @@ namespace modules {
|
||||||
if (!m_monitors.back()->focused) {
|
if (!m_monitors.back()->focused) {
|
||||||
label->replace_defined_values(m_statelabels.find(state_ws::WORKSPACE_DIMMED)->second);
|
label->replace_defined_values(m_statelabels.find(state_ws::WORKSPACE_DIMMED)->second);
|
||||||
switch (workspace_flag) {
|
switch (workspace_flag) {
|
||||||
case state_ws::WORKSPACE_ACTIVE:
|
case state_ws::WORKSPACE_ACTIVE:
|
||||||
label->replace_defined_values(m_statelabels.find(state_ws::WORKSPACE_DIMMED_ACTIVE)->second);
|
label->replace_defined_values(m_statelabels.find(state_ws::WORKSPACE_DIMMED_ACTIVE)->second);
|
||||||
break;
|
break;
|
||||||
case state_ws::WORKSPACE_OCCUPIED:
|
case state_ws::WORKSPACE_OCCUPIED:
|
||||||
label->replace_defined_values(m_statelabels.find(state_ws::WORKSPACE_DIMMED_OCCUPIED)->second);
|
label->replace_defined_values(m_statelabels.find(state_ws::WORKSPACE_DIMMED_OCCUPIED)->second);
|
||||||
break;
|
break;
|
||||||
case state_ws::WORKSPACE_URGENT:
|
case state_ws::WORKSPACE_URGENT:
|
||||||
label->replace_defined_values(m_statelabels.find(state_ws::WORKSPACE_DIMMED_URGENT)->second);
|
label->replace_defined_values(m_statelabels.find(state_ws::WORKSPACE_DIMMED_URGENT)->second);
|
||||||
break;
|
break;
|
||||||
case state_ws::WORKSPACE_EMPTY:
|
case state_ws::WORKSPACE_EMPTY:
|
||||||
label->replace_defined_values(m_statelabels.find(state_ws::WORKSPACE_DIMMED_EMPTY)->second);
|
label->replace_defined_values(m_statelabels.find(state_ws::WORKSPACE_DIMMED_EMPTY)->second);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
#include "modules/cpu.hpp"
|
#include "modules/cpu.hpp"
|
||||||
|
#include "drawtypes/label.hpp"
|
||||||
|
#include "drawtypes/progressbar.hpp"
|
||||||
|
#include "drawtypes/ramp.hpp"
|
||||||
#include "utils/math.hpp"
|
#include "utils/math.hpp"
|
||||||
|
|
||||||
POLYBAR_NS
|
POLYBAR_NS
|
||||||
|
@ -7,8 +10,7 @@ namespace modules {
|
||||||
void cpu_module::setup() {
|
void cpu_module::setup() {
|
||||||
m_interval = chrono::duration<double>(m_conf.get<float>(name(), "interval", 1));
|
m_interval = chrono::duration<double>(m_conf.get<float>(name(), "interval", 1));
|
||||||
|
|
||||||
m_formatter->add(DEFAULT_FORMAT, TAG_LABEL,
|
m_formatter->add(DEFAULT_FORMAT, TAG_LABEL, {TAG_LABEL, TAG_BAR_LOAD, TAG_RAMP_LOAD, TAG_RAMP_LOAD_PER_CORE});
|
||||||
{TAG_LABEL, TAG_BAR_LOAD, TAG_RAMP_LOAD, TAG_RAMP_LOAD_PER_CORE});
|
|
||||||
|
|
||||||
if (m_formatter->has(TAG_BAR_LOAD))
|
if (m_formatter->has(TAG_BAR_LOAD))
|
||||||
m_barload = load_progressbar(m_bar, m_conf, name(), TAG_BAR_LOAD);
|
m_barload = load_progressbar(m_bar, m_conf, name(), TAG_BAR_LOAD);
|
||||||
|
@ -92,8 +94,8 @@ namespace modules {
|
||||||
m_cputimes.back()->nice = std::stoull(values[2].c_str(), 0, 10);
|
m_cputimes.back()->nice = std::stoull(values[2].c_str(), 0, 10);
|
||||||
m_cputimes.back()->system = std::stoull(values[3].c_str(), 0, 10);
|
m_cputimes.back()->system = std::stoull(values[3].c_str(), 0, 10);
|
||||||
m_cputimes.back()->idle = std::stoull(values[4].c_str(), 0, 10);
|
m_cputimes.back()->idle = std::stoull(values[4].c_str(), 0, 10);
|
||||||
m_cputimes.back()->total = m_cputimes.back()->user + m_cputimes.back()->nice +
|
m_cputimes.back()->total =
|
||||||
m_cputimes.back()->system + m_cputimes.back()->idle;
|
m_cputimes.back()->user + m_cputimes.back()->nice + m_cputimes.back()->system + m_cputimes.back()->idle;
|
||||||
}
|
}
|
||||||
} catch (const std::ios_base::failure& e) {
|
} catch (const std::ios_base::failure& e) {
|
||||||
m_log.err("Failed to read CPU values (what: %s)", e.what());
|
m_log.err("Failed to read CPU values (what: %s)", e.what());
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include <sys/statvfs.h>
|
#include <sys/statvfs.h>
|
||||||
|
|
||||||
|
#include "drawtypes/label.hpp"
|
||||||
|
#include "drawtypes/progressbar.hpp"
|
||||||
|
#include "drawtypes/ramp.hpp"
|
||||||
#include "modules/fs.hpp"
|
#include "modules/fs.hpp"
|
||||||
#include "utils/math.hpp"
|
#include "utils/math.hpp"
|
||||||
#include "utils/mtab.hpp"
|
#include "utils/mtab.hpp"
|
||||||
|
|
|
@ -2,9 +2,16 @@
|
||||||
|
|
||||||
#include "modules/i3.hpp"
|
#include "modules/i3.hpp"
|
||||||
|
|
||||||
|
#include "drawtypes/iconset.hpp"
|
||||||
|
#include "drawtypes/label.hpp"
|
||||||
|
|
||||||
POLYBAR_NS
|
POLYBAR_NS
|
||||||
|
|
||||||
namespace modules {
|
namespace modules {
|
||||||
|
i3_workspace::operator bool() {
|
||||||
|
return label && *label;
|
||||||
|
}
|
||||||
|
|
||||||
void i3_module::setup() { // {{{
|
void i3_module::setup() { // {{{
|
||||||
// Load configuration values
|
// Load configuration values
|
||||||
GET_CONFIG_VALUE(name(), m_click, "enable-click");
|
GET_CONFIG_VALUE(name(), m_click, "enable-click");
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
#include "modules/memory.hpp"
|
#include "modules/memory.hpp"
|
||||||
|
#include "drawtypes/label.hpp"
|
||||||
|
#include "drawtypes/progressbar.hpp"
|
||||||
|
|
||||||
POLYBAR_NS
|
POLYBAR_NS
|
||||||
|
|
||||||
|
@ -60,8 +62,8 @@ namespace modules {
|
||||||
m_label->reset_tokens();
|
m_label->reset_tokens();
|
||||||
|
|
||||||
auto replace_unit = [](label_t& label, string token, float value, string unit) {
|
auto replace_unit = [](label_t& label, string token, float value, string unit) {
|
||||||
auto formatted = string_util::from_stream(
|
auto formatted =
|
||||||
stringstream() << std::setprecision(2) << std::fixed << value << " " << unit);
|
string_util::from_stream(stringstream() << std::setprecision(2) << std::fixed << value << " " << unit);
|
||||||
label->replace_token(token, formatted);
|
label->replace_token(token, formatted);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
#include "modules/menu.hpp"
|
#include "modules/menu.hpp"
|
||||||
|
|
||||||
|
#include "drawtypes/label.hpp"
|
||||||
#include "utils/scope.hpp"
|
#include "utils/scope.hpp"
|
||||||
|
|
||||||
POLYBAR_NS
|
POLYBAR_NS
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
#include "modules/mpd.hpp"
|
#include "modules/mpd.hpp"
|
||||||
|
|
||||||
|
#include "drawtypes/iconset.hpp"
|
||||||
|
#include "drawtypes/label.hpp"
|
||||||
|
#include "drawtypes/progressbar.hpp"
|
||||||
|
|
||||||
POLYBAR_NS
|
POLYBAR_NS
|
||||||
|
|
||||||
using namespace mpd;
|
using namespace mpd;
|
||||||
|
@ -14,9 +18,9 @@ namespace modules {
|
||||||
// Add formats and elements {{{
|
// Add formats and elements {{{
|
||||||
|
|
||||||
m_formatter->add(FORMAT_ONLINE, TAG_LABEL_SONG,
|
m_formatter->add(FORMAT_ONLINE, TAG_LABEL_SONG,
|
||||||
{TAG_BAR_PROGRESS, TAG_TOGGLE, TAG_LABEL_SONG, TAG_LABEL_TIME, TAG_ICON_RANDOM,
|
{TAG_BAR_PROGRESS, TAG_TOGGLE, TAG_LABEL_SONG, TAG_LABEL_TIME, TAG_ICON_RANDOM, TAG_ICON_REPEAT,
|
||||||
TAG_ICON_REPEAT, TAG_ICON_REPEAT_ONE, TAG_ICON_PREV, TAG_ICON_STOP, TAG_ICON_PLAY,
|
TAG_ICON_REPEAT_ONE, TAG_ICON_PREV, TAG_ICON_STOP, TAG_ICON_PLAY, TAG_ICON_PAUSE, TAG_ICON_NEXT,
|
||||||
TAG_ICON_PAUSE, TAG_ICON_NEXT, TAG_ICON_SEEKB, TAG_ICON_SEEKF});
|
TAG_ICON_SEEKB, TAG_ICON_SEEKF});
|
||||||
|
|
||||||
m_formatter->add(FORMAT_OFFLINE, "", {TAG_LABEL_OFFLINE});
|
m_formatter->add(FORMAT_OFFLINE, "", {TAG_LABEL_OFFLINE});
|
||||||
|
|
||||||
|
@ -199,11 +203,9 @@ namespace modules {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_icons->has("random"))
|
if (m_icons->has("random"))
|
||||||
m_icons->get("random")->m_foreground =
|
m_icons->get("random")->m_foreground = m_status && m_status->random() ? m_toggle_on_color : m_toggle_off_color;
|
||||||
m_status && m_status->random() ? m_toggle_on_color : m_toggle_off_color;
|
|
||||||
if (m_icons->has("repeat"))
|
if (m_icons->has("repeat"))
|
||||||
m_icons->get("repeat")->m_foreground =
|
m_icons->get("repeat")->m_foreground = m_status && m_status->repeat() ? m_toggle_on_color : m_toggle_off_color;
|
||||||
m_status && m_status->repeat() ? m_toggle_on_color : m_toggle_off_color;
|
|
||||||
if (m_icons->has("repeat_one"))
|
if (m_icons->has("repeat_one"))
|
||||||
m_icons->get("repeat_one")->m_foreground =
|
m_icons->get("repeat_one")->m_foreground =
|
||||||
m_status && m_status->single() ? m_toggle_on_color : m_toggle_off_color;
|
m_status && m_status->single() ? m_toggle_on_color : m_toggle_off_color;
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
#include "modules/network.hpp"
|
#include "modules/network.hpp"
|
||||||
|
|
||||||
|
#include "drawtypes/animation.hpp"
|
||||||
|
#include "drawtypes/label.hpp"
|
||||||
|
#include "drawtypes/ramp.hpp"
|
||||||
|
|
||||||
POLYBAR_NS
|
POLYBAR_NS
|
||||||
|
|
||||||
namespace modules {
|
namespace modules {
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
#include "modules/temperature.hpp"
|
#include "modules/temperature.hpp"
|
||||||
|
|
||||||
|
#include "drawtypes/label.hpp"
|
||||||
|
#include "drawtypes/ramp.hpp"
|
||||||
#include "utils/file.hpp"
|
#include "utils/file.hpp"
|
||||||
#include "utils/math.hpp"
|
#include "utils/math.hpp"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
#include "modules/volume.hpp"
|
#include "modules/volume.hpp"
|
||||||
|
|
||||||
|
#include "drawtypes/label.hpp"
|
||||||
|
#include "drawtypes/progressbar.hpp"
|
||||||
|
#include "drawtypes/ramp.hpp"
|
||||||
#include "utils/math.hpp"
|
#include "utils/math.hpp"
|
||||||
|
|
||||||
POLYBAR_NS
|
POLYBAR_NS
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
#include "modules/xbacklight.hpp"
|
#include "modules/xbacklight.hpp"
|
||||||
|
|
||||||
|
#include "drawtypes/label.hpp"
|
||||||
|
#include "drawtypes/progressbar.hpp"
|
||||||
|
#include "drawtypes/ramp.hpp"
|
||||||
#include "utils/math.hpp"
|
#include "utils/math.hpp"
|
||||||
#include "x11/graphics.hpp"
|
#include "x11/graphics.hpp"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
#include "modules/xwindow.hpp"
|
#include "modules/xwindow.hpp"
|
||||||
|
|
||||||
|
#include "drawtypes/label.hpp"
|
||||||
#include "x11/atoms.hpp"
|
#include "x11/atoms.hpp"
|
||||||
#include "x11/graphics.hpp"
|
#include "x11/graphics.hpp"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue