diff options
author | xAlpharax <42233094+xAlpharax@users.noreply.github.com> | 2023-08-15 00:06:43 +0300 |
---|---|---|
committer | xAlpharax <42233094+xAlpharax@users.noreply.github.com> | 2023-08-15 00:06:43 +0300 |
commit | 15346749a4ce015906ed1a98f60c335cf8c07745 (patch) | |
tree | c15dd5f8179cd0f8f2ad1dba526a17c799e94ce0 /transient.c |
Initial fork from https://git.suckless.org/dwm
Changes to be committed:
new file: LICENSE
new file: Makefile
new file: README
new file: config.def.h
new file: config.mk
new file: drw.c
new file: drw.h
new file: dwm.1
new file: dwm.c
new file: dwm.png
new file: transient.c
new file: util.c
new file: util.h
Diffstat (limited to 'transient.c')
-rw-r--r-- | transient.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/transient.c b/transient.c new file mode 100644 index 0000000..040adb5 --- /dev/null +++ b/transient.c @@ -0,0 +1,42 @@ +/* cc transient.c -o transient -lX11 */ + +#include <stdlib.h> +#include <unistd.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> + +int main(void) { + Display *d; + Window r, f, t = None; + XSizeHints h; + XEvent e; + + d = XOpenDisplay(NULL); + if (!d) + exit(1); + r = DefaultRootWindow(d); + + f = XCreateSimpleWindow(d, r, 100, 100, 400, 400, 0, 0, 0); + h.min_width = h.max_width = h.min_height = h.max_height = 400; + h.flags = PMinSize | PMaxSize; + XSetWMNormalHints(d, f, &h); + XStoreName(d, f, "floating"); + XMapWindow(d, f); + + XSelectInput(d, f, ExposureMask); + while (1) { + XNextEvent(d, &e); + + if (t == None) { + sleep(5); + t = XCreateSimpleWindow(d, r, 50, 50, 100, 100, 0, 0, 0); + XSetTransientForHint(d, t, f); + XStoreName(d, t, "transient"); + XMapWindow(d, t); + XSelectInput(d, t, ExposureMask); + } + } + + XCloseDisplay(d); + exit(0); +} |