update WM_CLASS instance name from vm_name

This commit is contained in:
Joakim L. Gilje
2023-11-21 23:37:50 +01:00
parent 0186304550
commit aeb44f1c5c
4 changed files with 52 additions and 0 deletions

22
src/qt/x11_util.c Normal file
View File

@@ -0,0 +1,22 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <stdio.h>
#include "x11_util.h"
void set_wm_class(unsigned long window, char *res_name) {
Display* display = XOpenDisplay(NULL);
if (display == NULL) {
return;
}
XClassHint hint;
XGetClassHint(display, window, &hint);
hint.res_name = res_name;
XSetClassHint(display, window, &hint);
// During testing, I've had to issue XGetClassHint after XSetClassHint
// to get the window manager to recognize the change.
XGetClassHint(display, window, &hint);
}