Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions include/util/SafeSignal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
#include <type_traits>
#include <utility>

#ifdef __OpenBSD__
#define SIGRTMIN SIGUSR1 - 1
#define SIGRTMAX SIGUSR1 + 1
#endif

namespace waybar {

/**
Expand Down
6 changes: 5 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ static void catchSignals(waybar::SafeSignal<int>& signal_handler) {
std::signal(SIGINT, writeSignalToPipe);
std::signal(SIGCHLD, writeSignalToPipe);

#ifdef SIGRTMIN
for (int sig = SIGRTMIN + 1; sig <= SIGRTMAX; ++sig) {
std::signal(sig, writeSignalToPipe);
}
#endif

while (true) {
int signum;
Expand Down Expand Up @@ -119,13 +121,15 @@ void handleUserSignal(int signal, bool& reload) {
// If this signal should restart or close the bar, this function will write
// `true` or `false`, respectively, into `reload`.
static void handleSignalMainThread(int signum, bool& reload) {
#ifdef SIGRTMIN
if (signum >= SIGRTMIN + 1 && signum <= SIGRTMAX) {
for (auto& bar : waybar::Client::inst()->bars) {
bar->handleSignal(signum);
}
return;
}

#endif

switch (signum) {
case SIGUSR1:
handleUserSignal(SIGUSR1, reload);
Expand Down
2 changes: 2 additions & 0 deletions src/modules/custom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,11 @@ void waybar::modules::Custom::waitingWorker() {
}

void waybar::modules::Custom::refresh(int sig) {
#ifdef SIGRTMIN
if (config_["signal"].isInt() && sig == SIGRTMIN + config_["signal"].asInt()) {
thread_.wake_up();
}
#endif
}

void waybar::modules::Custom::handleEvent() {
Expand Down
2 changes: 2 additions & 0 deletions src/modules/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ void waybar::modules::Image::delayWorker() {
}

void waybar::modules::Image::refresh(int sig) {
#ifdef SIGRTMIN
if (config_["signal"].isInt() && sig == SIGRTMIN + config_["signal"].asInt()) {
thread_.wake_up();
}
#endif
}

auto waybar::modules::Image::update() -> void {
Expand Down
Loading