From 149c1c2f1b8b4c23f3bc7ea70d9cd503f29d9f31 Mon Sep 17 00:00:00 2001 From: Joshua Chapman Date: Sun, 31 Jan 2021 11:33:17 +0100 Subject: [PATCH 1/2] Update waybar-bluetooth.5.scd Remove the `status` from the `tooltip-format` example since it will throw error. Related to #685 --- man/waybar-bluetooth.5.scd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/waybar-bluetooth.5.scd b/man/waybar-bluetooth.5.scd index 8151ec01..5d7d7dd5 100644 --- a/man/waybar-bluetooth.5.scd +++ b/man/waybar-bluetooth.5.scd @@ -85,7 +85,7 @@ Addressed by *bluetooth* "enabled": "", "disabled": "" }, - "tooltip-format": "{status}" + "tooltip-format": "{}" } ``` From 3881af4bbe6412248ac5dc72e55865ae755ee833 Mon Sep 17 00:00:00 2001 From: jgmdev Date: Sun, 31 Jan 2021 15:37:26 -0400 Subject: [PATCH 2/2] Improved wlr/taskbar icon search. --- src/modules/wlr/taskbar.cpp | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/modules/wlr/taskbar.cpp b/src/modules/wlr/taskbar.cpp index 4cbb8ce6..83ce3662 100644 --- a/src/modules/wlr/taskbar.cpp +++ b/src/modules/wlr/taskbar.cpp @@ -26,19 +26,19 @@ const std::string WHITESPACE = " \n\r\t\f\v"; static std::string ltrim(const std::string& s) { - size_t start = s.find_first_not_of(WHITESPACE); - return (start == std::string::npos) ? "" : s.substr(start); + size_t start = s.find_first_not_of(WHITESPACE); + return (start == std::string::npos) ? "" : s.substr(start); } static std::string rtrim(const std::string& s) { - size_t end = s.find_last_not_of(WHITESPACE); - return (end == std::string::npos) ? "" : s.substr(0, end + 1); + size_t end = s.find_last_not_of(WHITESPACE); + return (end == std::string::npos) ? "" : s.substr(0, end + 1); } static std::string trim(const std::string& s) { - return rtrim(ltrim(s)); + return rtrim(ltrim(s)); } @@ -103,8 +103,8 @@ static std::string get_from_desktop_app_info(const std::string &app_id) /* Method 2 - use the app_id and check whether there is an icon with this name in the icon theme */ static std::string get_from_icon_theme(const Glib::RefPtr& icon_theme, - const std::string &app_id) { - + const std::string &app_id) +{ if (icon_theme->lookup_icon(app_id, 24)) return app_id; @@ -122,6 +122,10 @@ static bool image_load_icon(Gtk::Image& image, const Glib::RefPtr> app_id) { + size_t start = 0, end = app_id.size(); + start = app_id.rfind(".", end); + std::string app_name = app_id.substr(start+1, app_id.size()); + auto lower_app_id = app_id; std::transform(lower_app_id.begin(), lower_app_id.end(), lower_app_id.begin(), [](char c){ return std::tolower(c); }); @@ -130,10 +134,14 @@ static bool image_load_icon(Gtk::Image& image, const Glib::RefPtr