fix(bar): multi screens

This commit is contained in:
Alex 2019-02-04 22:09:01 +01:00
parent 6fb25ade7e
commit 01cec9fcb7
3 changed files with 4 additions and 19 deletions

View File

@ -18,7 +18,7 @@ class Bar {
public:
Bar(const Client&, std::unique_ptr<struct wl_output *>&&, uint32_t);
Bar(const Bar&) = delete;
~Bar();
~Bar() = default;
auto toggle() -> void;

View File

@ -55,7 +55,7 @@ window#waybar {
}
}
#battery.warning:not(.charging) {
#battery.critical:not(.charging) {
background: #f53c3c;
color: white;
animation-name: blink;

View File

@ -35,11 +35,6 @@ waybar::Bar::Bar(const Client& client,
surface = gdk_wayland_window_get_wl_surface(gdk_window);
}
waybar::Bar::~Bar()
{
destroyOutput();
}
void waybar::Bar::initBar()
{
std::size_t layer_top = config_["layer"] == "top"
@ -72,17 +67,6 @@ void waybar::Bar::initBar()
setupWidgets();
}
void waybar::Bar::destroyOutput()
{
if (layer_surface != nullptr) {
zwlr_layer_surface_v1_destroy(layer_surface);
}
if (surface != nullptr) {
wl_surface_destroy(surface);
}
wl_output_destroy(*output);
}
void waybar::Bar::handleLogicalPosition(void* /*data*/,
struct zxdg_output_v1* /*zxdg_output_v1*/, int32_t /*x*/, int32_t /*y*/)
{
@ -141,7 +125,8 @@ void waybar::Bar::handleName(void* data, struct zxdg_output_v1* /*xdg_output*/,
found = o->isValidOutput(o->config_);
}
if (!found) {
o->destroyOutput();
wl_output_destroy(*o->output);
zxdg_output_v1_destroy(o->xdg_output_);
} else {
o->initBar();
}