Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package waybar for openSUSE:Factory checked in at 2024-05-07 18:04:05 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/waybar (Old) and /work/SRC/openSUSE:Factory/.waybar.new.1880 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "waybar" Tue May 7 18:04:05 2024 rev:54 rq:1172319 version:0.10.3 Changes: -------- --- /work/SRC/openSUSE:Factory/waybar/waybar.changes 2024-04-25 20:48:08.639792547 +0200 +++ /work/SRC/openSUSE:Factory/.waybar.new.1880/waybar.changes 2024-05-07 18:04:43.881403366 +0200 @@ -1,0 +2,16 @@ +Tue May 7 02:56:52 UTC 2024 - Joshua Smith <[email protected]> + +- Update to 0.10.3 + * fix(battery): Fix {health} format replacement + * Cursor change to indicate module clickability + * upower: fix segfault by initializing lastWarningLevel + * Fix Hyprland socketpath changed to XDG_RUNTIME_DIR + * pipewire: unbreak build on FreeBSD + * fix: set cursor appropriately on user event hover + * fix: custom module mediaplayer doesn't respect argument + * feat: style tray icon on hover + * fix: tooltip-format on custom modules not working in some cases + * feat: hover for whole group + * Remove listener when the window is destroyed + +------------------------------------------------------------------- Old: ---- waybar-0.10.2.tar.gz New: ---- waybar-0.10.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ waybar.spec ++++++ --- /var/tmp/diff_new_pack.9uBEK3/_old 2024-05-07 18:04:44.501425911 +0200 +++ /var/tmp/diff_new_pack.9uBEK3/_new 2024-05-07 18:04:44.505426056 +0200 @@ -17,7 +17,7 @@ Name: waybar -Version: 0.10.2 +Version: 0.10.3 Release: 0 Summary: Customizable Wayland bar for Sway and Wlroots based compositors License: MIT ++++++ waybar-0.10.2.tar.gz -> waybar-0.10.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.10.2/.github/workflows/clang-tidy.yml new/Waybar-0.10.3/.github/workflows/clang-tidy.yml --- old/Waybar-0.10.2/.github/workflows/clang-tidy.yml 2024-04-23 17:59:08.000000000 +0200 +++ new/Waybar-0.10.3/.github/workflows/clang-tidy.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,39 +0,0 @@ -name: clang-tidy - -on: [push, pull_request] - -concurrency: - group: ${{ github.workflow }}-tidy-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - build: - runs-on: ubuntu-latest - container: - image: alexays/waybar:debian - steps: - - uses: actions/checkout@v3 - - name: configure - run: | - meson -Dcpp_std=c++20 build # necessary to generate compile_commands.json - ninja -C build # necessary to find certain .h files (xdg, wayland, etc.) - - uses: actions/setup-python@v5 - with: - python-version: '3.10' # to be kept in sync with cpp-linter-action - update-environment: true # the python dist installed by the action needs LD_LIBRARY_PATH to work - - uses: cpp-linter/[email protected] - name: clang-tidy - id: clang-tidy-check - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PIP_NO_CACHE_DIR: false - with: - style: "" # empty string => don't do clang-format checks here, we do them in clang-format.yml - files-changed-only: true # only check files that have changed - lines-changed-only: true # only check lines that have changed - tidy-checks: "" # empty string => use the .clang-tidy file - version: "17" # clang-tools version - database: "build" # path to the compile_commands.json file - - name: Check if clang-tidy failed on any files - if: steps.clang-tidy-check.outputs.checks-failed > 0 - run: echo "Some files failed the linting checks!" && exit 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.10.2/.github/workflows/clang-tidy.yml.bak new/Waybar-0.10.3/.github/workflows/clang-tidy.yml.bak --- old/Waybar-0.10.2/.github/workflows/clang-tidy.yml.bak 1970-01-01 01:00:00.000000000 +0100 +++ new/Waybar-0.10.3/.github/workflows/clang-tidy.yml.bak 2024-05-06 10:54:52.000000000 +0200 @@ -0,0 +1,39 @@ +name: clang-tidy + +on: [push, pull_request] + +concurrency: + group: ${{ github.workflow }}-tidy-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + container: + image: alexays/waybar:debian + steps: + - uses: actions/checkout@v3 + - name: configure + run: | + meson -Dcpp_std=c++20 build # necessary to generate compile_commands.json + ninja -C build # necessary to find certain .h files (xdg, wayland, etc.) + - uses: actions/setup-python@v5 + with: + python-version: '3.10' # to be kept in sync with cpp-linter-action + update-environment: true # the python dist installed by the action needs LD_LIBRARY_PATH to work + - uses: cpp-linter/[email protected] + name: clang-tidy + id: clang-tidy-check + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PIP_NO_CACHE_DIR: false + with: + style: "" # empty string => don't do clang-format checks here, we do them in clang-format.yml + files-changed-only: true # only check files that have changed + lines-changed-only: true # only check lines that have changed + tidy-checks: "" # empty string => use the .clang-tidy file + version: "17" # clang-tools version + database: "build" # path to the compile_commands.json file + - name: Check if clang-tidy failed on any files + if: steps.clang-tidy-check.outputs.checks-failed > 0 + run: echo "Some files failed the linting checks!" && exit 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.10.2/.github/workflows/freebsd.yml new/Waybar-0.10.3/.github/workflows/freebsd.yml --- old/Waybar-0.10.2/.github/workflows/freebsd.yml 2024-04-23 17:59:08.000000000 +0200 +++ new/Waybar-0.10.3/.github/workflows/freebsd.yml 2024-05-06 10:54:52.000000000 +0200 @@ -29,7 +29,7 @@ sudo pkg install -y git # subprojects/date sudo pkg install -y catch evdev-proto gtk-layer-shell gtkmm30 jsoncpp \ libdbusmenu libevdev libfmt libmpdclient libudev-devd meson \ - pkgconf pulseaudio scdoc sndio spdlog wayland-protocols upower \ + pkgconf pipewire pulseaudio scdoc sndio spdlog wayland-protocols upower \ libinotify meson build -Dman-pages=enabled ninja -C build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.10.2/flake.nix new/Waybar-0.10.3/flake.nix --- old/Waybar-0.10.2/flake.nix 2024-04-23 17:59:08.000000000 +0200 +++ new/Waybar-0.10.3/flake.nix 2024-05-06 10:54:52.000000000 +0200 @@ -16,7 +16,12 @@ "x86_64-linux" "aarch64-linux" ] - (system: func (import nixpkgs { inherit system; })); + (system: func (import nixpkgs { + inherit system; + overlays = with self.overlays; [ + waybar + ]; + })); mkDate = longDate: (lib.concatStringsSep "-" [ (builtins.substring 0 4 longDate) @@ -46,22 +51,25 @@ }; }); - overlays.default = final: prev: { - waybar = final.callPackage ./nix/default.nix { - # take the first "version: '...'" from meson.build - version = - (builtins.head (builtins.split "'" - (builtins.elemAt - (builtins.split " version: '" (builtins.readFile ./meson.build)) - 2))) - + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty"); + overlays = { + default = self.overlays.waybar; + waybar = final: prev: { + waybar = final.callPackage ./nix/default.nix { + waybar = prev.waybar; + # take the first "version: '...'" from meson.build + version = + (builtins.head (builtins.split "'" + (builtins.elemAt + (builtins.split " version: '" (builtins.readFile ./meson.build)) + 2))) + + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty"); + }; }; }; - packages = genSystems (pkgs: - let packages = self.overlays.default pkgs pkgs; - in packages // { - default = packages.waybar; - }); + packages = genSystems (pkgs: { + default = self.packages.${pkgs.stdenv.hostPlatform.system}.waybar; + inherit (pkgs) waybar; + }); }; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.10.2/include/AModule.hpp new/Waybar-0.10.3/include/AModule.hpp --- old/Waybar-0.10.2/include/AModule.hpp 2024-04-23 17:59:08.000000000 +0200 +++ new/Waybar-0.10.3/include/AModule.hpp 2024-05-06 10:54:52.000000000 +0200 @@ -37,6 +37,8 @@ const Json::Value &config_; Gtk::EventBox event_box_; + virtual void setCursor(Gdk::CursorType const c); + virtual bool handleToggle(GdkEventButton *const &ev); virtual bool handleMouseEnter(GdkEventCrossing *const &ev); virtual bool handleMouseLeave(GdkEventCrossing *const &ev); @@ -46,6 +48,7 @@ private: bool handleUserEvent(GdkEventButton *const &ev); const bool isTooltip; + bool hasUserEvents_; std::vector<int> pid_; gdouble distance_scrolled_y_; gdouble distance_scrolled_x_; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.10.2/include/group.hpp new/Waybar-0.10.3/include/group.hpp --- old/Waybar-0.10.2/include/group.hpp 2024-04-23 17:59:08.000000000 +0200 +++ new/Waybar-0.10.3/include/group.hpp 2024-05-06 10:54:52.000000000 +0200 @@ -11,15 +11,13 @@ class Group : public AModule { public: - Group(const std::string&, const std::string&, const Json::Value&, bool); + Group(const std::string &, const std::string &, const Json::Value &, bool); virtual ~Group() = default; auto update() -> void override; - operator Gtk::Widget&() override; + operator Gtk::Widget &() override; - virtual Gtk::Box& getBox(); - void addWidget(Gtk::Widget& widget); - - bool handleMouseHover(GdkEventCrossing* const& e); + virtual Gtk::Box &getBox(); + void addWidget(Gtk::Widget &widget); protected: Gtk::Box box; @@ -28,8 +26,8 @@ bool is_first_widget = true; bool is_drawer = false; std::string add_class_to_drawer_children; - - void addHoverHandlerTo(Gtk::Widget& widget); + bool handleMouseEnter(GdkEventCrossing *const &ev) override; + bool handleMouseLeave(GdkEventCrossing *const &ev) override; }; } // namespace waybar diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.10.2/include/modules/custom.hpp new/Waybar-0.10.3/include/modules/custom.hpp --- old/Waybar-0.10.2/include/modules/custom.hpp 2024-04-23 17:59:08.000000000 +0200 +++ new/Waybar-0.10.3/include/modules/custom.hpp 2024-05-06 10:54:52.000000000 +0200 @@ -35,6 +35,7 @@ std::string id_; std::string alt_; std::string tooltip_; + const bool tooltip_format_enabled_; std::vector<std::string> class_; int percentage_; FILE* fp_; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.10.2/include/modules/dwl/window.hpp new/Waybar-0.10.3/include/modules/dwl/window.hpp --- old/Waybar-0.10.2/include/modules/dwl/window.hpp 2024-04-23 17:59:08.000000000 +0200 +++ new/Waybar-0.10.3/include/modules/dwl/window.hpp 2024-05-06 10:54:52.000000000 +0200 @@ -14,7 +14,7 @@ class Window : public AAppIconLabel, public sigc::trackable { public: Window(const std::string &, const waybar::Bar &, const Json::Value &); - virtual ~Window() = default; + ~Window(); void handle_layout(const uint32_t layout); void handle_title(const char *title); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.10.2/include/modules/sni/item.hpp new/Waybar-0.10.3/include/modules/sni/item.hpp --- old/Waybar-0.10.2/include/modules/sni/item.hpp 2024-04-23 17:59:08.000000000 +0200 +++ new/Waybar-0.10.3/include/modules/sni/item.hpp 2024-05-06 10:54:52.000000000 +0200 @@ -76,6 +76,8 @@ void makeMenu(); bool handleClick(GdkEventButton* const& /*ev*/); bool handleScroll(GdkEventScroll* const&); + bool handleMouseEnter(GdkEventCrossing* const&); + bool handleMouseLeave(GdkEventCrossing* const&); // smooth scrolling threshold gdouble scroll_threshold_ = 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.10.2/include/modules/upower/upower.hpp new/Waybar-0.10.3/include/modules/upower/upower.hpp --- old/Waybar-0.10.2/include/modules/upower/upower.hpp 2024-04-23 17:59:08.000000000 +0200 +++ new/Waybar-0.10.3/include/modules/upower/upower.hpp 2024-05-06 10:54:52.000000000 +0200 @@ -71,7 +71,7 @@ GDBusConnection *login1_connection; std::unique_ptr<UPowerTooltip> upower_tooltip; std::string lastStatus; - const char *lastWarningLevel; + const char *lastWarningLevel = nullptr; bool showAltText; bool showIcon = true; bool upowerRunning; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.10.2/include/util/pipewire/pipewire_backend.hpp new/Waybar-0.10.3/include/util/pipewire/pipewire_backend.hpp --- old/Waybar-0.10.2/include/util/pipewire/pipewire_backend.hpp 2024-04-23 17:59:08.000000000 +0200 +++ new/Waybar-0.10.3/include/util/pipewire/pipewire_backend.hpp 2024-05-06 10:54:52.000000000 +0200 @@ -2,6 +2,8 @@ #include <pipewire/pipewire.h> +#include <unordered_map> + #include "util/backend_common.hpp" #include "util/pipewire/privacy_node_info.hpp" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.10.2/meson.build new/Waybar-0.10.3/meson.build --- old/Waybar-0.10.2/meson.build 2024-04-23 17:59:08.000000000 +0200 +++ new/Waybar-0.10.3/meson.build 2024-05-06 10:54:52.000000000 +0200 @@ -1,6 +1,6 @@ project( 'waybar', 'cpp', 'c', - version: '0.10.2', + version: '0.10.3', license: 'MIT', meson_version: '>= 0.59.0', default_options : [ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.10.2/resources/custom_modules/mediaplayer.py new/Waybar-0.10.3/resources/custom_modules/mediaplayer.py --- old/Waybar-0.10.2/resources/custom_modules/mediaplayer.py 2024-04-23 17:59:08.000000000 +0200 +++ new/Waybar-0.10.3/resources/custom_modules/mediaplayer.py 2024-05-06 10:54:52.000000000 +0200 @@ -136,6 +136,10 @@ def on_player_appeared(self, _, player): logger.info(f"Player has appeared: {player.name}") + if player.name in self.excluded_player: + logger.debug( + "New player appeared, but it's in exclude player list, skipping") + return if player is not None and (self.selected_player is None or player.name == self.selected_player): self.init_player(player) else: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.10.2/src/AModule.cpp new/Waybar-0.10.3/src/AModule.cpp --- old/Waybar-0.10.2/src/AModule.cpp 2024-04-23 17:59:08.000000000 +0200 +++ new/Waybar-0.10.3/src/AModule.cpp 2024-05-06 10:54:52.000000000 +0200 @@ -15,6 +15,7 @@ distance_scrolled_x_(0.0) { // Configure module action Map const Json::Value actions{config_["actions"]}; + for (Json::Value::const_iterator it = actions.begin(); it != actions.end(); ++it) { if (it.key().isString() && it->isString()) if (eventActionMap_.count(it.key().asString()) == 0) { @@ -31,17 +32,20 @@ event_box_.signal_leave_notify_event().connect(sigc::mem_fun(*this, &AModule::handleMouseLeave)); // configure events' user commands - // hasUserEvent is true if any element from eventMap_ is satisfying the condition in the lambda - bool hasUserEvent = + // hasUserEvents is true if any element from eventMap_ is satisfying the condition in the lambda + bool hasUserEvents = std::find_if(eventMap_.cbegin(), eventMap_.cend(), [&config](const auto& eventEntry) { // True if there is any non-release type event return eventEntry.first.second != GdkEventType::GDK_BUTTON_RELEASE && config[eventEntry.second].isString(); }) != eventMap_.cend(); - if (enable_click || hasUserEvent) { + if (enable_click || hasUserEvents) { + hasUserEvents_ = true; event_box_.add_events(Gdk::BUTTON_PRESS_MASK); event_box_.signal_button_press_event().connect(sigc::mem_fun(*this, &AModule::handleToggle)); + } else { + hasUserEvents_ = false; } bool hasReleaseEvent = @@ -86,10 +90,20 @@ } } +void AModule::setCursor(Gdk::CursorType c) { + auto cursor = Gdk::Cursor::create(c); + auto gdk_window = event_box_.get_window(); + gdk_window->set_cursor(cursor); +} + bool AModule::handleMouseEnter(GdkEventCrossing* const& e) { if (auto* module = event_box_.get_child(); module != nullptr) { module->set_state_flags(Gtk::StateFlags::STATE_FLAG_PRELIGHT); } + + if (hasUserEvents_) { + setCursor(Gdk::HAND2); + } return false; } @@ -97,6 +111,10 @@ if (auto* module = event_box_.get_child(); module != nullptr) { module->unset_state_flags(Gtk::StateFlags::STATE_FLAG_PRELIGHT); } + + if (hasUserEvents_) { + setCursor(Gdk::ARROW); + } return false; } @@ -108,6 +126,7 @@ std::string format{}; const std::map<std::pair<uint, GdkEventType>, std::string>::const_iterator& rec{ eventMap_.find(std::pair(e->button, e->type))}; + if (rec != eventMap_.cend()) { // First call module actions this->AModule::doAction(rec->second); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.10.2/src/group.cpp new/Waybar-0.10.3/src/group.cpp --- old/Waybar-0.10.2/src/group.cpp 2024-04-23 17:59:08.000000000 +0200 +++ new/Waybar-0.10.3/src/group.cpp 2024-05-06 10:54:52.000000000 +0200 @@ -4,7 +4,7 @@ #include <util/command.hpp> -#include "gdkmm/device.h" +#include "gtkmm/enums.h" #include "gtkmm/widget.h" namespace waybar { @@ -78,30 +78,21 @@ } else { box.pack_start(revealer); } - - addHoverHandlerTo(revealer); } -} -bool Group::handleMouseHover(GdkEventCrossing* const& e) { - switch (e->type) { - case GDK_ENTER_NOTIFY: - revealer.set_reveal_child(true); - break; - case GDK_LEAVE_NOTIFY: - revealer.set_reveal_child(false); - break; - default: - break; - } + event_box_.add(box); +} - return true; +bool Group::handleMouseEnter(GdkEventCrossing* const& e) { + box.set_state_flags(Gtk::StateFlags::STATE_FLAG_PRELIGHT); + revealer.set_reveal_child(true); + return false; } -void Group::addHoverHandlerTo(Gtk::Widget& widget) { - widget.add_events(Gdk::EventMask::ENTER_NOTIFY_MASK | Gdk::EventMask::LEAVE_NOTIFY_MASK); - widget.signal_enter_notify_event().connect(sigc::mem_fun(*this, &Group::handleMouseHover)); - widget.signal_leave_notify_event().connect(sigc::mem_fun(*this, &Group::handleMouseHover)); +bool Group::handleMouseLeave(GdkEventCrossing* const& e) { + box.unset_state_flags(Gtk::StateFlags::STATE_FLAG_PRELIGHT); + revealer.set_reveal_child(false); + return false; } auto Group::update() -> void { @@ -113,17 +104,13 @@ void Group::addWidget(Gtk::Widget& widget) { getBox().pack_start(widget, false, false); - if (is_drawer) { - // Necessary because of GTK's hitbox detection - addHoverHandlerTo(widget); - if (!is_first_widget) { - widget.get_style_context()->add_class(add_class_to_drawer_children); - } + if (is_drawer && !is_first_widget) { + widget.get_style_context()->add_class(add_class_to_drawer_children); } is_first_widget = false; } -Group::operator Gtk::Widget&() { return box; } +Group::operator Gtk::Widget&() { return event_box_; } } // namespace waybar diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.10.2/src/modules/battery.cpp new/Waybar-0.10.3/src/modules/battery.cpp --- old/Waybar-0.10.2/src/modules/battery.cpp 2024-04-23 17:59:08.000000000 +0200 +++ new/Waybar-0.10.3/src/modules/battery.cpp 2024-05-06 10:54:52.000000000 +0200 @@ -371,7 +371,12 @@ if (charge_full_exists && charge_full_design_exists) { float batHealthPercent = ((float)charge_full / charge_full_design) * 100; - if (mainBatHealthPercent == 0.0f || batHealthPercent < mainBatHealthPercent) { + if (mainBatHealthPercent == 0.0F || batHealthPercent < mainBatHealthPercent) { + mainBatHealthPercent = batHealthPercent; + } + } else if (energy_full_exists && energy_full_design_exists) { + float batHealthPercent = ((float)energy_full / energy_full_design) * 100; + if (mainBatHealthPercent == 0.0F || batHealthPercent < mainBatHealthPercent) { mainBatHealthPercent = batHealthPercent; } } @@ -711,10 +716,10 @@ } else { event_box_.show(); auto icons = std::vector<std::string>{status + "-" + state, status, state}; - label_.set_markup( - fmt::format(fmt::runtime(format), fmt::arg("capacity", capacity), fmt::arg("power", power), - fmt::arg("icon", getIcon(capacity, icons)), - fmt::arg("time", time_remaining_formatted), fmt::arg("cycles", cycles))); + label_.set_markup(fmt::format( + fmt::runtime(format), fmt::arg("capacity", capacity), fmt::arg("power", power), + fmt::arg("icon", getIcon(capacity, icons)), fmt::arg("time", time_remaining_formatted), + fmt::arg("cycles", cycles), fmt::arg("health", fmt::format("{:.3}", health)))); } // Call parent update ALabel::update(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.10.2/src/modules/custom.cpp new/Waybar-0.10.3/src/modules/custom.cpp --- old/Waybar-0.10.2/src/modules/custom.cpp 2024-04-23 17:59:08.000000000 +0200 +++ new/Waybar-0.10.3/src/modules/custom.cpp 2024-05-06 10:54:52.000000000 +0200 @@ -10,6 +10,7 @@ name_(name), output_name_(output_name), id_(id), + tooltip_format_enabled_{config_["tooltip-format"].isString()}, percentage_(0), fp_(nullptr), pid_(-1) { @@ -166,16 +167,16 @@ } else { label_.set_markup(str); if (tooltipEnabled()) { - if (text_ == tooltip_) { - if (label_.get_tooltip_markup() != str) { - label_.set_tooltip_markup(str); - } - } else if (config_["tooltip-format"].isString()) { + if (tooltip_format_enabled_) { auto tooltip = config_["tooltip-format"].asString(); tooltip = fmt::format(fmt::runtime(tooltip), text_, fmt::arg("alt", alt_), fmt::arg("icon", getIcon(percentage_, alt_)), fmt::arg("percentage", percentage_)); label_.set_tooltip_markup(tooltip); + } else if (text_ == tooltip_) { + if (label_.get_tooltip_markup() != str) { + label_.set_tooltip_markup(str); + } } else { if (label_.get_tooltip_markup() != tooltip_) { label_.set_tooltip_markup(tooltip_); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.10.2/src/modules/dwl/window.cpp new/Waybar-0.10.3/src/modules/dwl/window.cpp --- old/Waybar-0.10.2/src/modules/dwl/window.cpp 2024-04-23 17:59:08.000000000 +0200 +++ new/Waybar-0.10.3/src/modules/dwl/window.cpp 2024-05-06 10:54:52.000000000 +0200 @@ -80,7 +80,7 @@ wl_registry_add_listener(registry, ®istry_listener_impl, this); wl_display_roundtrip(display); - if (!status_manager_) { + if (status_manager_ == nullptr) { spdlog::error("dwl_status_manager_v2 not advertised"); return; } @@ -91,6 +91,12 @@ zdwl_ipc_manager_v2_destroy(status_manager_); } +Window::~Window() { + if (output_status_ != nullptr) { + zdwl_ipc_output_v2_destroy(output_status_); + } +} + void Window::handle_title(const char *title) { title_ = title; } void Window::handle_appid(const char *appid) { appid_ = appid; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.10.2/src/modules/hyprland/backend.cpp new/Waybar-0.10.3/src/modules/hyprland/backend.cpp --- old/Waybar-0.10.2/src/modules/hyprland/backend.cpp 2024-04-23 17:59:08.000000000 +0200 +++ new/Waybar-0.10.3/src/modules/hyprland/backend.cpp 2024-05-06 10:54:52.000000000 +0200 @@ -9,11 +9,30 @@ #include <sys/un.h> #include <unistd.h> +#include <filesystem> #include <string> #include <thread> namespace waybar::modules::hyprland { +std::filesystem::path getSocketFolder(const char* instanceSig) { + // socket path, specified by EventManager of Hyprland + static std::filesystem::path socketFolder; + if (!socketFolder.empty()) { + return socketFolder; + } + + std::filesystem::path xdgRuntimeDir = std::filesystem::path(getenv("XDG_RUNTIME_DIR")); + if (!xdgRuntimeDir.empty() && std::filesystem::exists(xdgRuntimeDir / "hypr")) { + socketFolder = xdgRuntimeDir / "hypr"; + } else { + spdlog::warn("$XDG_RUNTIME_DIR/hypr does not exist, falling back to /tmp/hypr"); + socketFolder = std::filesystem::temp_directory_path() / "hypr"; + } + socketFolder = socketFolder / instanceSig; + return socketFolder; +} + void IPC::startIPC() { // will start IPC and relay events to parseIPC @@ -40,9 +59,7 @@ addr.sun_family = AF_UNIX; - // socket path, specified by EventManager of Hyprland - std::string socketPath = "/tmp/hypr/" + std::string(his) + "/.socket2.sock"; - + auto socketPath = getSocketFolder(his) / ".socket2.sock"; strncpy(addr.sun_path, socketPath.c_str(), sizeof(addr.sun_path) - 1); addr.sun_path[sizeof(addr.sun_path) - 1] = 0; @@ -142,12 +159,10 @@ return ""; } - std::string instanceSigStr = std::string(instanceSig); - sockaddr_un serverAddress = {0}; serverAddress.sun_family = AF_UNIX; - std::string socketPath = "/tmp/hypr/" + instanceSigStr + "/.socket.sock"; + std::string socketPath = getSocketFolder(instanceSig) / ".socket.sock"; // Use snprintf to copy the socketPath string into serverAddress.sun_path if (snprintf(serverAddress.sun_path, sizeof(serverAddress.sun_path), "%s", socketPath.c_str()) < diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.10.2/src/modules/sni/item.cpp new/Waybar-0.10.3/src/modules/sni/item.cpp --- old/Waybar-0.10.2/src/modules/sni/item.cpp 2024-04-23 17:59:08.000000000 +0200 +++ new/Waybar-0.10.3/src/modules/sni/item.cpp 2024-05-06 10:54:52.000000000 +0200 @@ -8,6 +8,7 @@ #include <fstream> #include <map> +#include "gdk/gdk.h" #include "util/format.hpp" #include "util/gtk_icon.hpp" @@ -57,6 +58,8 @@ event_box.add_events(Gdk::BUTTON_PRESS_MASK | Gdk::SCROLL_MASK | Gdk::SMOOTH_SCROLL_MASK); event_box.signal_button_press_event().connect(sigc::mem_fun(*this, &Item::handleClick)); event_box.signal_scroll_event().connect(sigc::mem_fun(*this, &Item::handleScroll)); + event_box.signal_enter_notify_event().connect(sigc::mem_fun(*this, &Item::handleMouseEnter)); + event_box.signal_leave_notify_event().connect(sigc::mem_fun(*this, &Item::handleMouseLeave)); // initial visibility event_box.show_all(); event_box.set_visible(show_passive_); @@ -69,6 +72,16 @@ cancellable_, interface); } +bool Item::handleMouseEnter(GdkEventCrossing* const& e) { + event_box.set_state_flags(Gtk::StateFlags::STATE_FLAG_PRELIGHT); + return false; +} + +bool Item::handleMouseLeave(GdkEventCrossing* const& e) { + event_box.unset_state_flags(Gtk::StateFlags::STATE_FLAG_PRELIGHT); + return false; +} + void Item::onConfigure(GdkEventConfigure* ev) { this->updateImage(); } void Item::proxyReady(Glib::RefPtr<Gio::AsyncResult>& result) {
