fix: Wrap format pre/suffix within cmd
This commit is contained in:
parent
1a48f825d1
commit
3854515521
@ -55,7 +55,7 @@ class builder {
|
|||||||
void underline(const string& color = "");
|
void underline(const string& color = "");
|
||||||
void underline_close();
|
void underline_close();
|
||||||
void cmd(mousebtn index, string action, bool condition = true);
|
void cmd(mousebtn index, string action, bool condition = true);
|
||||||
void cmd_close();
|
void cmd_close(bool condition = true);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
string background_hex();
|
string background_hex();
|
||||||
|
@ -503,8 +503,10 @@ void builder::cmd(mousebtn index, string action, bool condition) {
|
|||||||
/**
|
/**
|
||||||
* Close command tag
|
* Close command tag
|
||||||
*/
|
*/
|
||||||
void builder::cmd_close() {
|
void builder::cmd_close(bool condition) {
|
||||||
|
if (condition) {
|
||||||
tag_close(syntaxtag::A);
|
tag_close(syntaxtag::A);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,6 +39,11 @@ namespace modules {
|
|||||||
* Wrap the output with defined mouse actions
|
* Wrap the output with defined mouse actions
|
||||||
*/
|
*/
|
||||||
string ipc_module::get_output() {
|
string ipc_module::get_output() {
|
||||||
|
// Get the module output early so that
|
||||||
|
// the format prefix/suffix also gets wrapper
|
||||||
|
// with the cmd handlers
|
||||||
|
string output{module::get_output()};
|
||||||
|
|
||||||
if (!m_actions[mousebtn::LEFT].empty()) {
|
if (!m_actions[mousebtn::LEFT].empty()) {
|
||||||
m_builder->cmd(mousebtn::LEFT, m_actions[mousebtn::LEFT]);
|
m_builder->cmd(mousebtn::LEFT, m_actions[mousebtn::LEFT]);
|
||||||
}
|
}
|
||||||
@ -55,7 +60,7 @@ namespace modules {
|
|||||||
m_builder->cmd(mousebtn::SCROLL_DOWN, m_actions[mousebtn::SCROLL_DOWN]);
|
m_builder->cmd(mousebtn::SCROLL_DOWN, m_actions[mousebtn::SCROLL_DOWN]);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_builder->append(module::get_output());
|
m_builder->append(output);
|
||||||
|
|
||||||
return m_builder->flush();
|
return m_builder->flush();
|
||||||
}
|
}
|
||||||
|
@ -123,13 +123,17 @@ namespace modules {
|
|||||||
m_output += m_ellipsis ? "..." : "";
|
m_output += m_ellipsis ? "..." : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
auto counter_str = to_string(m_counter);
|
auto counter_str = to_string(m_counter);
|
||||||
|
string output{module::get_output()};
|
||||||
|
|
||||||
OUTPUT_ACTION(mousebtn::LEFT);
|
OUTPUT_ACTION(mousebtn::LEFT);
|
||||||
OUTPUT_ACTION(mousebtn::MIDDLE);
|
OUTPUT_ACTION(mousebtn::MIDDLE);
|
||||||
OUTPUT_ACTION(mousebtn::RIGHT);
|
OUTPUT_ACTION(mousebtn::RIGHT);
|
||||||
OUTPUT_ACTION(mousebtn::SCROLL_UP);
|
OUTPUT_ACTION(mousebtn::SCROLL_UP);
|
||||||
OUTPUT_ACTION(mousebtn::SCROLL_DOWN);
|
OUTPUT_ACTION(mousebtn::SCROLL_DOWN);
|
||||||
m_builder->append(module::get_output());
|
|
||||||
|
m_builder->append(output);
|
||||||
|
|
||||||
return m_builder->flush();
|
return m_builder->flush();
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,11 @@ namespace modules {
|
|||||||
}
|
}
|
||||||
|
|
||||||
string text_module::get_output() {
|
string text_module::get_output() {
|
||||||
|
// Get the module output early so that
|
||||||
|
// the format prefix/suffix also gets wrapper
|
||||||
|
// with the cmd handlers
|
||||||
|
string output{module::get_output()};
|
||||||
|
|
||||||
auto click_left = m_conf.get<string>(name(), "click-left", "");
|
auto click_left = m_conf.get<string>(name(), "click-left", "");
|
||||||
auto click_middle = m_conf.get<string>(name(), "click-middle", "");
|
auto click_middle = m_conf.get<string>(name(), "click-middle", "");
|
||||||
auto click_right = m_conf.get<string>(name(), "click-right", "");
|
auto click_right = m_conf.get<string>(name(), "click-right", "");
|
||||||
@ -47,7 +52,7 @@ namespace modules {
|
|||||||
m_builder->cmd(mousebtn::SCROLL_DOWN, scroll_down);
|
m_builder->cmd(mousebtn::SCROLL_DOWN, scroll_down);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_builder->append(module::get_output());
|
m_builder->append(output);
|
||||||
|
|
||||||
return m_builder->flush();
|
return m_builder->flush();
|
||||||
}
|
}
|
||||||
|
@ -174,16 +174,16 @@ namespace modules {
|
|||||||
}
|
}
|
||||||
|
|
||||||
string volume_module::get_output() {
|
string volume_module::get_output() {
|
||||||
|
// Get the module output early so that
|
||||||
|
// the format prefix/suffix also gets wrapper
|
||||||
|
// with the cmd handlers
|
||||||
|
string output{module::get_output()};
|
||||||
|
|
||||||
m_builder->cmd(mousebtn::LEFT, EVENT_TOGGLE_MUTE);
|
m_builder->cmd(mousebtn::LEFT, EVENT_TOGGLE_MUTE);
|
||||||
|
m_builder->cmd(mousebtn::SCROLL_UP, EVENT_VOLUME_UP, !m_muted && m_volume < 100);
|
||||||
|
m_builder->cmd(mousebtn::SCROLL_DOWN, EVENT_VOLUME_DOWN, !m_muted && m_volume > 0);
|
||||||
|
|
||||||
if (!m_muted && m_volume < 100) {
|
m_builder->append(output);
|
||||||
m_builder->cmd(mousebtn::SCROLL_UP, EVENT_VOLUME_UP);
|
|
||||||
}
|
|
||||||
if (!m_muted && m_volume > 0) {
|
|
||||||
m_builder->cmd(mousebtn::SCROLL_DOWN, EVENT_VOLUME_DOWN);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_builder->append(module::get_output());
|
|
||||||
|
|
||||||
return m_builder->flush();
|
return m_builder->flush();
|
||||||
}
|
}
|
||||||
|
@ -137,14 +137,15 @@ namespace modules {
|
|||||||
* Generate the module output
|
* Generate the module output
|
||||||
*/
|
*/
|
||||||
string xbacklight_module::get_output() {
|
string xbacklight_module::get_output() {
|
||||||
if (m_scroll && m_percentage < 100) {
|
// Get the module output early so that
|
||||||
m_builder->cmd(mousebtn::SCROLL_UP, EVENT_SCROLLUP);
|
// the format prefix/suffix also gets wrapper
|
||||||
}
|
// with the cmd handlers
|
||||||
if (m_scroll && m_percentage > 0) {
|
string output{module::get_output()};
|
||||||
m_builder->cmd(mousebtn::SCROLL_DOWN, EVENT_SCROLLDOWN);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_builder->append(static_module::get_output());
|
m_builder->cmd(mousebtn::SCROLL_UP, EVENT_SCROLLUP, m_scroll && m_percentage < 100);
|
||||||
|
m_builder->cmd(mousebtn::SCROLL_DOWN, EVENT_SCROLLDOWN, m_scroll && m_percentage > 0);
|
||||||
|
|
||||||
|
m_builder->append(output);
|
||||||
|
|
||||||
return m_builder->flush();
|
return m_builder->flush();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user