Merge branch 'master' into patch-1
commit
25648ed9c0
|
@ -3,4 +3,4 @@
|
||||||
FROM archlinux/base:latest
|
FROM archlinux/base:latest
|
||||||
|
|
||||||
RUN pacman -Syu --noconfirm && \
|
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
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
FROM debian:sid
|
FROM debian:sid
|
||||||
|
|
||||||
RUN apt-get update && \
|
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
|
apt-get clean
|
||||||
|
|
|
@ -14,8 +14,8 @@ class Temperature : public ALabel {
|
||||||
auto update() -> void;
|
auto update() -> void;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::tuple<uint16_t, uint16_t> getTemperature();
|
float getTemperature();
|
||||||
bool isCritical(uint16_t);
|
bool isCritical(uint16_t);
|
||||||
|
|
||||||
std::string file_path_;
|
std::string file_path_;
|
||||||
util::SleeperThread thread_;
|
util::SleeperThread thread_;
|
||||||
|
|
|
@ -84,7 +84,7 @@ Addressed by *bluetooth*
|
||||||
"format-icons": {
|
"format-icons": {
|
||||||
"enabled": "",
|
"enabled": "",
|
||||||
"disabled": ""
|
"disabled": ""
|
||||||
}
|
},
|
||||||
"tooltip-format": "{status}"
|
"tooltip-format": "{status}"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
|
@ -44,7 +44,7 @@ Addressed by *temperature*
|
||||||
*format*: ++
|
*format*: ++
|
||||||
typeof: string ++
|
typeof: string ++
|
||||||
default: {temperatureC}°C ++
|
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*: ++
|
*format-icons*: ++
|
||||||
typeof: array ++
|
typeof: array ++
|
||||||
|
@ -97,6 +97,8 @@ Addressed by *temperature*
|
||||||
|
|
||||||
*{temperatureF}*: Temperature in Fahrenheit.
|
*{temperatureF}*: Temperature in Fahrenheit.
|
||||||
|
|
||||||
|
*{temperatureK}*: Temperature in Kelvin.
|
||||||
|
|
||||||
# EXAMPLES
|
# EXAMPLES
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -15,7 +15,7 @@ Valid locations for this file are:
|
||||||
- *~/waybar/config*
|
- *~/waybar/config*
|
||||||
- */etc/xdg/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.
|
Also a minimal example configuration can be found on the at the bottom of this man page.
|
||||||
|
|
||||||
# BAR CONFIGURATION
|
# BAR CONFIGURATION
|
||||||
|
|
|
@ -226,6 +226,7 @@ if scdoc.found()
|
||||||
'waybar-temperature.5.scd',
|
'waybar-temperature.5.scd',
|
||||||
'waybar-tray.5.scd',
|
'waybar-tray.5.scd',
|
||||||
'waybar-states.5.scd',
|
'waybar-states.5.scd',
|
||||||
|
'waybar-bluetooth.5.scd',
|
||||||
]
|
]
|
||||||
|
|
||||||
foreach filename : man_files
|
foreach filename : man_files
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
#include "modules/backlight.hpp"
|
#include "modules/backlight.hpp"
|
||||||
|
|
||||||
|
#include <fmt/format.h>
|
||||||
|
#include <libudev.h>
|
||||||
|
#include <sys/epoll.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <libudev.h>
|
|
||||||
|
|
||||||
#include <sys/epoll.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include <fmt/format.h>
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class FileDescriptor {
|
class FileDescriptor {
|
||||||
public:
|
public:
|
||||||
|
@ -213,7 +211,7 @@ void waybar::modules::Backlight::upsert_device(ForwardIt first, ForwardIt last,
|
||||||
check_nn(name);
|
check_nn(name);
|
||||||
|
|
||||||
const char *actual_brightness_attr =
|
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);
|
const char *actual = udev_device_get_sysattr_value(dev, actual_brightness_attr);
|
||||||
check_nn(actual);
|
check_nn(actual);
|
||||||
|
|
|
@ -119,7 +119,7 @@ const std::tuple<uint8_t, float, std::string> waybar::modules::Battery::getInfos
|
||||||
if (config_["full-at"].isUInt()) {
|
if (config_["full-at"].isUInt()) {
|
||||||
auto full_at = config_["full-at"].asUInt();
|
auto full_at = config_["full-at"].asUInt();
|
||||||
if (full_at < 100) {
|
if (full_at < 100) {
|
||||||
capacity = static_cast<float>(capacity / full_at) * 100;
|
capacity = 100.f * capacity / full_at;
|
||||||
if (capacity > full_at) {
|
if (capacity > full_at) {
|
||||||
capacity = full_at;
|
capacity = full_at;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,10 @@ waybar::modules::Temperature::Temperature(const std::string& id, const Json::Val
|
||||||
}
|
}
|
||||||
|
|
||||||
auto waybar::modules::Temperature::update() -> void {
|
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 critical = isCritical(temperature_c);
|
||||||
auto format = format_;
|
auto format = format_;
|
||||||
if (critical) {
|
if (critical) {
|
||||||
|
@ -35,12 +38,13 @@ auto waybar::modules::Temperature::update() -> void {
|
||||||
label_.set_markup(fmt::format(format,
|
label_.set_markup(fmt::format(format,
|
||||||
fmt::arg("temperatureC", temperature_c),
|
fmt::arg("temperatureC", temperature_c),
|
||||||
fmt::arg("temperatureF", temperature_f),
|
fmt::arg("temperatureF", temperature_f),
|
||||||
|
fmt::arg("temperatureK", temperature_k),
|
||||||
fmt::arg("icon", getIcon(temperature_c, "", max_temp))));
|
fmt::arg("icon", getIcon(temperature_c, "", max_temp))));
|
||||||
// Call parent update
|
// Call parent update
|
||||||
ALabel::update();
|
ALabel::update();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::tuple<uint16_t, uint16_t> waybar::modules::Temperature::getTemperature() {
|
float waybar::modules::Temperature::getTemperature() {
|
||||||
std::ifstream temp(file_path_);
|
std::ifstream temp(file_path_);
|
||||||
if (!temp.is_open()) {
|
if (!temp.is_open()) {
|
||||||
throw std::runtime_error("Can't open " + file_path_);
|
throw std::runtime_error("Can't open " + file_path_);
|
||||||
|
@ -51,9 +55,7 @@ std::tuple<uint16_t, uint16_t> waybar::modules::Temperature::getTemperature() {
|
||||||
}
|
}
|
||||||
temp.close();
|
temp.close();
|
||||||
auto temperature_c = std::strtol(line.c_str(), nullptr, 10) / 1000.0;
|
auto temperature_c = std::strtol(line.c_str(), nullptr, 10) / 1000.0;
|
||||||
auto temperature_f = temperature_c * 1.8 + 32;
|
return temperature_c;
|
||||||
std::tuple<uint16_t, uint16_t> temperatures(std::round(temperature_c), std::round(temperature_f));
|
|
||||||
return temperatures;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool waybar::modules::Temperature::isCritical(uint16_t temperature_c) {
|
bool waybar::modules::Temperature::isCritical(uint16_t temperature_c) {
|
||||||
|
|
Loading…
Reference in New Issue