Merge branch 'Alexays:master' into hyprland/windowcount
This commit is contained in:
6
flake.lock
generated
6
flake.lock
generated
@ -18,11 +18,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1727634051,
|
||||
"narHash": "sha256-S5kVU7U82LfpEukbn/ihcyNt2+EvG7Z5unsKW9H/yFA=",
|
||||
"lastModified": 1730200266,
|
||||
"narHash": "sha256-l253w0XMT8nWHGXuXqyiIC/bMvh1VRszGXgdpQlfhvU=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "06cf0e1da4208d3766d898b7fdab6513366d45b9",
|
||||
"rev": "807e9154dcb16384b1b765ebe9cd2bba2ac287fd",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -18,6 +18,7 @@ class Temperature : public ALabel {
|
||||
private:
|
||||
float getTemperature();
|
||||
bool isCritical(uint16_t);
|
||||
bool isWarning(uint16_t);
|
||||
|
||||
std::string file_path_;
|
||||
util::SleeperThread thread_;
|
||||
|
@ -38,6 +38,8 @@ class AudioBackend {
|
||||
std::string desc_;
|
||||
std::string monitor_;
|
||||
std::string current_sink_name_;
|
||||
std::string default_sink_name;
|
||||
bool default_sink_running_;
|
||||
bool current_sink_running_;
|
||||
// SOURCE
|
||||
uint32_t source_idx_{0};
|
||||
|
@ -31,6 +31,10 @@ Addressed by *temperature*
|
||||
typeof: string ++
|
||||
The temperature filename of your *hwmon-path-abs*, e.g. *temp1_input*
|
||||
|
||||
*warning-threshold*: ++
|
||||
typeof: integer ++
|
||||
The threshold before it is considered warning (Celsius).
|
||||
|
||||
*critical-threshold*: ++
|
||||
typeof: integer ++
|
||||
The threshold before it is considered critical (Celsius).
|
||||
@ -40,6 +44,10 @@ Addressed by *temperature*
|
||||
default: 10 ++
|
||||
The interval in which the information gets polled.
|
||||
|
||||
*format-warning*: ++
|
||||
typeof: string ++
|
||||
The format to use when temperature is considered warning
|
||||
|
||||
*format-critical*: ++
|
||||
typeof: string ++
|
||||
The format to use when temperature is considered critical
|
||||
|
@ -181,6 +181,19 @@ A minimal *config* file could look like this:
|
||||
}
|
||||
```
|
||||
|
||||
# SIGNALS
|
||||
|
||||
Waybar accepts the following signals:
|
||||
|
||||
*SIGUSR1*
|
||||
Toggles the bar visibility (hides if shown, shows if hidden)
|
||||
*SIGUSR2*
|
||||
Reloads (resets) the bar
|
||||
*SIGINT*
|
||||
Quits the bar
|
||||
|
||||
For example, to toggle the bar programmatically, you can invoke `killall -SIGUSR1 waybar`.
|
||||
|
||||
# MULTI OUTPUT CONFIGURATION
|
||||
|
||||
## Limit a configuration to some outputs
|
||||
|
@ -107,6 +107,10 @@ int main(int argc, char* argv[]) {
|
||||
ret = client->main(argc, argv);
|
||||
} while (reload);
|
||||
|
||||
std::signal(SIGUSR1, SIG_IGN);
|
||||
std::signal(SIGUSR2, SIG_IGN);
|
||||
std::signal(SIGINT, SIG_IGN);
|
||||
|
||||
delete client;
|
||||
return ret;
|
||||
} catch (const std::exception& e) {
|
||||
|
@ -18,6 +18,9 @@ namespace waybar::modules::hyprland {
|
||||
std::filesystem::path IPC::socketFolder_;
|
||||
|
||||
std::filesystem::path IPC::getSocketFolder(const char* instanceSig) {
|
||||
static std::mutex folderMutex;
|
||||
std::unique_lock lock(folderMutex);
|
||||
|
||||
// socket path, specified by EventManager of Hyprland
|
||||
if (!socketFolder_.empty()) {
|
||||
return socketFolder_;
|
||||
|
@ -191,12 +191,6 @@ void Window::queryActiveWorkspace() {
|
||||
solo_ = true;
|
||||
}
|
||||
|
||||
// Grouped windows have a tab bar and therefore don't look fullscreen or solo
|
||||
if (windowData_.grouped) {
|
||||
fullscreen_ = false;
|
||||
solo_ = false;
|
||||
}
|
||||
|
||||
if (solo_) {
|
||||
soloClass_ = windowData_.class_name;
|
||||
} else {
|
||||
|
@ -69,12 +69,17 @@ auto waybar::modules::Temperature::update() -> void {
|
||||
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 warning = isWarning(temperature_c);
|
||||
auto format = format_;
|
||||
if (critical) {
|
||||
format = config_["format-critical"].isString() ? config_["format-critical"].asString() : format;
|
||||
label_.get_style_context()->add_class("critical");
|
||||
} else {
|
||||
} else if (warning) {
|
||||
format = config_["format-warning"].isString() ? config_["format-warning"].asString() : format;
|
||||
label_.get_style_context()->add_class("warning");
|
||||
} else {
|
||||
label_.get_style_context()->remove_class("critical");
|
||||
label_.get_style_context()->remove_class("warning");
|
||||
}
|
||||
|
||||
if (format.empty()) {
|
||||
@ -135,7 +140,12 @@ float waybar::modules::Temperature::getTemperature() {
|
||||
#endif
|
||||
}
|
||||
|
||||
bool waybar::modules::Temperature::isWarning(uint16_t temperature_c) {
|
||||
return config_["warning-threshold"].isInt() &&
|
||||
temperature_c >= config_["warning-threshold"].asInt();
|
||||
}
|
||||
|
||||
bool waybar::modules::Temperature::isCritical(uint16_t temperature_c) {
|
||||
return config_["critical-threshold"].isInt() &&
|
||||
temperature_c >= config_["critical-threshold"].asInt();
|
||||
}
|
||||
}
|
@ -1,9 +1,12 @@
|
||||
#include "util/audio_backend.hpp"
|
||||
|
||||
#include <fmt/core.h>
|
||||
#include <pulse/def.h>
|
||||
#include <pulse/error.h>
|
||||
#include <pulse/introspect.h>
|
||||
#include <pulse/subscribe.h>
|
||||
#include <pulse/volume.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
@ -139,6 +142,10 @@ void AudioBackend::sinkInfoCb(pa_context * /*context*/, const pa_sink_info *i, i
|
||||
void *data) {
|
||||
if (i == nullptr) return;
|
||||
|
||||
auto running = i->state == PA_SINK_RUNNING;
|
||||
auto idle = i->state == PA_SINK_IDLE;
|
||||
spdlog::trace("Sink name {} Running:[{}] Idle:[{}]", i->name, running, idle);
|
||||
|
||||
auto *backend = static_cast<AudioBackend *>(data);
|
||||
|
||||
if (!backend->ignored_sinks_.empty()) {
|
||||
@ -155,11 +162,19 @@ void AudioBackend::sinkInfoCb(pa_context * /*context*/, const pa_sink_info *i, i
|
||||
}
|
||||
}
|
||||
|
||||
if (backend->current_sink_name_ == i->name) {
|
||||
backend->current_sink_running_ = i->state == PA_SINK_RUNNING;
|
||||
backend->default_sink_running_ = backend->default_sink_name == i->name &&
|
||||
(i->state == PA_SINK_RUNNING || i->state == PA_SINK_IDLE);
|
||||
|
||||
if (i->name != backend->default_sink_name && !backend->default_sink_running_) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!backend->current_sink_running_ && i->state == PA_SINK_RUNNING) {
|
||||
if (backend->current_sink_name_ == i->name) {
|
||||
backend->current_sink_running_ = (i->state == PA_SINK_RUNNING || i->state == PA_SINK_IDLE);
|
||||
}
|
||||
|
||||
if (!backend->current_sink_running_ &&
|
||||
(i->state == PA_SINK_RUNNING || i->state == PA_SINK_IDLE)) {
|
||||
backend->current_sink_name_ = i->name;
|
||||
backend->current_sink_running_ = true;
|
||||
}
|
||||
@ -207,6 +222,7 @@ void AudioBackend::sourceInfoCb(pa_context * /*context*/, const pa_source_info *
|
||||
void AudioBackend::serverInfoCb(pa_context *context, const pa_server_info *i, void *data) {
|
||||
auto *backend = static_cast<AudioBackend *>(data);
|
||||
backend->current_sink_name_ = i->default_sink_name;
|
||||
backend->default_sink_name = i->default_sink_name;
|
||||
backend->default_source_name_ = i->default_source_name;
|
||||
|
||||
pa_context_get_sink_info_list(context, sinkInfoCb, data);
|
||||
|
Reference in New Issue
Block a user