Receive tag names from dwl
This commit is contained in:
parent
771082aa6e
commit
1573c6348a
3 changed files with 18 additions and 2 deletions
|
@ -47,8 +47,8 @@ Bar::Bar(const wl_output *output)
|
||||||
zwlr_layer_surface_v1_set_exclusive_zone(_layerSurface, barSize);
|
zwlr_layer_surface_v1_set_exclusive_zone(_layerSurface, barSize);
|
||||||
wl_surface_commit(_surface);
|
wl_surface_commit(_surface);
|
||||||
|
|
||||||
for (auto i=1; i<=4; i++) {
|
for (auto tag : tagNames) {
|
||||||
_tags.push_back({ QString::number(i), i%2 == 0 });
|
_tags.push_back({ tag, false });
|
||||||
}
|
}
|
||||||
_windowTitle = "Window title";
|
_windowTitle = "Window title";
|
||||||
_status = "Status";
|
_status = "Status";
|
||||||
|
|
|
@ -3,13 +3,16 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
|
#include <vector>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
#include <QString>
|
||||||
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
|
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
|
||||||
|
|
||||||
extern wl_display *display;
|
extern wl_display *display;
|
||||||
extern wl_compositor *compositor;
|
extern wl_compositor *compositor;
|
||||||
extern wl_shm *shm;
|
extern wl_shm *shm;
|
||||||
extern zwlr_layer_shell_v1 *wlrLayerShell;
|
extern zwlr_layer_shell_v1 *wlrLayerShell;
|
||||||
|
extern std::vector<QString> tagNames;
|
||||||
|
|
||||||
struct ColorScheme {
|
struct ColorScheme {
|
||||||
QColor fg, bg;
|
QColor fg, bg;
|
||||||
|
|
13
src/main.cpp
13
src/main.cpp
|
@ -17,6 +17,7 @@
|
||||||
#include <wayland-cursor.h>
|
#include <wayland-cursor.h>
|
||||||
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
|
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
|
||||||
#include "xdg-shell-client-protocol.h"
|
#include "xdg-shell-client-protocol.h"
|
||||||
|
#include "net-tapesoftware-dwl-wm-unstable-v1-client-protocol.h"
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
#include "bar.hpp"
|
#include "bar.hpp"
|
||||||
|
|
||||||
|
@ -31,6 +32,8 @@ wl_display *display;
|
||||||
wl_compositor *compositor;
|
wl_compositor *compositor;
|
||||||
wl_shm *shm;
|
wl_shm *shm;
|
||||||
zwlr_layer_shell_v1 *wlrLayerShell;
|
zwlr_layer_shell_v1 *wlrLayerShell;
|
||||||
|
znet_tapesoftware_dwl_wm_v1 *dwlWm;
|
||||||
|
std::vector<QString> tagNames;
|
||||||
static std::optional<Bar> bar;
|
static std::optional<Bar> bar;
|
||||||
static std::string statusFifoName;
|
static std::string statusFifoName;
|
||||||
static int statusFifoFd {-1};
|
static int statusFifoFd {-1};
|
||||||
|
@ -106,6 +109,12 @@ static const struct wl_seat_listener seatListener = {
|
||||||
[](void*, wl_seat*, const char *name) { }
|
[](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
|
// called after we have received the initial batch of globals
|
||||||
static void onReady()
|
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)) {
|
if (seat == nullptr && reg.handle(seat, wl_seat_interface, 7)) {
|
||||||
wl_seat_add_listener(seat, &seatListener, nullptr);
|
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 };
|
static const struct wl_registry_listener registry_listener = { registryHandleGlobal, nullptr };
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue