Hello community, here is the log from the commit of package waybar for openSUSE:Factory checked in at 2020-04-13 12:54:17 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/waybar (Old) and /work/SRC/openSUSE:Factory/.waybar.new.3248 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "waybar" Mon Apr 13 12:54:17 2020 rev:19 rq:793446 version:0.9.2 Changes: -------- --- /work/SRC/openSUSE:Factory/waybar/waybar.changes 2020-03-29 14:25:53.230103389 +0200 +++ /work/SRC/openSUSE:Factory/.waybar.new.3248/waybar.changes 2020-04-13 12:54:21.320676047 +0200 @@ -1,0 +2,28 @@ +Sun Apr 12 21:33:24 UTC 2020 - Michael Vetter <[email protected]> + +- Update to 0.9.2: + Added: + * Battery: full-at config, define the max percentage of + the battery #649 + Changed: + * Support libc++ >=9.0.0 #583 + * Sway: add missing unordered_map include #584 + * Network: fix label text not updated properly when formats + contain Unicode characters #589 + * Pulseaudio: Fix alt #592 + * Pulseaudio: track default source/sink changes #599 + * Tray: Use the same StatusNotifierWatcher for all trays #598 + * Pulseaudio: track only the default sink and source #603 + * Systemd service: fix start up ordering #612 + * Fix: set exclusive zone early for gtk-layer-shell #613 + * Readme: ubuntu dependencies #615 + * Temperature: Added support for absolute device paths #624 + * Switch default Makefile rule from run to build #625 + * Memory: provide better free memory approximation on old kernel #629 + * Pulseaudio: fallback to default muted format 9acf558 + * Custom: restore SIGCHLD settings to SIG_DFL #636 + * Custom: check WIFEXITED ec451b5 + * Pulseaudio: Start wait for server #651 + * Sway/Workspaces: default value unstripped, add value format option 27fbea2 + +------------------------------------------------------------------- Old: ---- 0.9.1.tar.gz New: ---- 0.9.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ waybar.spec ++++++ --- /var/tmp/diff_new_pack.TlYXAT/_old 2020-04-13 12:54:22.836676708 +0200 +++ /var/tmp/diff_new_pack.TlYXAT/_new 2020-04-13 12:54:22.840676709 +0200 @@ -17,7 +17,7 @@ Name: waybar -Version: 0.9.1 +Version: 0.9.2 Release: 0 Summary: Customizable Wayland bar for Sway and Wlroots based compositors License: MIT ++++++ 0.9.1.tar.gz -> 0.9.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/Dockerfiles/alpine new/Waybar-0.9.2/Dockerfiles/alpine --- old/Waybar-0.9.1/Dockerfiles/alpine 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/Dockerfiles/alpine 2020-04-11 12:24:49.000000000 +0200 @@ -2,4 +2,4 @@ FROM alpine:latest -RUN apk add --no-cache git meson alpine-sdk libinput-dev wayland-dev wayland-protocols mesa-dev libxkbcommon-dev eudev-dev pixman-dev gtkmm3-dev jsoncpp-dev libnl3-dev pulseaudio-dev libmpdclient-dev scdoc +RUN apk add --no-cache git meson alpine-sdk libinput-dev wayland-dev wayland-protocols mesa-dev libxkbcommon-dev eudev-dev pixman-dev gtkmm3-dev jsoncpp-dev pugixml libnl3-dev pulseaudio-dev libmpdclient-dev scdoc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/Dockerfiles/archlinux new/Waybar-0.9.2/Dockerfiles/archlinux --- old/Waybar-0.9.1/Dockerfiles/archlinux 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/Dockerfiles/archlinux 2020-04-11 12:24:49.000000000 +0200 @@ -3,4 +3,4 @@ FROM archlinux/base:latest RUN pacman -Syu --noconfirm && \ - pacman -S git meson base-devel libinput wayland wayland-protocols pixman libxkbcommon mesa gtkmm3 jsoncpp scdoc --noconfirm + pacman -S git meson base-devel libinput wayland wayland-protocols pixman libxkbcommon mesa gtkmm3 jsoncpp pugixml scdoc --noconfirm diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/Dockerfiles/debian new/Waybar-0.9.2/Dockerfiles/debian --- old/Waybar-0.9.1/Dockerfiles/debian 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/Dockerfiles/debian 2020-04-11 12:24:49.000000000 +0200 @@ -3,5 +3,5 @@ FROM debian:sid RUN apt-get update && \ - apt-get install -y build-essential meson ninja-build git pkg-config libinput10 libinput-dev wayland-protocols libwayland-client0 libwayland-cursor0 libwayland-dev libegl1-mesa-dev libgles2-mesa-dev libgbm-dev libxkbcommon-dev libudev-dev libpixman-1-dev libgtkmm-3.0-dev libjsoncpp-dev scdoc && \ + apt-get install -y build-essential meson ninja-build git pkg-config libinput10 libpugixml-dev libinput-dev wayland-protocols libwayland-client0 libwayland-cursor0 libwayland-dev libegl1-mesa-dev libgles2-mesa-dev libgbm-dev libxkbcommon-dev libudev-dev libpixman-1-dev libgtkmm-3.0-dev libjsoncpp-dev scdoc && \ apt-get clean diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/Dockerfiles/fedora new/Waybar-0.9.2/Dockerfiles/fedora --- old/Waybar-0.9.1/Dockerfiles/fedora 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/Dockerfiles/fedora 2020-04-11 12:24:49.000000000 +0200 @@ -2,6 +2,6 @@ FROM fedora:30 -RUN dnf install sway meson git libinput-devel wayland-devel wayland-protocols-devel egl-wayland-devel mesa-libEGL-devel mesa-libGLES-devel mesa-libgbm-devel libxkbcommon-devel libudev-devel pixman-devel gtkmm30-devel jsoncpp-devel scdoc -y && \ +RUN dnf install sway meson git libinput-devel wayland-devel wayland-protocols-devel pugixml-devel egl-wayland-devel mesa-libEGL-devel mesa-libGLES-devel mesa-libgbm-devel libxkbcommon-devel libudev-devel pixman-devel gtkmm30-devel jsoncpp-devel scdoc -y && \ dnf group install "C Development Tools and Libraries" -y && \ dnf clean all -y diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/Dockerfiles/opensuse new/Waybar-0.9.2/Dockerfiles/opensuse --- old/Waybar-0.9.1/Dockerfiles/opensuse 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/Dockerfiles/opensuse 2020-04-11 12:24:49.000000000 +0200 @@ -4,4 +4,4 @@ RUN zypper -n up && \ zypper -n install -t pattern devel_C_C++ && \ - zypper -n install git meson clang libinput10 libinput-devel libwayland-client0 libwayland-cursor0 wayland-protocols-devel wayland-devel Mesa-libEGL-devel Mesa-libGLESv2-devel libgbm-devel libxkbcommon-devel libudev-devel libpixman-1-0-devel gtkmm3-devel jsoncpp-devel scdoc + zypper -n install git meson clang libinput10 libinput-devel libpugixml1 libwayland-client0 libwayland-cursor0 wayland-protocols-devel wayland-devel Mesa-libEGL-devel Mesa-libGLESv2-devel libgbm-devel libxkbcommon-devel libudev-devel libpixman-1-0-devel gtkmm3-devel jsoncpp-devel scdoc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/Makefile new/Waybar-0.9.2/Makefile --- old/Waybar-0.9.1/Makefile 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/Makefile 2020-04-11 12:24:49.000000000 +0200 @@ -1,6 +1,6 @@ .PHONY: build build-debug run clean default install -default: run +default: build build: meson build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/README.md new/Waybar-0.9.2/README.md --- old/Waybar-0.9.1/README.md 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/README.md 2020-04-11 12:24:49.000000000 +0200 @@ -62,7 +62,24 @@ On Ubuntu 19.10 you can install all the relevant dependencies using this command: ``` -sudo apt install libgtkmm-3.0-dev libjsoncpp-dev libinput-dev libsigc++-2.0-dev libpulse-dev libnl-3-dev libdbusmenu-gtk3-dev libnl-genl-3-dev libfmt-dev clang-tidy libmpdclient-dev libwayland-dev libgtk-3-dev gobject-introspection libgirepository1.0-dev scdoc +sudo apt install \ + clang-tidy \ + gobject-introspection \ + libdbusmenu-gtk3-dev \ + libfmt-dev \ + libgirepository1.0-dev \ + libgtk-3-dev \ + libgtkmm-3.0-dev \ + libinput-dev \ + libjsoncpp-dev \ + libmpdclient-dev \ + libnl-3-dev \ + libnl-genl-3-dev \ + libpulse-dev \ + libsigc++-2.0-dev \ + libspdlog-dev \ + libwayland-dev \ + scdoc ``` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/include/modules/memory.hpp new/Waybar-0.9.2/include/modules/memory.hpp --- old/Waybar-0.9.1/include/modules/memory.hpp 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/include/modules/memory.hpp 2020-04-11 12:24:49.000000000 +0200 @@ -17,8 +17,7 @@ static inline const std::string data_dir_ = "/proc/meminfo"; void parseMeminfo(); - unsigned long memtotal_; - unsigned long memfree_; + std::unordered_map<std::string, unsigned long> meminfo_; util::SleeperThread thread_; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/include/modules/pulseaudio.hpp new/Waybar-0.9.2/include/modules/pulseaudio.hpp --- old/Waybar-0.9.1/include/modules/pulseaudio.hpp 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/include/modules/pulseaudio.hpp 2020-04-11 12:24:49.000000000 +0200 @@ -37,12 +37,14 @@ std::string form_factor_; std::string desc_; std::string monitor_; + std::string default_sink_name_; // SOURCE uint32_t source_idx_{0}; uint16_t source_volume_; bool source_muted_; std::string source_port_name_; std::string source_desc_; + std::string default_source_name_; }; } // namespace waybar::modules diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/include/modules/sni/tray.hpp new/Waybar-0.9.2/include/modules/sni/tray.hpp --- old/Waybar-0.9.1/include/modules/sni/tray.hpp 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/include/modules/sni/tray.hpp 2020-04-11 12:24:49.000000000 +0200 @@ -21,7 +21,7 @@ static inline std::size_t nb_hosts_ = 0; Gtk::Box box_; - SNI::Watcher watcher_; + SNI::Watcher::singleton watcher_; SNI::Host host_; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/include/modules/sni/watcher.hpp new/Waybar-0.9.2/include/modules/sni/watcher.hpp --- old/Waybar-0.9.1/include/modules/sni/watcher.hpp 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/include/modules/sni/watcher.hpp 2020-04-11 12:24:49.000000000 +0200 @@ -7,10 +7,24 @@ namespace waybar::modules::SNI { class Watcher { + private: + Watcher(); + public: - Watcher(std::size_t id); ~Watcher(); + using singleton = std::shared_ptr<Watcher>; + static singleton getInstance() { + static std::weak_ptr<Watcher> weak; + + std::shared_ptr<Watcher> strong = weak.lock(); + if (!strong) { + strong = std::shared_ptr<Watcher>(new Watcher()); + weak = strong; + } + return strong; + } + private: typedef enum { GF_WATCH_TYPE_HOST, GF_WATCH_TYPE_ITEM } GfWatchType; @@ -34,7 +48,6 @@ void updateRegisteredItems(SnWatcher *obj); uint32_t bus_name_id_; - uint32_t watcher_id_; GSList * hosts_ = nullptr; GSList * items_ = nullptr; SnWatcher *watcher_ = nullptr; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/include/modules/sway/workspaces.hpp new/Waybar-0.9.2/include/modules/sway/workspaces.hpp --- old/Waybar-0.9.1/include/modules/sway/workspaces.hpp 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/include/modules/sway/workspaces.hpp 2020-04-11 12:24:49.000000000 +0200 @@ -1,5 +1,6 @@ #pragma once +#include <unordered_map> #include <fmt/format.h> #include <gtkmm/button.h> #include <gtkmm/label.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/include/util/command.hpp new/Waybar-0.9.2/include/util/command.hpp --- old/Waybar-0.9.1/include/util/command.hpp 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/include/util/command.hpp 2020-04-11 12:24:49.000000000 +0200 @@ -72,7 +72,10 @@ if (!fp) return {-1, ""}; auto output = command::read(fp); auto stat = command::close(fp, pid); - return {WEXITSTATUS(stat), output}; + if (WIFEXITED(stat)) { + return {WEXITSTATUS(stat), output}; + } + return {-1, output}; } inline int32_t forkExec(std::string cmd) { @@ -88,6 +91,7 @@ // Child executes the command if (!pid) { setpgid(pid, pid); + signal(SIGCHLD, SIG_DFL); execl("/bin/sh", "sh", "-c", cmd.c_str(), (char*)0); exit(0); } else { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/man/waybar-battery.5.scd new/Waybar-0.9.2/man/waybar-battery.5.scd --- old/Waybar-0.9.1/man/waybar-battery.5.scd 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/man/waybar-battery.5.scd 2020-04-11 12:24:49.000000000 +0200 @@ -18,6 +18,10 @@ typeof: string ++ The adapter to monitor, as in /sys/class/power_supply/ instead of auto detect. +*full-at* ++ + typeof: integer ++ + Define the max percentage of the battery, usefull for an old battery, e.g. 96 + *interval* ++ typeof: integer ++ default: 60 ++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/man/waybar-custom.5.scd new/Waybar-0.9.2/man/waybar-custom.5.scd --- old/Waybar-0.9.1/man/waybar-custom.5.scd 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/man/waybar-custom.5.scd 2020-04-11 12:24:49.000000000 +0200 @@ -33,6 +33,12 @@ You can update it manually with a signal. If no *interval* is defined, it is assumed that the out script loops it self. +*restart-interval*: ++ + typeof: integer ++ + The restart interval (in seconds). + Can't be used with the *interval* option, so only with continuous scripts. + Once the script exit, it'll be re-executed after the *restart-interval*. + *signal*: ++ typeof: integer ++ The signal number used to update the module. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/man/waybar-sway-workspaces.5.scd new/Waybar-0.9.2/man/waybar-sway-workspaces.5.scd --- old/Waybar-0.9.1/man/waybar-sway-workspaces.5.scd 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/man/waybar-sway-workspaces.5.scd 2020-04-11 12:24:49.000000000 +0200 @@ -19,7 +19,7 @@ *format*: ++ typeof: string ++ - default: {name} ++ + default: {value} ++ The format, how information should be displayed. *format-icons*: ++ @@ -62,7 +62,9 @@ # FORMAT REPLACEMENTS -*{name}*: Name of the workspace, as defined by sway. +*{value}*: Name of the workspace, as defined by sway. + +*{name}*: Number stripped from workspace value. *{icon}*: Icon, as defined in *format-icons*. @@ -75,6 +77,7 @@ - *default*: Will be shown, when no string matches is found. - *urgent*: Will be shown, when workspace is flagged as urgent - *focused*: Will be shown, when workspace is focused +- *persistent*: Will be shown, when workspace is persistent one. # PERSISTENT WORKSPACES diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/man/waybar-temperature.5.scd new/Waybar-0.9.2/man/waybar-temperature.5.scd --- old/Waybar-0.9.1/man/waybar-temperature.5.scd 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/man/waybar-temperature.5.scd 2020-04-11 12:24:49.000000000 +0200 @@ -20,6 +20,14 @@ typeof: string ++ The temperature path to use, e.g. */sys/class/hwmon/hwmon2/temp1_input* instead of one in */sys/class/thermal/*. +*hwmon-path-abs*: ++ + typeof: string ++ + The path of the hwmon-directory of the device, e.g. */sys/devices/pci0000:00/0000:00:18.3/hwmon*. (Note that the subdirectory *hwmon/hwmon#*, where *#* is a number is not part of the path!) Has to be used together with *input-filename*. + +*input-filename*: ++ + typeof: string ++ + The temperature filename of your *hwmon-path-abs*, e.g. *temp1_input* + *critical-threshold*: ++ typeof: integer ++ The threshold before it is considered critical (Celsius). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/meson.build new/Waybar-0.9.2/meson.build --- old/Waybar-0.9.1/meson.build 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/meson.build 2020-04-11 12:24:49.000000000 +0200 @@ -1,6 +1,6 @@ project( 'waybar', 'cpp', 'c', - version: '0.9.1', + version: '0.9.2', license: 'MIT', default_options : [ 'cpp_std=c++17', @@ -9,6 +9,8 @@ ], ) +compiler = meson.get_compiler('cpp') + cpp_args = [] cpp_link_args = [] @@ -16,13 +18,14 @@ cpp_args += ['-stdlib=libc++'] cpp_link_args += ['-stdlib=libc++', '-lc++abi'] - cpp_link_args += ['-lc++fs'] + if compiler.has_link_argument('-lc++fs') + cpp_link_args += ['-lc++fs'] + endif else cpp_link_args += ['-lstdc++fs'] endif -compiler = meson.get_compiler('cpp') -git = find_program('git', required: false) +git = find_program('git', native: true, required: false) if not git.found() add_project_arguments('-DVERSION="@0@"'.format(meson.project_version()), language: 'cpp') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/resources/config new/Waybar-0.9.2/resources/config --- old/Waybar-0.9.1/resources/config 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/resources/config 2020-04-11 12:24:49.000000000 +0200 @@ -1,5 +1,5 @@ { - "layer": "top", // Waybar at top layer + // "layer": "top", // Waybar at top layer // "position": "bottom", // Waybar position (top|bottom|left|right) "height": 30, // Waybar height (to be removed for auto height) // "width": 1280, // Waybar width diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/resources/waybar.service.in new/Waybar-0.9.2/resources/waybar.service.in --- old/Waybar-0.9.1/resources/waybar.service.in 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/resources/waybar.service.in 2020-04-11 12:24:49.000000000 +0200 @@ -2,6 +2,7 @@ Description=Highly customizable Wayland bar for Sway and Wlroots based compositors. Documentation=https://github.com/Alexays/Waybar/wiki/ PartOf=wayland-session.target +After=wayland-session.target [Service] Type=dbus diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/src/bar.cpp new/Waybar-0.9.2/src/bar.cpp --- old/Waybar-0.9.1/src/bar.cpp 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/src/bar.cpp 2020-04-11 12:24:49.000000000 +0200 @@ -175,6 +175,11 @@ gtk_layer_set_margin(gtk_window, GTK_LAYER_SHELL_EDGE_RIGHT, margins_.right); gtk_layer_set_margin(gtk_window, GTK_LAYER_SHELL_EDGE_TOP, margins_.top); gtk_layer_set_margin(gtk_window, GTK_LAYER_SHELL_EDGE_BOTTOM, margins_.bottom); + + if (width_ > 1 && height_ > 1) { + /* configure events are not emitted if the bar is using initial size */ + setExclusiveZone(width_, height_); + } } #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/src/modules/battery.cpp new/Waybar-0.9.2/src/modules/battery.cpp --- old/Waybar-0.9.1/src/modules/battery.cpp 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/src/modules/battery.cpp 2020-04-11 12:24:49.000000000 +0200 @@ -115,6 +115,16 @@ time_remaining = -(float)(total_energy_full - total_energy) / total_power; } uint16_t capacity = total / batteries_.size(); + // Handle full-at + if (config_["full-at"].isUInt()) { + auto full_at = config_["full-at"].asUInt(); + if (full_at < 100) { + capacity = static_cast<float>(capacity / full_at) * 100; + if (capacity > full_at) { + capacity = full_at; + } + } + } return {capacity, time_remaining, status}; } catch (const std::exception& e) { spdlog::error("Battery: {}", e.what()); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/src/modules/custom.cpp new/Waybar-0.9.2/src/modules/custom.cpp --- old/Waybar-0.9.1/src/modules/custom.cpp 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/src/modules/custom.cpp 2020-04-11 12:24:49.000000000 +0200 @@ -49,19 +49,24 @@ thread_ = [&] { char* buff = nullptr; size_t len = 0; + bool restart = false; if (getline(&buff, &len, fp_) == -1) { int exit_code = 1; if (fp_) { exit_code = WEXITSTATUS(util::command::close(fp_, pid_)); fp_ = nullptr; } - thread_.stop(); if (exit_code != 0) { output_ = {exit_code, ""}; dp.emit(); spdlog::error("{} stopped unexpectedly, is it endless?", name_); } - return; + if (config_["restart-interval"].isUInt()) { + restart = true; + } else { + thread_.stop(); + return; + } } std::string output = buff; @@ -71,6 +76,14 @@ } output_ = {0, output}; dp.emit(); + if (restart) { + pid_ = -1; + fp_ = util::command::open(cmd, pid_); + if (!fp_) { + throw std::runtime_error("Unable to open " + cmd); + } + thread_.sleep_for(std::chrono::seconds(config_["restart-interval"].asUInt())); + } }; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/src/modules/memory.cpp new/Waybar-0.9.2/src/modules/memory.cpp --- old/Waybar-0.9.1/src/modules/memory.cpp 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/src/modules/memory.cpp 2020-04-11 12:24:49.000000000 +0200 @@ -10,11 +10,23 @@ auto waybar::modules::Memory::update() -> void { parseMeminfo(); - if (memtotal_ > 0 && memfree_ >= 0) { - auto total_ram_gigabytes = memtotal_ / std::pow(1024, 2); - int used_ram_percentage = 100 * (memtotal_ - memfree_) / memtotal_; - auto used_ram_gigabytes = (memtotal_ - memfree_) / std::pow(1024, 2); - auto available_ram_gigabytes = memfree_ / std::pow(1024, 2); + + unsigned long memtotal = meminfo_["MemTotal"]; + unsigned long memfree; + if (meminfo_.count("MemAvailable")) { + // New kernels (3.4+) have an accurate available memory field. + memfree = meminfo_["MemAvailable"]; + } else { + // Old kernel; give a best-effort approximation of available memory. + memfree = meminfo_["MemFree"] + meminfo_["Buffers"] + meminfo_["Cached"] + + meminfo_["SReclaimable"] - meminfo_["Shmem"]; + } + + if (memtotal > 0 && memfree >= 0) { + auto total_ram_gigabytes = memtotal / std::pow(1024, 2); + int used_ram_percentage = 100 * (memtotal - memfree) / memtotal; + auto used_ram_gigabytes = (memtotal - memfree) / std::pow(1024, 2); + auto available_ram_gigabytes = memfree / std::pow(1024, 2); getState(used_ram_percentage); label_.set_markup(fmt::format(format_, @@ -33,7 +45,6 @@ } void waybar::modules::Memory::parseMeminfo() { - int64_t memfree = -1, membuffer = -1, memcache = -1, memavail = -1; std::ifstream info(data_dir_); if (!info.is_open()) { throw std::runtime_error("Can't open " + data_dir_); @@ -44,23 +55,9 @@ if (posDelim == std::string::npos) { continue; } + std::string name = line.substr(0, posDelim); int64_t value = std::stol(line.substr(posDelim + 1)); - - if (name.compare("MemTotal") == 0) { - memtotal_ = value; - } else if (name.compare("MemAvailable") == 0) { - memavail = value; - } else if (name.compare("MemFree") == 0) { - memfree = value; - } else if (name.compare("Buffers") == 0) { - membuffer = value; - } else if (name.compare("Cached") == 0) { - memcache = value; - } - if (memtotal_ > 0 && (memavail >= 0 || (memfree > -1 && membuffer > -1 && memcache > -1))) { - break; - } + meminfo_[name] = value; } - memfree_ = memavail >= 0 ? memavail : memfree + membuffer + memcache; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/src/modules/network.cpp new/Waybar-0.9.2/src/modules/network.cpp --- old/Waybar-0.9.1/src/modules/network.cpp 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/src/modules/network.cpp 2020-04-11 12:24:49.000000000 +0200 @@ -279,7 +279,7 @@ fmt::arg("bandwidthUpBits", pow_format(bandwidth_up * 8ull / interval_.count(), "b/s")), fmt::arg("bandwidthDownOctets", pow_format(bandwidth_down / interval_.count(), "o/s")), fmt::arg("bandwidthUpOctets", pow_format(bandwidth_up / interval_.count(), "o/s"))); - if (text != label_.get_label()) { + if (text.compare(label_.get_label()) != 0) { label_.set_markup(text); if (text.empty()) { event_box_.hide(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/src/modules/pulseaudio.cpp new/Waybar-0.9.2/src/modules/pulseaudio.cpp --- old/Waybar-0.9.1/src/modules/pulseaudio.cpp 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/src/modules/pulseaudio.cpp 2020-04-11 12:24:49.000000000 +0200 @@ -21,7 +21,7 @@ if (context_ == nullptr) { throw std::runtime_error("pa_context_new() failed."); } - if (pa_context_connect(context_, nullptr, PA_CONTEXT_NOAUTOSPAWN, nullptr) < 0) { + if (pa_context_connect(context_, nullptr, PA_CONTEXT_NOFAIL, nullptr) < 0) { auto err = fmt::format("pa_context_connect() failed: {}", pa_strerror(pa_context_errno(context_))); throw std::runtime_error(err); @@ -52,7 +52,8 @@ pa_context_set_subscribe_callback(c, subscribeCb, data); pa_context_subscribe( c, - static_cast<enum pa_subscription_mask>(static_cast<int>(PA_SUBSCRIPTION_MASK_SINK) | + static_cast<enum pa_subscription_mask>(static_cast<int>(PA_SUBSCRIPTION_MASK_SERVER) | + static_cast<int>(PA_SUBSCRIPTION_MASK_SINK) | static_cast<int>(PA_SUBSCRIPTION_MASK_SOURCE)), nullptr, nullptr); @@ -109,7 +110,9 @@ if (operation != PA_SUBSCRIPTION_EVENT_CHANGE) { return; } - if (facility == PA_SUBSCRIPTION_EVENT_SINK) { + if (facility == PA_SUBSCRIPTION_EVENT_SERVER) { + pa_context_get_server_info(context, serverInfoCb, data); + } else if (facility == PA_SUBSCRIPTION_EVENT_SINK) { pa_context_get_sink_info_by_index(context, idx, sinkInfoCb, data); } else if (facility == PA_SUBSCRIPTION_EVENT_SOURCE) { pa_context_get_source_info_by_index(context, idx, sourceInfoCb, data); @@ -131,15 +134,15 @@ */ void waybar::modules::Pulseaudio::sourceInfoCb(pa_context * /*context*/, const pa_source_info *i, int /*eol*/, void *data) { - if (i != nullptr) { - auto self = static_cast<waybar::modules::Pulseaudio *>(data); + auto pa = static_cast<waybar::modules::Pulseaudio *>(data); + if (i != nullptr && pa->default_source_name_ == i->name) { auto source_volume = static_cast<float>(pa_cvolume_avg(&(i->volume))) / float{PA_VOLUME_NORM}; - self->source_volume_ = std::round(source_volume * 100.0F); - self->source_idx_ = i->index; - self->source_muted_ = i->mute != 0; - self->source_desc_ = i->description; - self->source_port_name_ = i->active_port != nullptr ? i->active_port->name : "Unknown"; - self->dp.emit(); + pa->source_volume_ = std::round(source_volume * 100.0F); + pa->source_idx_ = i->index; + pa->source_muted_ = i->mute != 0; + pa->source_desc_ = i->description; + pa->source_port_name_ = i->active_port != nullptr ? i->active_port->name : "Unknown"; + pa->dp.emit(); } } @@ -147,9 +150,9 @@ * Called when the requested sink information is ready. */ void waybar::modules::Pulseaudio::sinkInfoCb(pa_context * /*context*/, const pa_sink_info *i, - int /*eol*/, void * data) { - if (i != nullptr) { - auto pa = static_cast<waybar::modules::Pulseaudio *>(data); + int /*eol*/, void *data) { + auto pa = static_cast<waybar::modules::Pulseaudio *>(data); + if (i != nullptr && pa->default_sink_name_ == i->name) { pa->pa_volume_ = i->volume; float volume = static_cast<float>(pa_cvolume_avg(&(pa->pa_volume_))) / float{PA_VOLUME_NORM}; pa->sink_idx_ = i->index; @@ -171,6 +174,10 @@ */ void waybar::modules::Pulseaudio::serverInfoCb(pa_context *context, const pa_server_info *i, void *data) { + auto pa = static_cast<waybar::modules::Pulseaudio *>(data); + pa->default_sink_name_ = i->default_sink_name; + pa->default_source_name_ = i->default_source_name; + pa_context_get_sink_info_by_name(context, i->default_sink_name, sinkInfoCb, data); pa_context_get_source_info_by_name(context, i->default_source_name, sourceInfoCb, data); } @@ -200,21 +207,27 @@ auto waybar::modules::Pulseaudio::update() -> void { auto format = format_; - std::string format_name = "format"; - if (monitor_.find("a2dp_sink") != std::string::npos) { - format_name = format_name + "-bluetooth"; - label_.get_style_context()->add_class("bluetooth"); - } else { - label_.get_style_context()->remove_class("bluetooth"); - } - if (muted_ ) { - format_name = format_name + "-muted"; - label_.get_style_context()->add_class("muted"); - } else { - label_.get_style_context()->remove_class("muted"); + if (!alt_) { + std::string format_name = "format"; + if (monitor_.find("a2dp_sink") != std::string::npos) { + format_name = format_name + "-bluetooth"; + label_.get_style_context()->add_class("bluetooth"); + } else { + label_.get_style_context()->remove_class("bluetooth"); + } + if (muted_) { + // Check muted bluetooth format exist, otherwise fallback to default muted format + if (format_name != "format" && !config_[format_name + "-muted"].isString()) { + format_name = "format"; + } + format_name = format_name + "-muted"; + label_.get_style_context()->add_class("muted"); + } else { + label_.get_style_context()->remove_class("muted"); + } + format = + config_[format_name].isString() ? config_[format_name].asString() : format; } - format = - config_[format_name].isString() ? config_[format_name].asString() : format; // TODO: find a better way to split source/sink std::string format_source = "{volume}%"; if (source_muted_ && config_["format-source-muted"].isString()) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/src/modules/sni/tray.cpp new/Waybar-0.9.2/src/modules/sni/tray.cpp --- old/Waybar-0.9.1/src/modules/sni/tray.cpp 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/src/modules/sni/tray.cpp 2020-04-11 12:24:49.000000000 +0200 @@ -6,7 +6,7 @@ Tray::Tray(const std::string& id, const Bar& bar, const Json::Value& config) : AModule(config, "tray", id), box_(bar.vertical ? Gtk::ORIENTATION_VERTICAL : Gtk::ORIENTATION_HORIZONTAL, 0), - watcher_(nb_hosts_), + watcher_(SNI::Watcher::getInstance()), host_(nb_hosts_, config, std::bind(&Tray::onAdd, this, std::placeholders::_1), std::bind(&Tray::onRemove, this, std::placeholders::_1)) { spdlog::warn( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/src/modules/sni/watcher.cpp new/Waybar-0.9.2/src/modules/sni/watcher.cpp --- old/Waybar-0.9.1/src/modules/sni/watcher.cpp 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/src/modules/sni/watcher.cpp 2020-04-11 12:24:49.000000000 +0200 @@ -3,14 +3,13 @@ using namespace waybar::modules::SNI; -Watcher::Watcher(std::size_t id) +Watcher::Watcher() : bus_name_id_(Gio::DBus::own_name(Gio::DBus::BusType::BUS_TYPE_SESSION, "org.kde.StatusNotifierWatcher", sigc::mem_fun(*this, &Watcher::busAcquired), Gio::DBus::SlotNameAcquired(), Gio::DBus::SlotNameLost(), Gio::DBus::BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT | Gio::DBus::BUS_NAME_OWNER_FLAGS_REPLACE)), - watcher_id_(id), watcher_(sn_watcher_skeleton_new()) {} Watcher::~Watcher() { @@ -23,6 +22,7 @@ g_slist_free_full(items_, gfWatchFree); items_ = nullptr; } + Gio::DBus::unown_name(bus_name_id_); auto iface = G_DBUS_INTERFACE_SKELETON(watcher_); g_dbus_interface_skeleton_unexport(iface); } @@ -34,7 +34,7 @@ if (error != nullptr) { // Don't print an error when a watcher is already present if (error->code != 2) { - spdlog::error("Watcher {}: {}", watcher_id_, error->message); + spdlog::error("Watcher: {}", error->message); } g_error_free(error); return; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/src/modules/sway/workspaces.cpp new/Waybar-0.9.2/src/modules/sway/workspaces.cpp --- old/Waybar-0.9.1/src/modules/sway/workspaces.cpp 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/src/modules/sway/workspaces.cpp 2020-04-11 12:24:49.000000000 +0200 @@ -157,12 +157,13 @@ if (needReorder) { box_.reorder_child(button, it - workspaces_.begin()); } - std::string output = getIcon((*it)["name"].asString(), *it); + std::string output = (*it)["name"].asString(); if (config_["format"].isString()) { auto format = config_["format"].asString(); output = fmt::format(format, - fmt::arg("icon", output), - fmt::arg("name", trimWorkspaceName((*it)["name"].asString())), + fmt::arg("icon", getIcon(output, *it)), + fmt::arg("value", output), + fmt::arg("name", trimWorkspaceName(output)), fmt::arg("index", (*it)["num"].asString())); } if (!config_["disable-markup"].asBool()) { @@ -205,6 +206,8 @@ if (config_["format-icons"][key].isString() && node[key].asBool()) { return config_["format-icons"][key].asString(); } + } else if (config_["format_icons"]["persistent"].isString() && node["target_output"].isString()) { + return config_["format-icons"]["persistent"].asString(); } else if (config_["format-icons"][key].isString()) { return config_["format-icons"][key].asString(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/src/modules/temperature.cpp new/Waybar-0.9.2/src/modules/temperature.cpp --- old/Waybar-0.9.1/src/modules/temperature.cpp 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/src/modules/temperature.cpp 2020-04-11 12:24:49.000000000 +0200 @@ -1,9 +1,12 @@ #include "modules/temperature.hpp" +#include <filesystem> waybar::modules::Temperature::Temperature(const std::string& id, const Json::Value& config) : ALabel(config, "temperature", id, "{temperatureC}°C", 10) { if (config_["hwmon-path"].isString()) { file_path_ = config_["hwmon-path"].asString(); + } else if (config_["hwmon-path-abs"].isString() && config_["input-filename"].isString()) { + file_path_ = (*std::filesystem::directory_iterator(config_["hwmon-path-abs"].asString())).path().u8string() + "/" + config_["input-filename"].asString(); } else { auto zone = config_["thermal-zone"].isInt() ? config_["thermal-zone"].asInt() : 0; file_path_ = fmt::format("/sys/class/thermal/thermal_zone{}/temp", zone); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/subprojects/fmt.wrap new/Waybar-0.9.2/subprojects/fmt.wrap --- old/Waybar-0.9.1/subprojects/fmt.wrap 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/subprojects/fmt.wrap 1970-01-01 01:00:00.000000000 +0100 @@ -1,10 +0,0 @@ -[wrap-file] -directory = fmt-5.3.0 - -source_url = https://github.com/fmtlib/fmt/archive/5.3.0.tar.gz -source_filename = fmt-5.3.0.tar.gz -source_hash = defa24a9af4c622a7134076602070b45721a43c51598c8456ec6f2c4dbb51c89 - -patch_url = https://github.com/mesonbuild/fmt/releases/download/5.3.0-1/fmt.zip -patch_filename = fmt-5.3.0-1-wrap.zip -patch_hash = 18f21a3b8833949c35d4ac88a7059577d5fa24b98786e4b1b2d3d81bb811440f \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/subprojects/gtk-layer-shell.wrap new/Waybar-0.9.2/subprojects/gtk-layer-shell.wrap --- old/Waybar-0.9.1/subprojects/gtk-layer-shell.wrap 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/subprojects/gtk-layer-shell.wrap 1970-01-01 01:00:00.000000000 +0100 @@ -1,5 +0,0 @@ -[wrap-file] -directory = gtk-layer-shell-0.1.0 -source_filename = gtk-layer-shell-0.1.0.tar.gz -source_hash = f7569e27ae30b1a94c3ad6c955cf56240d6bc272b760d9d266ce2ccdb94a5cf0 -source_url = https://github.com/wmww/gtk-layer-shell/archive/v0.1.0/gtk-layer-shell-0.1.0.tar.gz Binary files old/Waybar-0.9.1/subprojects/packagecache/date-2.4.1.tar.gz and new/Waybar-0.9.2/subprojects/packagecache/date-2.4.1.tar.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Waybar-0.9.1/subprojects/spdlog.wrap new/Waybar-0.9.2/subprojects/spdlog.wrap --- old/Waybar-0.9.1/subprojects/spdlog.wrap 2020-02-11 00:47:23.000000000 +0100 +++ new/Waybar-0.9.2/subprojects/spdlog.wrap 1970-01-01 01:00:00.000000000 +0100 @@ -1,10 +0,0 @@ -[wrap-file] -directory = spdlog-1.3.1 - -source_url = https://github.com/gabime/spdlog/archive/v1.3.1.tar.gz -source_filename = v1.3.1.tar.gz -source_hash = 160845266e94db1d4922ef755637f6901266731c4cb3b30b45bf41efa0e6ab70 - -patch_url = https://github.com/mesonbuild/spdlog/releases/download/1.3.1-1/spdlog.zip -patch_filename = spdlog-1.3.1-1-wrap.zip -patch_hash = 715a0229781019b853d409cc0bf891ee4b9d3a17bec0cf87f4ad30b28bbecc87
