Fix background not being transparent on sway when a wayland application is focused and opening the ui

This commit is contained in:
dec05eba
2025-01-17 13:18:40 +01:00
parent eb4ce76f01
commit a9637f87e7
6 changed files with 65 additions and 36 deletions

View File

@@ -6,6 +6,10 @@
#include <mglpp/system/Utf8.hpp>
extern "C" {
#include <mgl/window/window.h>
}
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
@@ -470,7 +474,18 @@ namespace gsr {
bool is_compositor_running(Display *dpy, int screen) {
char prop_name[20];
snprintf(prop_name, sizeof(prop_name), "_NET_WM_CM_S%d", screen);
Atom prop_atom = XInternAtom(dpy, prop_name, False);
const Atom prop_atom = XInternAtom(dpy, prop_name, False);
return XGetSelectionOwner(dpy, prop_atom) != None;
}
static void get_monitors_callback(const mgl_monitor *monitor, void *userdata) {
std::vector<Monitor> *monitors = (std::vector<Monitor>*)userdata;
monitors->push_back({mgl::vec2i(monitor->pos.x, monitor->pos.y), mgl::vec2i(monitor->size.x, monitor->size.y)});
}
std::vector<Monitor> get_monitors(Display *dpy) {
std::vector<Monitor> monitors;
mgl_for_each_active_monitor_output(dpy, get_monitors_callback, &monitors);
return monitors;
}
}