fix(bar): multi screens
parent
6fb25ade7e
commit
01cec9fcb7
|
@ -18,7 +18,7 @@ class Bar {
|
||||||
public:
|
public:
|
||||||
Bar(const Client&, std::unique_ptr<struct wl_output *>&&, uint32_t);
|
Bar(const Client&, std::unique_ptr<struct wl_output *>&&, uint32_t);
|
||||||
Bar(const Bar&) = delete;
|
Bar(const Bar&) = delete;
|
||||||
~Bar();
|
~Bar() = default;
|
||||||
|
|
||||||
auto toggle() -> void;
|
auto toggle() -> void;
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ window#waybar {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#battery.warning:not(.charging) {
|
#battery.critical:not(.charging) {
|
||||||
background: #f53c3c;
|
background: #f53c3c;
|
||||||
color: white;
|
color: white;
|
||||||
animation-name: blink;
|
animation-name: blink;
|
||||||
|
|
19
src/bar.cpp
19
src/bar.cpp
|
@ -35,11 +35,6 @@ waybar::Bar::Bar(const Client& client,
|
||||||
surface = gdk_wayland_window_get_wl_surface(gdk_window);
|
surface = gdk_wayland_window_get_wl_surface(gdk_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
waybar::Bar::~Bar()
|
|
||||||
{
|
|
||||||
destroyOutput();
|
|
||||||
}
|
|
||||||
|
|
||||||
void waybar::Bar::initBar()
|
void waybar::Bar::initBar()
|
||||||
{
|
{
|
||||||
std::size_t layer_top = config_["layer"] == "top"
|
std::size_t layer_top = config_["layer"] == "top"
|
||||||
|
@ -72,17 +67,6 @@ void waybar::Bar::initBar()
|
||||||
setupWidgets();
|
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*/,
|
void waybar::Bar::handleLogicalPosition(void* /*data*/,
|
||||||
struct zxdg_output_v1* /*zxdg_output_v1*/, int32_t /*x*/, int32_t /*y*/)
|
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_);
|
found = o->isValidOutput(o->config_);
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
o->destroyOutput();
|
wl_output_destroy(*o->output);
|
||||||
|
zxdg_output_v1_destroy(o->xdg_output_);
|
||||||
} else {
|
} else {
|
||||||
o->initBar();
|
o->initBar();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue