From 7429d1f9cc394a20c8d027841a171dd537be5711 Mon Sep 17 00:00:00 2001 From: Till Smejkal Date: Wed, 24 Jun 2020 09:36:28 +0200 Subject: [PATCH 1/2] Fix click events for the taskbar module When only the option 'on-click-right' was set and no other 'on-click' option than the taskbar module wouldn't register for click events and hence those events were handled by the generic AModule::on-click code. This code would try to start a shell with the specified command, which wouldn't make any sense in this circumstances. The taskbar code falsely checked for the 'on-click-left' option instead for the 'on-click-right' when deciding to register for click events. --- src/modules/wlr/taskbar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/wlr/taskbar.cpp b/src/modules/wlr/taskbar.cpp index 845f07c4..361eddcf 100644 --- a/src/modules/wlr/taskbar.cpp +++ b/src/modules/wlr/taskbar.cpp @@ -214,7 +214,7 @@ Task::Task(const waybar::Bar &bar, const Json::Value &config, Taskbar *tbar, /* Handle click events if configured */ if (config_["on-click"].isString() || config_["on-click-middle"].isString() - || config_["on-click-left"].isString()) { + || config_["on-click-right"].isString()) { button_.add_events(Gdk::BUTTON_PRESS_MASK); button_.signal_button_press_event().connect( sigc::mem_fun(*this, &Task::handle_clicked), false); From b7a8e8e5443ffc95811db405a2c7c57d801fafc3 Mon Sep 17 00:00:00 2001 From: Till Smejkal Date: Wed, 24 Jun 2020 09:47:34 +0200 Subject: [PATCH 2/2] Fix format option for the taskbar module When using additional format options in addition to {icon} the format is separated into text before and text after the icon. Each of the texts is displayed in a separate label one before and one after the image for the icon. The code updating the labels on changes used the wrong format strings when updating the label after the icon. --- src/modules/wlr/taskbar.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/wlr/taskbar.cpp b/src/modules/wlr/taskbar.cpp index 361eddcf..f5889702 100644 --- a/src/modules/wlr/taskbar.cpp +++ b/src/modules/wlr/taskbar.cpp @@ -187,7 +187,7 @@ Task::Task(const waybar::Bar &bar, const Json::Value &config, Taskbar *tbar, with_icon_ = true; format_after_ = format.substr(6); } else if (icon_pos == std::string::npos) { - format_after_ = format; + format_before_ = format; } else { with_icon_ = true; format_before_ = format.substr(0, icon_pos); @@ -421,7 +421,7 @@ void Task::update() } if (!format_after_.empty()) { text_after_.set_label( - fmt::format(format_before_, + fmt::format(format_after_, fmt::arg("title", title_), fmt::arg("app_id", app_id_), fmt::arg("state", state_string()),