diff --git a/src/bar.cpp b/src/bar.cpp index f180bc1..8294522 100644 --- a/src/bar.cpp +++ b/src/bar.cpp @@ -47,8 +47,8 @@ Bar::Bar(const wl_output *output) zwlr_layer_surface_v1_set_exclusive_zone(_layerSurface, barSize); wl_surface_commit(_surface); - for (auto i=1; i<=4; i++) { - _tags.push_back({ QString::number(i), i%2 == 0 }); + for (auto tag : tagNames) { + _tags.push_back({ tag, false }); } _windowTitle = "Window title"; _status = "Status"; diff --git a/src/common.hpp b/src/common.hpp index 666a59d..b5bf993 100644 --- a/src/common.hpp +++ b/src/common.hpp @@ -3,13 +3,16 @@ #pragma once #include +#include #include +#include #include "wlr-layer-shell-unstable-v1-client-protocol.h" extern wl_display *display; extern wl_compositor *compositor; extern wl_shm *shm; extern zwlr_layer_shell_v1 *wlrLayerShell; +extern std::vector tagNames; struct ColorScheme { QColor fg, bg; diff --git a/src/main.cpp b/src/main.cpp index 4f68ceb..4f34dd9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,6 +17,7 @@ #include #include "wlr-layer-shell-unstable-v1-client-protocol.h" #include "xdg-shell-client-protocol.h" +#include "net-tapesoftware-dwl-wm-unstable-v1-client-protocol.h" #include "common.hpp" #include "bar.hpp" @@ -31,6 +32,8 @@ wl_display *display; wl_compositor *compositor; wl_shm *shm; zwlr_layer_shell_v1 *wlrLayerShell; +znet_tapesoftware_dwl_wm_v1 *dwlWm; +std::vector tagNames; static std::optional bar; static std::string statusFifoName; static int statusFifoFd {-1}; @@ -106,6 +109,12 @@ static const struct wl_seat_listener seatListener = { [](void*, wl_seat*, const char *name) { } }; +static const struct znet_tapesoftware_dwl_wm_v1_listener dwlWmListener = { + .tag = [](void*, znet_tapesoftware_dwl_wm_v1*, const char *name) { + tagNames.push_back(name); + }, +}; + // called after we have received the initial batch of globals static void onReady() { @@ -186,6 +195,10 @@ static void registryHandleGlobal(void*, wl_registry *registry, uint32_t name, co if (seat == nullptr && reg.handle(seat, wl_seat_interface, 7)) { wl_seat_add_listener(seat, &seatListener, nullptr); } + if (reg.handle(dwlWm, znet_tapesoftware_dwl_wm_v1_interface, 1)) { + znet_tapesoftware_dwl_wm_v1_add_listener(dwlWm, &dwlWmListener, nullptr); + wl_display_roundtrip(display); + } } static const struct wl_registry_listener registry_listener = { registryHandleGlobal, nullptr };