xaizek / euclid-wm (License: BSD 3-Clause) (since 2018-12-07)
A minimalist, tiling window manager for X11 that seeks to allow easy management of numerous windows entirely from the keyboard.
Commit b4e6301cacaece0263501a564104e851412bb89e

added support for net_wm_win_type = dock to allow less painful use of docks, systrays, panels, etc. You still want to explicitly set a reserved area in the config file.
Author: wmdiem
Author date (UTC): 2023-05-04 14:55
Committer name: wmdiem
Committer date (UTC): 2023-05-04 14:55
Parent(s): 03046f12324f5189dbd5bb3fcc3085270338b7fc
Signing key:
Tree: 8f0901dd671bf6d79cbd90d178de856f9dac60b7
File Lines added Lines deleted
euclid-wm.c 30 4
File euclid-wm.c changed (mode: 100644) (index 138391c..7799b61)
... ... Atom wm_take_focus;
215 215 Atom wm_prot; Atom wm_prot;
216 216 Atom wm_change_state; Atom wm_change_state;
217 217 Atom wm_fullscreen; Atom wm_fullscreen;
218 Atom wm_dock;
218 219 Atom current_desktop; Atom current_desktop;
219 220 Atom utf8; Atom utf8;
220 221 char *dcmd = NULL; //string that gets passed to /bin/sh when we invoke the menu char *dcmd = NULL; //string that gets passed to /bin/sh when we invoke the menu
 
... ... void set_atoms() {
697 698 wm_prot = XInternAtom(dpy, "WM_PROTOCOLS", False); wm_prot = XInternAtom(dpy, "WM_PROTOCOLS", False);
698 699 wm_change_state = XInternAtom(dpy,"_NET_WM_STATE",False); wm_change_state = XInternAtom(dpy,"_NET_WM_STATE",False);
699 700 wm_fullscreen = XInternAtom(dpy,"_NET_WM_STATE_FULLSCREEN",False); wm_fullscreen = XInternAtom(dpy,"_NET_WM_STATE_FULLSCREEN",False);
701 wm_dock = XInternAtom(dpy,"_NET_WM_WINDOW_TYPE_DOCK",False);
700 702 current_desktop = XInternAtom(dpy,"_NET_CURRENT_DESKTOP",False); current_desktop = XInternAtom(dpy,"_NET_CURRENT_DESKTOP",False);
701 703 utf8 = XInternAtom(dpy,"UTF8_STRING",False); utf8 = XInternAtom(dpy,"UTF8_STRING",False);
704 Atom wm_win_type = XInternAtom(dpy,"_NET_WM_WINDOW_TYPE",False);
702 705 Atom wm_supported = XInternAtom(dpy,"_NET_SUPPORTED",False); Atom wm_supported = XInternAtom(dpy,"_NET_SUPPORTED",False);
703 706 Atom wm_check = XInternAtom(dpy,"_NET_SUPPORTING_WM_CHECK",False); Atom wm_check = XInternAtom(dpy,"_NET_SUPPORTING_WM_CHECK",False);
704 707 Atom wm_name = XInternAtom(dpy,"_NET_WM_NAME",False); Atom wm_name = XInternAtom(dpy,"_NET_WM_NAME",False);
705 Atom supported[] = {wm_supported, wm_name, wm_change_state, wm_fullscreen, current_desktop};
708 Atom supported[] = {wm_supported, wm_name, wm_change_state, wm_fullscreen, wm_win_type, current_desktop};
706 709 XChangeProperty(dpy,root,wm_check,XA_WINDOW,32,PropModeReplace,(unsigned char *)&root,1); XChangeProperty(dpy,root,wm_check,XA_WINDOW,32,PropModeReplace,(unsigned char *)&root,1);
707 710 XChangeProperty(dpy,root,wm_name,utf8,8,PropModeReplace,(unsigned char *) "LG3D",strlen("LG3D")); XChangeProperty(dpy,root,wm_name,utf8,8,PropModeReplace,(unsigned char *) "LG3D",strlen("LG3D"));
708 711 XChangeProperty(dpy,root,wm_supported,XA_ATOM,32,PropModeReplace,(unsigned char *) supported,ARRAY_LEN(supported)); XChangeProperty(dpy,root,wm_supported,XA_ATOM,32,PropModeReplace,(unsigned char *) supported,ARRAY_LEN(supported));
 
... ... bool is_top_level(Window id) {
1361 1364 return(false); return(false);
1362 1365 }; };
1363 1366 int i; int i;
1367 //what we are doing here is seeing if it is a child of the root window or not.
1364 1368 for (i = 0; i < nc; i++) { for (i = 0; i < nc; i++) {
1365 1369 if (c[i] == id) { if (c[i] == id) {
1370 //this is a child of the root window, so we are potentially interested.
1371 XFree(c);
1366 1372 XWindowAttributes wa; XWindowAttributes wa;
1367 1373 XGetWindowAttributes(dpy,id,&wa); XGetWindowAttributes(dpy,id,&wa);
1368 1374 if (gxerror == true) { if (gxerror == true) {
1369 1375 gxerror = false; gxerror = false;
1370 XFree(c);
1371 1376 return(false); return(false);
1372 1377 }; };
1378
1373 1379 if (wa.override_redirect == true) { if (wa.override_redirect == true) {
1374 XFree(c);
1375 1380 return(false); return(false);
1381 };
1382 //here check if it has declared itself a dock--in which case, let it manage itself.
1383 Atom actual_type;
1384 int actual_format;
1385 unsigned long nitems, bytes_after;
1386 unsigned char *prop;
1387 Atom net_wm_type = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
1388 if (XGetWindowProperty(dpy, id, net_wm_type, 0L, 1L, False,
1389 XA_ATOM, &actual_type, &actual_format, &nitems,
1390 &bytes_after, &prop) == Success && prop) {
1391 Atom *atoms = (Atom*)prop;
1392 Atom atom = atoms[0];
1393 if (atom == wm_dock) {
1394 printf("New window presenting as a dock--not managing\n");
1395 XFree(prop);
1396 return (false);
1397 } else {
1398 XFree(prop);
1399 return(true);
1400 }
1401
1376 1402 } else { } else {
1377 XFree(c);
1403 //atom was not set, so treat as top level.
1378 1404 return(true); return(true);
1379 1405 }; };
1380 1406 }; };
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/euclid-wm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/euclid-wm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master