Merge branch 'master' into master
commit
392b0679c9
|
@ -19,6 +19,7 @@ class Client {
|
||||||
public:
|
public:
|
||||||
static Client *inst();
|
static Client *inst();
|
||||||
int main(int argc, char *argv[]);
|
int main(int argc, char *argv[]);
|
||||||
|
void reset();
|
||||||
|
|
||||||
Glib::RefPtr<Gtk::Application> gtk_app;
|
Glib::RefPtr<Gtk::Application> gtk_app;
|
||||||
Glib::RefPtr<Gdk::Display> gdk_display;
|
Glib::RefPtr<Gdk::Display> gdk_display;
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <json/json.h>
|
#include <json/json.h>
|
||||||
|
#ifdef HAVE_LIBDATE
|
||||||
#include "modules/clock.hpp"
|
#include "modules/clock.hpp"
|
||||||
|
#else
|
||||||
|
#include "modules/simpleclock.hpp"
|
||||||
|
#endif
|
||||||
#ifdef HAVE_SWAY
|
#ifdef HAVE_SWAY
|
||||||
#include "modules/sway/mode.hpp"
|
#include "modules/sway/mode.hpp"
|
||||||
#include "modules/sway/window.hpp"
|
#include "modules/sway/window.hpp"
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <fmt/format.h>
|
||||||
|
#if FMT_VERSION < 60000
|
||||||
|
#include <fmt/time.h>
|
||||||
|
#else
|
||||||
|
#include <fmt/chrono.h>
|
||||||
|
#endif
|
||||||
|
#include "ALabel.hpp"
|
||||||
|
#include "util/sleeper_thread.hpp"
|
||||||
|
|
||||||
|
namespace waybar::modules {
|
||||||
|
|
||||||
|
class Clock : public ALabel {
|
||||||
|
public:
|
||||||
|
Clock(const std::string&, const Json::Value&);
|
||||||
|
~Clock() = default;
|
||||||
|
auto update() -> void;
|
||||||
|
|
||||||
|
private:
|
||||||
|
util::SleeperThread thread_;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace waybar::modules
|
|
@ -17,6 +17,10 @@ Addressed by *river/tags*
|
||||||
default: 9 ++
|
default: 9 ++
|
||||||
The number of tags that should be displayed.
|
The number of tags that should be displayed.
|
||||||
|
|
||||||
|
*tag-labels*: ++
|
||||||
|
typeof: array ++
|
||||||
|
The label to display for each tag.
|
||||||
|
|
||||||
# EXAMPLE
|
# EXAMPLE
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -50,6 +50,11 @@ Addressed by *temperature*
|
||||||
typeof: array ++
|
typeof: array ++
|
||||||
Based on the current temperature (Celsius) and *critical-threshold* if available, the corresponding icon gets selected. The order is *low* to *high*.
|
Based on the current temperature (Celsius) and *critical-threshold* if available, the corresponding icon gets selected. The order is *low* to *high*.
|
||||||
|
|
||||||
|
*tooltip-format*: ++
|
||||||
|
typeof: string ++
|
||||||
|
default: {temperatureC}°C ++
|
||||||
|
The format for the tooltip
|
||||||
|
|
||||||
*rotate*: ++
|
*rotate*: ++
|
||||||
typeof: integer ++
|
typeof: integer ++
|
||||||
Positive value to rotate the text label.
|
Positive value to rotate the text label.
|
||||||
|
|
14
meson.build
14
meson.build
|
@ -112,7 +112,11 @@ gtk_layer_shell = dependency('gtk-layer-shell-0',
|
||||||
required: get_option('gtk-layer-shell'),
|
required: get_option('gtk-layer-shell'),
|
||||||
fallback : ['gtk-layer-shell', 'gtk_layer_shell_dep'])
|
fallback : ['gtk-layer-shell', 'gtk_layer_shell_dep'])
|
||||||
systemd = dependency('systemd', required: get_option('systemd'))
|
systemd = dependency('systemd', required: get_option('systemd'))
|
||||||
tz_dep = dependency('date', default_options : [ 'use_system_tzdb=true' ], modules : [ 'date::date', 'date::date-tz' ], fallback: [ 'date', 'tz_dep' ])
|
tz_dep = dependency('date',
|
||||||
|
required: false,
|
||||||
|
default_options : [ 'use_system_tzdb=true' ],
|
||||||
|
modules : [ 'date::date', 'date::date-tz' ],
|
||||||
|
fallback: [ 'date', 'tz_dep' ])
|
||||||
|
|
||||||
prefix = get_option('prefix')
|
prefix = get_option('prefix')
|
||||||
sysconfdir = get_option('sysconfdir')
|
sysconfdir = get_option('sysconfdir')
|
||||||
|
@ -136,7 +140,6 @@ src_files = files(
|
||||||
'src/factory.cpp',
|
'src/factory.cpp',
|
||||||
'src/AModule.cpp',
|
'src/AModule.cpp',
|
||||||
'src/ALabel.cpp',
|
'src/ALabel.cpp',
|
||||||
'src/modules/clock.cpp',
|
|
||||||
'src/modules/custom.cpp',
|
'src/modules/custom.cpp',
|
||||||
'src/modules/disk.cpp',
|
'src/modules/disk.cpp',
|
||||||
'src/modules/idle_inhibitor.cpp',
|
'src/modules/idle_inhibitor.cpp',
|
||||||
|
@ -236,6 +239,13 @@ if get_option('rfkill').enabled()
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if tz_dep.found()
|
||||||
|
add_project_arguments('-DHAVE_LIBDATE', language: 'cpp')
|
||||||
|
src_files += 'src/modules/clock.cpp'
|
||||||
|
else
|
||||||
|
src_files += 'src/modules/simpleclock.cpp'
|
||||||
|
endif
|
||||||
|
|
||||||
subdir('protocol')
|
subdir('protocol')
|
||||||
|
|
||||||
executable(
|
executable(
|
||||||
|
|
|
@ -60,14 +60,14 @@ std::string ALabel::getIcon(uint16_t percentage, const std::string& alt, uint16_
|
||||||
std::string ALabel::getIcon(uint16_t percentage, std::vector<std::string>& alts, uint16_t max) {
|
std::string ALabel::getIcon(uint16_t percentage, std::vector<std::string>& alts, uint16_t max) {
|
||||||
auto format_icons = config_["format-icons"];
|
auto format_icons = config_["format-icons"];
|
||||||
if (format_icons.isObject()) {
|
if (format_icons.isObject()) {
|
||||||
|
std::string _alt = "default";
|
||||||
for (const auto& alt : alts) {
|
for (const auto& alt : alts) {
|
||||||
if (!alt.empty() && (format_icons[alt].isString() || format_icons[alt].isArray())) {
|
if (!alt.empty() && (format_icons[alt].isString() || format_icons[alt].isArray())) {
|
||||||
format_icons = format_icons[alt];
|
_alt = alt;
|
||||||
break;
|
break;
|
||||||
} else {
|
|
||||||
format_icons = format_icons["default"];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
format_icons = format_icons[_alt];
|
||||||
}
|
}
|
||||||
if (format_icons.isArray()) {
|
if (format_icons.isArray()) {
|
||||||
auto size = format_icons.size();
|
auto size = format_icons.size();
|
||||||
|
|
|
@ -303,10 +303,9 @@ int waybar::Client::main(int argc, char *argv[]) {
|
||||||
gtk_app->hold();
|
gtk_app->hold();
|
||||||
gtk_app->run();
|
gtk_app->run();
|
||||||
bars.clear();
|
bars.clear();
|
||||||
zxdg_output_manager_v1_destroy(xdg_output_manager);
|
|
||||||
zwlr_layer_shell_v1_destroy(layer_shell);
|
|
||||||
zwp_idle_inhibit_manager_v1_destroy(idle_inhibit_manager);
|
|
||||||
wl_registry_destroy(registry);
|
|
||||||
wl_display_disconnect(wl_display);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void waybar::Client::reset() {
|
||||||
|
gtk_app->quit();
|
||||||
|
}
|
||||||
|
|
15
src/main.cpp
15
src/main.cpp
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
std::mutex reap_mtx;
|
std::mutex reap_mtx;
|
||||||
std::list<pid_t> reap;
|
std::list<pid_t> reap;
|
||||||
|
volatile bool reload;
|
||||||
|
|
||||||
void* signalThread(void* args) {
|
void* signalThread(void* args) {
|
||||||
int err, signum;
|
int err, signum;
|
||||||
|
@ -70,12 +71,19 @@ void startSignalThread(void) {
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
try {
|
try {
|
||||||
auto client = waybar::Client::inst();
|
auto client = waybar::Client::inst();
|
||||||
|
|
||||||
std::signal(SIGUSR1, [](int /*signal*/) {
|
std::signal(SIGUSR1, [](int /*signal*/) {
|
||||||
for (auto& bar : waybar::Client::inst()->bars) {
|
for (auto& bar : waybar::Client::inst()->bars) {
|
||||||
bar->toggle();
|
bar->toggle();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
std::signal(SIGUSR2, [](int /*signal*/) {
|
||||||
|
spdlog::info("Reloading...");
|
||||||
|
reload = true;
|
||||||
|
waybar::Client::inst()->reset();
|
||||||
|
});
|
||||||
|
|
||||||
for (int sig = SIGRTMIN + 1; sig <= SIGRTMAX; ++sig) {
|
for (int sig = SIGRTMIN + 1; sig <= SIGRTMAX; ++sig) {
|
||||||
std::signal(sig, [](int sig) {
|
std::signal(sig, [](int sig) {
|
||||||
for (auto& bar : waybar::Client::inst()->bars) {
|
for (auto& bar : waybar::Client::inst()->bars) {
|
||||||
|
@ -85,7 +93,12 @@ int main(int argc, char* argv[]) {
|
||||||
}
|
}
|
||||||
startSignalThread();
|
startSignalThread();
|
||||||
|
|
||||||
auto ret = client->main(argc, argv);
|
auto ret = 0;
|
||||||
|
do {
|
||||||
|
reload = false;
|
||||||
|
ret = client->main(argc, argv);
|
||||||
|
} while (reload);
|
||||||
|
|
||||||
delete client;
|
delete client;
|
||||||
return ret;
|
return ret;
|
||||||
} catch (const std::exception& e) {
|
} catch (const std::exception& e) {
|
||||||
|
|
|
@ -15,8 +15,19 @@ auto waybar::modules::Cpu::update() -> void {
|
||||||
if (tooltipEnabled()) {
|
if (tooltipEnabled()) {
|
||||||
label_.set_tooltip_text(tooltip);
|
label_.set_tooltip_text(tooltip);
|
||||||
}
|
}
|
||||||
label_.set_markup(fmt::format(format_, fmt::arg("load", cpu_load), fmt::arg("usage", cpu_usage)));
|
auto format = format_;
|
||||||
getState(cpu_usage);
|
auto state = getState(cpu_usage);
|
||||||
|
if (!state.empty() && config_["format-" + state].isString()) {
|
||||||
|
format = config_["format-" + state].asString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (format.empty()) {
|
||||||
|
event_box_.hide();
|
||||||
|
} else {
|
||||||
|
event_box_.show();
|
||||||
|
label_.set_markup(fmt::format(format, fmt::arg("load", cpu_load), fmt::arg("usage", cpu_usage)));
|
||||||
|
}
|
||||||
|
|
||||||
// Call parent update
|
// Call parent update
|
||||||
ALabel::update();
|
ALabel::update();
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,17 @@ auto waybar::modules::Disk::update() -> void {
|
||||||
auto total = pow_format(stats.f_blocks * stats.f_frsize, "B", true);
|
auto total = pow_format(stats.f_blocks * stats.f_frsize, "B", true);
|
||||||
auto percentage_used = (stats.f_blocks - stats.f_bavail) * 100 / stats.f_blocks;
|
auto percentage_used = (stats.f_blocks - stats.f_bavail) * 100 / stats.f_blocks;
|
||||||
|
|
||||||
label_.set_markup(fmt::format(format_
|
auto format = format_;
|
||||||
|
auto state = getState(percentage_used);
|
||||||
|
if (!state.empty() && config_["format-" + state].isString()) {
|
||||||
|
format = config_["format-" + state].asString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (format.empty()) {
|
||||||
|
event_box_.hide();
|
||||||
|
} else {
|
||||||
|
event_box_.show();
|
||||||
|
label_.set_markup(fmt::format(format
|
||||||
, stats.f_bavail * 100 / stats.f_blocks
|
, stats.f_bavail * 100 / stats.f_blocks
|
||||||
, fmt::arg("free", free)
|
, fmt::arg("free", free)
|
||||||
, fmt::arg("percentage_free", stats.f_bavail * 100 / stats.f_blocks)
|
, fmt::arg("percentage_free", stats.f_bavail * 100 / stats.f_blocks)
|
||||||
|
@ -58,6 +68,8 @@ auto waybar::modules::Disk::update() -> void {
|
||||||
, fmt::arg("total", total)
|
, fmt::arg("total", total)
|
||||||
, fmt::arg("path", path_)
|
, fmt::arg("path", path_)
|
||||||
));
|
));
|
||||||
|
}
|
||||||
|
|
||||||
if (tooltipEnabled()) {
|
if (tooltipEnabled()) {
|
||||||
std::string tooltip_format = "{used} used out of {total} on {path} ({percentage_used}%)";
|
std::string tooltip_format = "{used} used out of {total} on {path} ({percentage_used}%)";
|
||||||
if (config_["tooltip-format"].isString()) {
|
if (config_["tooltip-format"].isString()) {
|
||||||
|
@ -73,8 +85,6 @@ auto waybar::modules::Disk::update() -> void {
|
||||||
, fmt::arg("path", path_)
|
, fmt::arg("path", path_)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
event_box_.show();
|
|
||||||
getState(percentage_used);
|
|
||||||
// Call parent update
|
// Call parent update
|
||||||
ALabel::update();
|
ALabel::update();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,13 +28,24 @@ auto waybar::modules::Memory::update() -> void {
|
||||||
auto used_ram_gigabytes = (memtotal - memfree) / std::pow(1024, 2);
|
auto used_ram_gigabytes = (memtotal - memfree) / std::pow(1024, 2);
|
||||||
auto available_ram_gigabytes = memfree / std::pow(1024, 2);
|
auto available_ram_gigabytes = memfree / std::pow(1024, 2);
|
||||||
|
|
||||||
getState(used_ram_percentage);
|
auto format = format_;
|
||||||
label_.set_markup(fmt::format(format_,
|
auto state = getState(used_ram_percentage);
|
||||||
|
if (!state.empty() && config_["format-" + state].isString()) {
|
||||||
|
format = config_["format-" + state].asString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (format.empty()) {
|
||||||
|
event_box_.hide();
|
||||||
|
} else {
|
||||||
|
event_box_.show();
|
||||||
|
label_.set_markup(fmt::format(format,
|
||||||
used_ram_percentage,
|
used_ram_percentage,
|
||||||
fmt::arg("total", total_ram_gigabytes),
|
fmt::arg("total", total_ram_gigabytes),
|
||||||
fmt::arg("percentage", used_ram_percentage),
|
fmt::arg("percentage", used_ram_percentage),
|
||||||
fmt::arg("used", used_ram_gigabytes),
|
fmt::arg("used", used_ram_gigabytes),
|
||||||
fmt::arg("avail", available_ram_gigabytes)));
|
fmt::arg("avail", available_ram_gigabytes)));
|
||||||
|
}
|
||||||
|
|
||||||
if (tooltipEnabled()) {
|
if (tooltipEnabled()) {
|
||||||
if (config_["tooltip-format"].isString()) {
|
if (config_["tooltip-format"].isString()) {
|
||||||
auto tooltip_format = config_["tooltip-format"].asString();
|
auto tooltip_format = config_["tooltip-format"].asString();
|
||||||
|
@ -48,7 +59,6 @@ auto waybar::modules::Memory::update() -> void {
|
||||||
label_.set_tooltip_text(fmt::format("{:.{}f}GiB used", used_ram_gigabytes, 1));
|
label_.set_tooltip_text(fmt::format("{:.{}f}GiB used", used_ram_gigabytes, 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
event_box_.show();
|
|
||||||
} else {
|
} else {
|
||||||
event_box_.hide();
|
event_box_.hide();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
#include <spdlog/spdlog.h>
|
#include <spdlog/spdlog.h>
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "client.hpp"
|
#include "client.hpp"
|
||||||
#include "modules/river/tags.hpp"
|
#include "modules/river/tags.hpp"
|
||||||
#include "river-status-unstable-v1-client-protocol.h"
|
#include "river-status-unstable-v1-client-protocol.h"
|
||||||
|
@ -64,8 +66,20 @@ Tags::Tags(const std::string &id, const waybar::Bar &bar, const Json::Value &con
|
||||||
|
|
||||||
// Default to 9 tags
|
// Default to 9 tags
|
||||||
const uint32_t num_tags = config["num-tags"].isUInt() ? config_["num-tags"].asUInt() : 9;
|
const uint32_t num_tags = config["num-tags"].isUInt() ? config_["num-tags"].asUInt() : 9;
|
||||||
for (uint32_t tag = 1; tag <= num_tags; ++tag) {
|
|
||||||
Gtk::Button &button = buttons_.emplace_back(std::to_string(tag));
|
std::vector<std::string> tag_labels(num_tags);
|
||||||
|
for (uint32_t tag = 0; tag < num_tags; ++tag) {
|
||||||
|
tag_labels[tag] = std::to_string(tag+1);
|
||||||
|
}
|
||||||
|
const Json::Value custom_labels = config["tag-labels"];
|
||||||
|
if (custom_labels.isArray() && !custom_labels.empty()) {
|
||||||
|
for (uint32_t tag = 0; tag < std::min(num_tags, custom_labels.size()); ++tag) {
|
||||||
|
tag_labels[tag] = custom_labels[tag].asString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto &tag_label : tag_labels) {
|
||||||
|
Gtk::Button &button = buttons_.emplace_back(tag_label);
|
||||||
button.set_relief(Gtk::RELIEF_NONE);
|
button.set_relief(Gtk::RELIEF_NONE);
|
||||||
box_.pack_start(button, false, false, 0);
|
box_.pack_start(button, false, false, 0);
|
||||||
button.show();
|
button.show();
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
#include "modules/simpleclock.hpp"
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
waybar::modules::Clock::Clock(const std::string& id, const Json::Value& config)
|
||||||
|
: ALabel(config, "clock", id, "{:%H:%M}", 60) {
|
||||||
|
thread_ = [this] {
|
||||||
|
dp.emit();
|
||||||
|
auto now = std::chrono::system_clock::now();
|
||||||
|
auto timeout = std::chrono::floor<std::chrono::seconds>(now + interval_);
|
||||||
|
auto diff = std::chrono::seconds(timeout.time_since_epoch().count() % interval_.count());
|
||||||
|
thread_.sleep_until(timeout - diff);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
auto waybar::modules::Clock::update() -> void {
|
||||||
|
tzset(); // Update timezone information
|
||||||
|
auto now = std::chrono::system_clock::now();
|
||||||
|
auto localtime = fmt::localtime(std::chrono::system_clock::to_time_t(now));
|
||||||
|
auto text = fmt::format(format_, localtime);
|
||||||
|
label_.set_markup(text);
|
||||||
|
|
||||||
|
if (tooltipEnabled()) {
|
||||||
|
if (config_["tooltip-format"].isString()) {
|
||||||
|
auto tooltip_format = config_["tooltip-format"].asString();
|
||||||
|
auto tooltip_text = fmt::format(tooltip_format, localtime);
|
||||||
|
label_.set_tooltip_text(tooltip_text);
|
||||||
|
} else {
|
||||||
|
label_.set_tooltip_text(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Call parent update
|
||||||
|
ALabel::update();
|
||||||
|
}
|
|
@ -40,6 +40,16 @@ auto waybar::modules::Temperature::update() -> void {
|
||||||
fmt::arg("temperatureF", temperature_f),
|
fmt::arg("temperatureF", temperature_f),
|
||||||
fmt::arg("temperatureK", temperature_k),
|
fmt::arg("temperatureK", temperature_k),
|
||||||
fmt::arg("icon", getIcon(temperature_c, "", max_temp))));
|
fmt::arg("icon", getIcon(temperature_c, "", max_temp))));
|
||||||
|
if (tooltipEnabled()) {
|
||||||
|
std::string tooltip_format = "{temperatureC}°C";
|
||||||
|
if (config_["tooltip-format"].isString()) {
|
||||||
|
tooltip_format = config_["tooltip-format"].asString();
|
||||||
|
}
|
||||||
|
label_.set_tooltip_text(fmt::format(tooltip_format,
|
||||||
|
fmt::arg("temperatureC", temperature_c),
|
||||||
|
fmt::arg("temperatureF", temperature_f),
|
||||||
|
fmt::arg("temperatureK", temperature_k)));
|
||||||
|
}
|
||||||
// Call parent update
|
// Call parent update
|
||||||
ALabel::update();
|
ALabel::update();
|
||||||
}
|
}
|
||||||
|
|
|
@ -367,16 +367,16 @@ void Task::handle_output_leave(struct wl_output *output)
|
||||||
void Task::handle_state(struct wl_array *state)
|
void Task::handle_state(struct wl_array *state)
|
||||||
{
|
{
|
||||||
state_ = 0;
|
state_ = 0;
|
||||||
for (auto* entry = static_cast<uint32_t*>(state->data);
|
size_t size = state->size / sizeof(uint32_t);
|
||||||
entry < static_cast<uint32_t*>(state->data) + state->size;
|
for (size_t i = 0; i < size; ++i) {
|
||||||
entry++) {
|
auto entry = static_cast<uint32_t*>(state->data)[i];
|
||||||
if (*entry == ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_MAXIMIZED)
|
if (entry == ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_MAXIMIZED)
|
||||||
state_ |= MAXIMIZED;
|
state_ |= MAXIMIZED;
|
||||||
if (*entry == ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_MINIMIZED)
|
if (entry == ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_MINIMIZED)
|
||||||
state_ |= MINIMIZED;
|
state_ |= MINIMIZED;
|
||||||
if (*entry == ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_ACTIVATED)
|
if (entry == ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_ACTIVATED)
|
||||||
state_ |= ACTIVE;
|
state_ |= ACTIVE;
|
||||||
if (*entry == ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_FULLSCREEN)
|
if (entry == ZWLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_FULLSCREEN)
|
||||||
state_ |= FULLSCREEN;
|
state_ |= FULLSCREEN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -637,10 +637,22 @@ Taskbar::Taskbar(const std::string &id, const waybar::Bar &bar, const Json::Valu
|
||||||
Taskbar::~Taskbar()
|
Taskbar::~Taskbar()
|
||||||
{
|
{
|
||||||
if (manager_) {
|
if (manager_) {
|
||||||
|
struct wl_display *display = Client::inst()->wl_display;
|
||||||
|
/*
|
||||||
|
* Send `stop` request and wait for one roundtrip.
|
||||||
|
* This is not quite correct as the protocol encourages us to wait for the .finished event,
|
||||||
|
* but it should work with wlroots foreign toplevel manager implementation.
|
||||||
|
*/
|
||||||
|
zwlr_foreign_toplevel_manager_v1_stop(manager_);
|
||||||
|
wl_display_roundtrip(display);
|
||||||
|
|
||||||
|
if (manager_) {
|
||||||
|
spdlog::warn("Foreign toplevel manager destroyed before .finished event");
|
||||||
zwlr_foreign_toplevel_manager_v1_destroy(manager_);
|
zwlr_foreign_toplevel_manager_v1_destroy(manager_);
|
||||||
manager_ = nullptr;
|
manager_ = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Taskbar::update()
|
void Taskbar::update()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue