somebar/src/common.hpp

37 lines
1.1 KiB
C++
Raw Normal View History

2021-10-20 18:20:27 +00:00
// somebar - dwl bar
// See LICENSE file for copyright and license details.
#pragma once
#include <wayland-client.h>
2021-10-25 17:02:35 +00:00
#include <memory>
2021-10-24 17:04:29 +00:00
#include <vector>
2021-10-22 13:42:42 +00:00
#include <QColor>
2021-10-24 17:04:29 +00:00
#include <QString>
2021-10-20 18:20:27 +00:00
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
2021-10-25 17:02:35 +00:00
#include "net-tapesoftware-dwl-wm-unstable-v1-client-protocol.h"
2021-10-20 18:20:27 +00:00
extern wl_display *display;
extern wl_compositor *compositor;
extern wl_shm *shm;
extern zwlr_layer_shell_v1 *wlrLayerShell;
2021-10-24 17:04:29 +00:00
extern std::vector<QString> tagNames;
2021-10-25 19:54:14 +00:00
extern std::vector<QString> layoutNames;
2021-10-22 13:42:42 +00:00
struct ColorScheme {
QColor fg, bg;
};
2021-10-25 17:02:35 +00:00
// wayland smart pointers
template<typename T>
struct wl_deleter;
#define WL_DELETER(type, fn) template<> struct wl_deleter<type> { void operator()(type *v) { if(v) fn(v); } }
template<typename T>
using wl_unique_ptr = std::unique_ptr<T, wl_deleter<T>>;
WL_DELETER(wl_surface, wl_surface_destroy);
WL_DELETER(zwlr_layer_surface_v1, zwlr_layer_surface_v1_destroy);
WL_DELETER(wl_buffer, wl_buffer_destroy);
WL_DELETER(wl_output, wl_output_release);
WL_DELETER(znet_tapesoftware_dwl_wm_monitor_v1, znet_tapesoftware_dwl_wm_monitor_v1_release);