From ff7a28274f509b77453f3282fa09e31456ecb52e Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 19 Apr 2020 19:19:21 +0200 Subject: [PATCH 1/9] chore(debian): update Dockerfile --- Dockerfiles/debian | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfiles/debian b/Dockerfiles/debian index eedbcfb..077aca8 100644 --- a/Dockerfiles/debian +++ b/Dockerfiles/debian @@ -3,5 +3,5 @@ FROM debian:sid RUN apt-get update && \ - 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 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 libdbusmenu-gtk3-dev libnl-3-dev libnl-genl-3-dev libpulse-dev libmpdclient-dev gobject-introspection && \ apt-get clean From 1814b3b593b90477ce198946e187c36d67771d7d Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 19 Apr 2020 19:52:03 +0200 Subject: [PATCH 2/9] chore(arch): update Dockerfile --- Dockerfiles/archlinux | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfiles/archlinux b/Dockerfiles/archlinux index b640ce7..d8ae16f 100644 --- a/Dockerfiles/archlinux +++ b/Dockerfiles/archlinux @@ -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 pugixml scdoc --noconfirm + pacman -S git meson base-devel libinput wayland wayland-protocols pixman libxkbcommon mesa gtkmm3 jsoncpp pugixml scdoc libpulse libdbusmenu-gtk3 libmpdclient --noconfirm From 82c3cccd7239801566081e096d885a82b23abe29 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 20 Apr 2020 14:04:02 +0200 Subject: [PATCH 3/9] fix(typo): man, remove trailing dot --- man/waybar.5.scd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/waybar.5.scd b/man/waybar.5.scd index 3981cb5..1e8004f 100644 --- a/man/waybar.5.scd +++ b/man/waybar.5.scd @@ -15,7 +15,7 @@ Valid locations for this file are: - *~/waybar/config* - */etc/xdg/waybar/config* -A good starting point is the default configuration found at https://github.com/Alexays/Waybar/blob/master/resources/config. +A good starting point is the default configuration found at https://github.com/Alexays/Waybar/blob/master/resources/config Also a minimal example configuration can be found on the at the bottom of this man page. # BAR CONFIGURATION From d30b775d2512f597dec71a787655beaffab4acbf Mon Sep 17 00:00:00 2001 From: Tobi Fuhrimann Date: Mon, 20 Apr 2020 15:23:03 +0200 Subject: [PATCH 4/9] Make bluetooth example valid --- 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 a07e544..8151ec0 100644 --- a/man/waybar-bluetooth.5.scd +++ b/man/waybar-bluetooth.5.scd @@ -84,7 +84,7 @@ Addressed by *bluetooth* "format-icons": { "enabled": "", "disabled": "" - } + }, "tooltip-format": "{status}" } ``` From df0d34dbd46d6e8dbccd981b0a51ec9867168f61 Mon Sep 17 00:00:00 2001 From: Alexander Kobel Date: Tue, 21 Apr 2020 00:53:36 +0200 Subject: [PATCH 5/9] Fix round to 0 or 1 in capacity computation with given full-at --- src/modules/battery.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/battery.cpp b/src/modules/battery.cpp index bad3355..6e86eaf 100644 --- a/src/modules/battery.cpp +++ b/src/modules/battery.cpp @@ -119,7 +119,7 @@ const std::tuple waybar::modules::Battery::getInfos if (config_["full-at"].isUInt()) { auto full_at = config_["full-at"].asUInt(); if (full_at < 100) { - capacity = static_cast(capacity / full_at) * 100; + capacity = 100.f * capacity / full_at; if (capacity > full_at) { capacity = full_at; } From e01a081f2f17376c55d6f5348cae3d8e940fc07f Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 21 Apr 2020 09:11:42 +0200 Subject: [PATCH 6/9] fix(brightness): amd brightness --- src/modules/backlight.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/modules/backlight.cpp b/src/modules/backlight.cpp index 6349dbb..3ebc6e7 100644 --- a/src/modules/backlight.cpp +++ b/src/modules/backlight.cpp @@ -1,16 +1,14 @@ #include "modules/backlight.hpp" +#include +#include +#include +#include + #include #include #include -#include - -#include -#include - -#include - namespace { class FileDescriptor { public: @@ -213,7 +211,7 @@ void waybar::modules::Backlight::upsert_device(ForwardIt first, ForwardIt last, check_nn(name); const char *actual_brightness_attr = - strcmp(name, "amdgpu_bl0") == 0 ? "brightness" : "actual_brightness"; + strncmp(name, "amdgpu_bl", 9) == 0 ? "brightness" : "actual_brightness"; const char *actual = udev_device_get_sysattr_value(dev, actual_brightness_attr); check_nn(actual); From 6e946bf872259330678b5296317c045dc276e3fe Mon Sep 17 00:00:00 2001 From: phosit Date: Sat, 25 Apr 2020 18:44:48 +0200 Subject: [PATCH 7/9] Add kelvin-scale --- include/modules/temperature.hpp | 4 ++-- src/modules/temperature.cpp | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/include/modules/temperature.hpp b/include/modules/temperature.hpp index 9a7ecc3..9f071a3 100644 --- a/include/modules/temperature.hpp +++ b/include/modules/temperature.hpp @@ -14,8 +14,8 @@ class Temperature : public ALabel { auto update() -> void; private: - std::tuple getTemperature(); - bool isCritical(uint16_t); + float getTemperature(); + bool isCritical(uint16_t); std::string file_path_; util::SleeperThread thread_; diff --git a/src/modules/temperature.cpp b/src/modules/temperature.cpp index d8307d7..bf0bd1c 100644 --- a/src/modules/temperature.cpp +++ b/src/modules/temperature.cpp @@ -22,7 +22,10 @@ waybar::modules::Temperature::Temperature(const std::string& id, const Json::Val } auto waybar::modules::Temperature::update() -> void { - auto [temperature_c, temperature_f] = getTemperature(); + auto temperature = getTemperature(); + uint16_t temperature_c = std::round(temperature); + uint16_t temperature_f = std::round(temperature * 1.8 + 32); + uint16_t temperature_k = std::round(temperature + 273.15); auto critical = isCritical(temperature_c); auto format = format_; if (critical) { @@ -35,12 +38,13 @@ auto waybar::modules::Temperature::update() -> void { label_.set_markup(fmt::format(format, fmt::arg("temperatureC", temperature_c), fmt::arg("temperatureF", temperature_f), + fmt::arg("temperatureK", temperature_k), fmt::arg("icon", getIcon(temperature_c, "", max_temp)))); // Call parent update ALabel::update(); } -std::tuple waybar::modules::Temperature::getTemperature() { +float waybar::modules::Temperature::getTemperature() { std::ifstream temp(file_path_); if (!temp.is_open()) { throw std::runtime_error("Can't open " + file_path_); @@ -51,9 +55,7 @@ std::tuple waybar::modules::Temperature::getTemperature() { } temp.close(); auto temperature_c = std::strtol(line.c_str(), nullptr, 10) / 1000.0; - auto temperature_f = temperature_c * 1.8 + 32; - std::tuple temperatures(std::round(temperature_c), std::round(temperature_f)); - return temperatures; + return temperature_c; } bool waybar::modules::Temperature::isCritical(uint16_t temperature_c) { From 7b18bfd1a7a16a2949713725b1ae9a6107391391 Mon Sep 17 00:00:00 2001 From: phosit Date: Sat, 25 Apr 2020 18:57:56 +0200 Subject: [PATCH 8/9] Add kelvin in man --- man/waybar-temperature.5.scd | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/man/waybar-temperature.5.scd b/man/waybar-temperature.5.scd index 7c25e88..8649736 100644 --- a/man/waybar-temperature.5.scd +++ b/man/waybar-temperature.5.scd @@ -44,7 +44,7 @@ Addressed by *temperature* *format*: ++ typeof: string ++ default: {temperatureC}°C ++ - The format (Celsius/Fahrenheit) in which the temperature should be displayed. + The format (Celsius/Fahrenheit/Kelvin) in which the temperature should be displayed. *format-icons*: ++ typeof: array ++ @@ -97,6 +97,8 @@ Addressed by *temperature* *{temperatureF}*: Temperature in Fahrenheit. +*{temperatureK}*: Temperature in Kelvin. + # EXAMPLES ``` From ea4dec96e69150c4f8451d57154504623e461d3c Mon Sep 17 00:00:00 2001 From: Diego GF Date: Tue, 28 Apr 2020 17:40:44 +0200 Subject: [PATCH 9/9] Build bluetooth module man page --- meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/meson.build b/meson.build index 0730ccd..d785dfd 100644 --- a/meson.build +++ b/meson.build @@ -226,6 +226,7 @@ if scdoc.found() 'waybar-temperature.5.scd', 'waybar-tray.5.scd', 'waybar-states.5.scd', + 'waybar-bluetooth.5.scd', ] foreach filename : man_files