Receive tag names from dwl
This commit is contained in:
parent
771082aa6e
commit
1573c6348a
|
@ -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";
|
||||
|
|
|
@ -3,13 +3,16 @@
|
|||
|
||||
#pragma once
|
||||
#include <wayland-client.h>
|
||||
#include <vector>
|
||||
#include <QColor>
|
||||
#include <QString>
|
||||
#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<QString> tagNames;
|
||||
|
||||
struct ColorScheme {
|
||||
QColor fg, bg;
|
||||
|
|
13
src/main.cpp
13
src/main.cpp
|
@ -17,6 +17,7 @@
|
|||
#include <wayland-cursor.h>
|
||||
#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<QString> tagNames;
|
||||
static std::optional<Bar> 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 };
|
||||
|
||||
|
|
Loading…
Reference in New Issue