94298741b6
- The tray can now be centered in the bar - Set window atoms: * _NET_SYSTEM_TRAY_COLORS * _NET_SYSTEM_TRAY_VISUAL - New parameters added: * tray-background: Define background color * tray-offset-x: X position offset * tray-offset-y: Y position offset * tray-padding: Add spacing on the side of each icon * tray-maxsize: Size limit for tray icons, default: 16 * tray-scale: Icon zoom, default: 1.0 * tray-detached: The bar will ignore tray updates
69 lines
3.2 KiB
C++
69 lines
3.2 KiB
C++
#pragma once
|
|
|
|
#include <xcb/xcb.h>
|
|
#include <xcb/xcb_atom.h>
|
|
|
|
struct cached_atom {
|
|
const char* name;
|
|
size_t len;
|
|
xcb_atom_t* atom;
|
|
};
|
|
|
|
static xcb_atom_t _NET_WM_NAME;
|
|
static xcb_atom_t _NET_WM_DESKTOP;
|
|
static xcb_atom_t _NET_WM_WINDOW_TYPE;
|
|
static xcb_atom_t _NET_WM_WINDOW_TYPE_DOCK;
|
|
static xcb_atom_t _NET_WM_WINDOW_TYPE_NORMAL;
|
|
static xcb_atom_t _NET_WM_PID;
|
|
static xcb_atom_t _NET_WM_STATE;
|
|
static xcb_atom_t _NET_WM_STATE_STICKY;
|
|
static xcb_atom_t _NET_WM_STATE_SKIP_TASKBAR;
|
|
static xcb_atom_t _NET_WM_STATE_ABOVE;
|
|
static xcb_atom_t _NET_WM_STATE_MAXIMIZED_VERT;
|
|
static xcb_atom_t _NET_WM_STRUT;
|
|
static xcb_atom_t _NET_WM_STRUT_PARTIAL;
|
|
static xcb_atom_t WM_PROTOCOLS;
|
|
static xcb_atom_t WM_DELETE_WINDOW;
|
|
static xcb_atom_t _XEMBED;
|
|
static xcb_atom_t _XEMBED_INFO;
|
|
static xcb_atom_t MANAGER;
|
|
static xcb_atom_t WM_STATE;
|
|
static xcb_atom_t _NET_SYSTEM_TRAY_OPCODE;
|
|
static xcb_atom_t _NET_SYSTEM_TRAY_ORIENTATION;
|
|
static xcb_atom_t _NET_SYSTEM_TRAY_VISUAL;
|
|
static xcb_atom_t _NET_SYSTEM_TRAY_COLORS;
|
|
static xcb_atom_t WM_TAKE_FOCUS;
|
|
static xcb_atom_t Backlight;
|
|
static xcb_atom_t BACKLIGHT;
|
|
|
|
// clang-format off
|
|
static cached_atom ATOMS[26] = {
|
|
{"_NET_WM_NAME", sizeof("_NET_WM_NAME") - 1, &_NET_WM_NAME},
|
|
{"_NET_WM_DESKTOP", sizeof("_NET_WM_DESKTOP") - 1, &_NET_WM_DESKTOP},
|
|
{"_NET_WM_WINDOW_TYPE", sizeof("_NET_WM_WINDOW_TYPE") - 1, &_NET_WM_WINDOW_TYPE},
|
|
{"_NET_WM_WINDOW_TYPE_DOCK", sizeof("_NET_WM_WINDOW_TYPE_DOCK") - 1, &_NET_WM_WINDOW_TYPE_DOCK},
|
|
{"_NET_WM_WINDOW_TYPE_NORMAL", sizeof("_NET_WM_WINDOW_TYPE_NORMAL") - 1, &_NET_WM_WINDOW_TYPE_NORMAL},
|
|
{"_NET_WM_PID", sizeof("_NET_WM_PID") - 1, &_NET_WM_PID},
|
|
{"_NET_WM_STATE", sizeof("_NET_WM_STATE") - 1, &_NET_WM_STATE},
|
|
{"_NET_WM_STATE_STICKY", sizeof("_NET_WM_STATE_STICKY") - 1, &_NET_WM_STATE_STICKY},
|
|
{"_NET_WM_STATE_SKIP_TASKBAR", sizeof("_NET_WM_STATE_SKIP_TASKBAR") - 1, &_NET_WM_STATE_SKIP_TASKBAR},
|
|
{"_NET_WM_STATE_ABOVE", sizeof("_NET_WM_STATE_ABOVE") - 1, &_NET_WM_STATE_ABOVE},
|
|
{"_NET_WM_STATE_MAXIMIZED_VERT", sizeof("_NET_WM_STATE_MAXIMIZED_VERT") - 1, &_NET_WM_STATE_MAXIMIZED_VERT},
|
|
{"_NET_WM_STRUT", sizeof("_NET_WM_STRUT") - 1, &_NET_WM_STRUT},
|
|
{"_NET_WM_STRUT_PARTIAL", sizeof("_NET_WM_STRUT_PARTIAL") - 1, &_NET_WM_STRUT_PARTIAL},
|
|
{"WM_PROTOCOLS", sizeof("WM_PROTOCOLS") - 1, &WM_PROTOCOLS},
|
|
{"WM_DELETE_WINDOW", sizeof("WM_DELETE_WINDOW") - 1, &WM_DELETE_WINDOW},
|
|
{"_XEMBED", sizeof("_XEMBED") - 1, &_XEMBED},
|
|
{"_XEMBED_INFO", sizeof("_XEMBED_INFO") - 1, &_XEMBED_INFO},
|
|
{"MANAGER", sizeof("MANAGER") - 1, &MANAGER},
|
|
{"WM_STATE", sizeof("WM_STATE") - 1, &WM_STATE},
|
|
{"_NET_SYSTEM_TRAY_OPCODE", sizeof("_NET_SYSTEM_TRAY_OPCODE") - 1, &_NET_SYSTEM_TRAY_OPCODE},
|
|
{"_NET_SYSTEM_TRAY_ORIENTATION", sizeof("_NET_SYSTEM_TRAY_ORIENTATION") - 1, &_NET_SYSTEM_TRAY_ORIENTATION},
|
|
{"_NET_SYSTEM_TRAY_VISUAL", sizeof("_NET_SYSTEM_TRAY_VISUAL") - 1, &_NET_SYSTEM_TRAY_VISUAL},
|
|
{"_NET_SYSTEM_TRAY_COLORS", sizeof("_NET_SYSTEM_TRAY_COLORS") - 1, &_NET_SYSTEM_TRAY_COLORS},
|
|
{"WM_TAKE_FOCUS", sizeof("WM_TAKE_FOCUS") - 1, &WM_TAKE_FOCUS},
|
|
{"Backlight", sizeof("Backlight") - 1, &Backlight},
|
|
{"BACKLIGHT", sizeof("BACKLIGHT") - 1, &BACKLIGHT},
|
|
};
|
|
// clang-format on
|