forked from conformal/spectrwm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
spectrwm.c
18137 lines (15673 loc) · 448 KB
/
spectrwm.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (c) 2009-2019 Marco Peereboom <[email protected]>
* Copyright (c) 2009-2011 Ryan McBride <[email protected]>
* Copyright (c) 2009 Darrin Chandler <[email protected]>
* Copyright (c) 2009 Pierre-Yves Ritschard <[email protected]>
* Copyright (c) 2010 Tuukka Kataja <[email protected]>
* Copyright (c) 2011 Jason L. Wright <[email protected]>
* Copyright (c) 2011-2024 Reginald Kennedy <[email protected]>
* Copyright (c) 2011-2012 Lawrence Teo <[email protected]>
* Copyright (c) 2011-2012 Tiago Cunha <[email protected]>
* Copyright (c) 2012-2015 David Hill <[email protected]>
* Copyright (c) 2014-2015 Yuri D'Elia <[email protected]>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* kernel includes */
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/queue.h>
#if !defined(__OpenBSD__)
#include "queue_compat.h"
#endif
#include <sys/param.h>
#include <sys/select.h>
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#include <sys/tree.h>
#else
#include "tree.h"
#endif
/* /usr/includes */
#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <poll.h>
#include <fcntl.h>
#include <locale.h>
#include <paths.h>
#include <pwd.h>
#include <regex.h>
#include <signal.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#if defined(__FreeBSD__)
#include <libutil.h>
#else
#include <util.h>
#endif
#if defined(__NetBSD__)
#include <inttypes.h>
#endif
#include <X11/cursorfont.h>
#include <X11/Xcursor/Xcursor.h>
#include <X11/Xft/Xft.h>
#include <X11/Xlib-xcb.h>
#if !defined(SWM_XCB_HAS_XINPUT) && (defined(__linux__) || defined(__FreeBSD__) \
|| defined(__OpenBSD__) || defined(__NetBSD__))
#define SWM_XCB_HAS_XINPUT
#endif
#include <xcb/xcb.h>
#include <xcb/xcb_atom.h>
#include <xcb/xcb_aux.h>
#include <xcb/xcb_event.h>
#include <xcb/xcb_icccm.h>
#include <xcb/xcb_keysyms.h>
#ifdef SWM_XCB_HAS_XINPUT
#include <xcb/xinput.h>
#endif
#include <xcb/xtest.h>
#include <xcb/randr.h>
/* local includes */
#include "version.h"
#ifdef __OSX__
#include <osx.h>
#endif
/* singly-linked tail queue macros appeared in OpenBSD 6.9 */
#ifndef STAILQ_HEAD
#define STAILQ_HEAD SIMPLEQ_HEAD
#define STAILQ_HEAD_INITIALIZER SIMPLEQ_HEAD_INITIALIZER
#define STAILQ_ENTRY SIMPLEQ_ENTRY
#define STAILQ_FIRST SIMPLEQ_FIRST
#define STAILQ_END SIMPLEQ_END
#define STAILQ_EMPTY SIMPLEQ_EMPTY
#define STAILQ_NEXT SIMPLEQ_NEXT
#define STAILQ_FOREACH SIMPLEQ_FOREACH
#define STAILQ_FOREACH_SAFE SIMPLEQ_FOREACH_SAFE
#define STAILQ_INIT SIMPLEQ_INIT
#define STAILQ_INSERT_HEAD SIMPLEQ_INSERT_HEAD
#define STAILQ_INSERT_TAIL SIMPLEQ_INSERT_TAIL
#define STAILQ_INSERT_AFTER SIMPLEQ_INSERT_AFTER
#define STAILQ_REMOVE_HEAD SIMPLEQ_REMOVE_HEAD
#define STAILQ_REMOVE_AFTER SIMPLEQ_REMOVE_AFTER
/*#define STAILQ_REMOVE*/
#define STAILQ_CONCAT SIMPLEQ_CONCAT
/*#define STAILQ_LAST*/
#endif
#ifdef SPECTRWM_BUILDSTR
static const char *buildstr = SPECTRWM_BUILDSTR;
#else
static const char *buildstr = SPECTRWM_VERSION;
#endif
#ifndef XCB_ICCCM_NUM_WM_HINTS_ELEMENTS
#define XCB_ICCCM_SIZE_HINT_P_MIN_SIZE XCB_SIZE_HINT_P_MIN_SIZE
#define XCB_ICCCM_SIZE_HINT_P_MAX_SIZE XCB_SIZE_HINT_P_MAX_SIZE
#define XCB_ICCCM_SIZE_HINT_P_RESIZE_INC XCB_SIZE_HINT_P_RESIZE_INC
#define XCB_ICCCM_WM_HINT_INPUT XCB_WM_HINT_INPUT
#define XCB_ICCCM_WM_HINT_X_URGENCY XCB_WM_HINT_X_URGENCY
#define XCB_ICCCM_WM_STATE_ICONIC XCB_WM_STATE_ICONIC
#define XCB_ICCCM_WM_STATE_WITHDRAWN XCB_WM_STATE_WITHDRAWN
#define XCB_ICCCM_WM_STATE_NORMAL XCB_WM_STATE_NORMAL
#define xcb_icccm_get_text_property_reply_t xcb_get_text_property_reply_t
#define xcb_icccm_get_text_property_reply_wipe xcb_get_text_property_reply_wipe
#define xcb_icccm_get_wm_class xcb_get_wm_class
#define xcb_icccm_get_wm_class_reply xcb_get_wm_class_reply
#define xcb_icccm_get_wm_class_reply_t xcb_get_wm_class_reply_t
#define xcb_icccm_get_wm_class_reply_wipe xcb_get_wm_class_reply_wipe
#define xcb_icccm_get_wm_hints xcb_get_wm_hints
#define xcb_icccm_wm_hints_get_urgency xcb_wm_hints_get_urgency
#define xcb_icccm_get_wm_hints_reply xcb_get_wm_hints_reply
#define xcb_icccm_get_wm_name xcb_get_wm_name
#define xcb_icccm_get_wm_name_reply xcb_get_wm_name_reply
#define xcb_icccm_get_wm_normal_hints xcb_get_wm_normal_hints
#define xcb_icccm_get_wm_normal_hints_reply xcb_get_wm_normal_hints_reply
#define xcb_icccm_get_wm_protocols xcb_get_wm_protocols
#define xcb_icccm_get_wm_protocols_reply xcb_get_wm_protocols_reply
#define xcb_icccm_get_wm_protocols_reply_t xcb_get_wm_protocols_reply_t
#define xcb_icccm_get_wm_protocols_reply_wipe xcb_get_wm_protocols_reply_wipe
#define xcb_icccm_get_wm_transient_for xcb_get_wm_transient_for
#define xcb_icccm_get_wm_transient_for_reply xcb_get_wm_transient_for_reply
#define xcb_icccm_wm_hints_t xcb_wm_hints_t
#endif
/* Enable to turn on debug output by default. */
/*#define SWM_DEBUG*/
#define DPRINTF(x...) do { \
if (swm_debug) \
fprintf(stderr, x); \
} while (0)
#define DNPRINTF(n, fmt, args...) do { \
if (swm_debug & n) \
fprintf(stderr, "%ld %s: " fmt, \
(long)(time(NULL) - time_started), __func__, ## args); \
} while (0)
#define YESNO(x) ((x) ? "yes" : "no")
#define SWM_D_MISC (0x00001)
#define SWM_D_EVENT (0x00002)
#define SWM_D_WS (0x00004)
#define SWM_D_FOCUS (0x00008)
#define SWM_D_MOVE (0x00010)
#define SWM_D_STACK (0x00020)
#define SWM_D_MOUSE (0x00040)
#define SWM_D_PROP (0x00080)
#define SWM_D_CLASS (0x00100)
#define SWM_D_KEY (0x00200)
#define SWM_D_QUIRK (0x00400)
#define SWM_D_SPAWN (0x00800)
#define SWM_D_EVENTQ (0x01000)
#define SWM_D_CONF (0x02000)
#define SWM_D_BAR (0x04000)
#define SWM_D_INIT (0x08000)
#define SWM_D_ATOM (0x10000)
#define SWM_D_ALL (0x1ffff)
/* Debug output is disabled by default unless SWM_DEBUG is set. */
uint32_t swm_debug = 0
#ifdef SWM_DEBUG
| SWM_D_MISC
| SWM_D_EVENT
| SWM_D_WS
| SWM_D_FOCUS
| SWM_D_MOVE
| SWM_D_STACK
| SWM_D_MOUSE
| SWM_D_PROP
| SWM_D_CLASS
| SWM_D_KEY
| SWM_D_QUIRK
| SWM_D_SPAWN
| SWM_D_EVENTQ
| SWM_D_CONF
| SWM_D_BAR
| SWM_D_INIT
| SWM_D_ATOM
#endif /* SWM_DEBUG */
;
#define ALLOCSTR(s, x...) do { \
if (s && asprintf(s, x) == -1) \
err(1, "%s: asprintf", __func__); \
} while (0)
/* _NET_WM_STATE flags */
#define EWMH_F_MAXIMIZED_VERT (1 << 0)
#define EWMH_F_MAXIMIZED_HORZ (1 << 1)
#define EWMH_F_SKIP_TASKBAR (1 << 2)
#define EWMH_F_SKIP_PAGER (1 << 3)
#define EWMH_F_HIDDEN (1 << 4)
#define EWMH_F_FULLSCREEN (1 << 5)
#define EWMH_F_ABOVE (1 << 6)
#define EWMH_F_BELOW (1 << 7)
#define EWMH_F_DEMANDS_ATTENTION (1 << 8)
#define SWM_F_MANUAL (1 << 9)
#define SWM_EWMH_ACTION_COUNT_MAX (10)
#define EWMH_F_MAXIMIZED (EWMH_F_MAXIMIZED_VERT | EWMH_F_MAXIMIZED_HORZ)
#define EWMH_F_UNTILED (EWMH_F_ABOVE | EWMH_F_FULLSCREEN | \
EWMH_F_MAXIMIZED)
#define EWMH_WINDOW_TYPE_DESKTOP (1 << 0)
#define EWMH_WINDOW_TYPE_DOCK (1 << 1)
#define EWMH_WINDOW_TYPE_TOOLBAR (1 << 2)
#define EWMH_WINDOW_TYPE_MENU (1 << 3)
#define EWMH_WINDOW_TYPE_UTILITY (1 << 4)
#define EWMH_WINDOW_TYPE_SPLASH (1 << 5)
#define EWMH_WINDOW_TYPE_DIALOG (1 << 6)
#define EWMH_WINDOW_TYPE_DROPDOWN_MENU (1 << 7)
#define EWMH_WINDOW_TYPE_POPUP_MENU (1 << 8)
#define EWMH_WINDOW_TYPE_TOOLTIP (1 << 9)
#define EWMH_WINDOW_TYPE_NOTIFICATION (1 << 10)
#define EWMH_WINDOW_TYPE_COMBO (1 << 11)
#define EWMH_WINDOW_TYPE_DND (1 << 12)
#define EWMH_WINDOW_TYPE_NORMAL (1 << 13)
#define EWMH_WINDOW_TYPE_COUNT (14)
#define WINDESKTOP(w) ((w)->type & EWMH_WINDOW_TYPE_DESKTOP)
#define WINDOCK(w) ((w)->type & EWMH_WINDOW_TYPE_DOCK)
#define WINTOOLBAR(w) ((w)->type & EWMH_WINDOW_TYPE_TOOLBAR)
#define WINUTILITY(w) ((w)->type & EWMH_WINDOW_TYPE_UTILITY)
#define WINSPLASH(w) ((w)->type & EWMH_WINDOW_TYPE_SPLASH)
#define WINDIALOG(w) ((w)->type & EWMH_WINDOW_TYPE_DIALOG)
#define WINNOTIFY(w) ((w)->type & EWMH_WINDOW_TYPE_NOTIFICATION)
#define EWMH_ALL_DESKTOPS (0xffffffff)
/* convert 8-bit to 16-bit */
#define RGB_8_TO_16(col) (((col) << 8) + (col))
#define SWM_TO_XRENDER_COLOR(sc, xrc) do { \
(xrc).red = (sc).r; \
(xrc).green = (sc).g; \
(xrc).blue = (sc).b; \
(xrc).alpha = (sc).a; \
} while (0);
#define LENGTH(x) (int)(sizeof (x) / sizeof (x)[0])
#define MODKEY XCB_MOD_MASK_1
#define ANYMOD XCB_MOD_MASK_ANY
#define CLEANMASK(mask) ((mask) & (XCB_KEY_BUT_MASK_SHIFT | \
XCB_KEY_BUT_MASK_CONTROL | XCB_KEY_BUT_MASK_MOD_1 | \
XCB_KEY_BUT_MASK_MOD_2 | XCB_KEY_BUT_MASK_MOD_3 | \
XCB_KEY_BUT_MASK_MOD_4 | XCB_KEY_BUT_MASK_MOD_5) & ~(numlockmask))
#define BUTTONMASK (XCB_EVENT_MASK_BUTTON_PRESS | \
XCB_EVENT_MASK_BUTTON_RELEASE)
#define MOUSEMASK (BUTTONMASK|XCB_EVENT_MASK_POINTER_MOTION)
#define CANCELKEY XK_Escape
#define SWM_PROPLEN (16)
#define SWM_FUNCNAME_LEN (32)
#define SWM_QUIRK_LEN (64)
#define SWM_MAX_FONT_STEPS (3) /* For SWM_Q_XTERM_FONTADJ */
/* For ws_win, swm_region and swm_bar. */
#define WINID(w) ((w) ? (w)->id : XCB_WINDOW_NONE)
#define X(r) ((r)->g.x)
#define Y(r) ((r)->g.y)
#define WIDTH(r) ((r)->g.w)
#define HEIGHT(r) ((r)->g.h)
#define ROTATION(rr) ((rr)->g.r)
#define MAX_X(r) (X(r) + WIDTH(r))
#define MAX_Y(r) (Y(r) + HEIGHT(r))
#define SH_POS(w) ((w)->sh.flags & XCB_ICCCM_SIZE_HINT_P_POSITION)
#define SH_UPOS(w) ((w)->sh.flags & XCB_ICCCM_SIZE_HINT_US_POSITION)
#define SH_MIN(w) ((w)->sh.flags & XCB_ICCCM_SIZE_HINT_P_MIN_SIZE)
#define SH_MIN_W(w) ((w)->sh.min_width)
#define SH_MIN_H(w) ((w)->sh.min_height)
#define SH_MAX(w) ((w)->sh.flags & XCB_ICCCM_SIZE_HINT_P_MAX_SIZE)
#define SH_MAX_W(w) ((w)->sh.max_width)
#define SH_MAX_H(w) ((w)->sh.max_height)
#define SH_INC(w) ((w)->sh.flags & XCB_ICCCM_SIZE_HINT_P_RESIZE_INC)
#define SH_INC_W(w) ((w)->sh.width_inc)
#define SH_INC_H(w) ((w)->sh.height_inc)
#define SH_GRAVITY(w) ((w)->sh.flags & XCB_ICCCM_SIZE_HINT_P_WIN_GRAVITY)
#define MAXIMIZED_VERT(w) ((w)->ewmh_flags & EWMH_F_MAXIMIZED_VERT)
#define MAXIMIZED_HORZ(w) ((w)->ewmh_flags & EWMH_F_MAXIMIZED_HORZ)
#define SKIP_TASKBAR(w) ((w)->ewmh_flags & EWMH_F_SKIP_TASKBAR)
#define SKIP_PAGER(w) ((w)->ewmh_flags & EWMH_F_SKIP_PAGER)
#define HIDDEN(w) ((w)->ewmh_flags & EWMH_F_HIDDEN)
#define FULLSCREEN(w) ((w)->ewmh_flags & EWMH_F_FULLSCREEN)
#define ABOVE(w) ((w)->ewmh_flags & EWMH_F_ABOVE)
#define BELOW(w) ((w)->ewmh_flags & EWMH_F_BELOW)
#define DEMANDS_ATTENTION(w) ((w)->ewmh_flags & EWMH_F_DEMANDS_ATTENTION)
#define MANUAL(w) ((w)->ewmh_flags & SWM_F_MANUAL)
#define MAXIMIZED(w) ((w)->ewmh_flags & EWMH_F_MAXIMIZED)
/* Constrain Window flags */
#define SWM_CW_RESIZABLE (0x01)
#define SWM_CW_SOFTBOUNDARY (0x02)
#define SWM_CW_HARDBOUNDARY (0x04)
#define SWM_CW_RIGHT (0x10)
#define SWM_CW_LEFT (0x20)
#define SWM_CW_BOTTOM (0x40)
#define SWM_CW_TOP (0x80)
#define SWM_CW_ALLSIDES (0xf0)
#define SWM_FOCUS_TYPE_STARTUP (1 << 0)
#define SWM_FOCUS_TYPE_BORDER (1 << 1)
#define SWM_FOCUS_TYPE_LAYOUT (1 << 2)
#define SWM_FOCUS_TYPE_MAP (1 << 3)
#define SWM_FOCUS_TYPE_UNMAP (1 << 4)
#define SWM_FOCUS_TYPE_ICONIFY (1 << 5)
#define SWM_FOCUS_TYPE_UNICONIFY (1 << 6)
#define SWM_FOCUS_TYPE_CONFIGURE (1 << 7)
#define SWM_FOCUS_TYPE_MOVE (1 << 8)
#define SWM_FOCUS_TYPE_WORKSPACE (1 << 9)
#define SWM_FOCUS_TYPE_ALL ((1 << 10) - 1)
#define SWM_FOCUS_MODE_DEFAULT (SWM_FOCUS_TYPE_BORDER)
#define SWM_FOCUS_MODE_FOLLOW (SWM_FOCUS_TYPE_ALL)
#define SWM_FOCUS_MODE_MANUAL (0)
#define SWM_COUNT_TILED (1 << 0)
#define SWM_COUNT_FLOATING (1 << 1)
#define SWM_COUNT_ICONIC (1 << 2)
#define SWM_COUNT_DESKTOP (1 << 3)
#define SWM_COUNT_NORMAL (SWM_COUNT_TILED | SWM_COUNT_FLOATING | \
SWM_COUNT_DESKTOP)
#define SWM_COUNT_ALL (SWM_COUNT_NORMAL | SWM_COUNT_ICONIC)
#define SWM_WIN_UNFOCUS (1 << 0)
#define SWM_WIN_NOUNMAP (1 << 1)
#define SWM_WSI_LISTCURRENT (0x001)
#define SWM_WSI_LISTACTIVE (0x002)
#define SWM_WSI_LISTEMPTY (0x004)
#define SWM_WSI_LISTNAMED (0x008)
#define SWM_WSI_LISTURGENT (0x010)
#define SWM_WSI_LISTALL (0x0ff)
#define SWM_WSI_HIDECURRENT (0x100)
#define SWM_WSI_MARKCURRENT (0x200)
#define SWM_WSI_MARKURGENT (0x400)
#define SWM_WSI_MARKACTIVE (0x800)
#define SWM_WSI_MARKEMPTY (0x1000)
#define SWM_WSI_PRINTNAMES (0x2000)
#define SWM_WSI_NOINDEXES (0x4000)
#define SWM_WSI_DEFAULT (SWM_WSI_LISTCURRENT | SWM_WSI_LISTACTIVE | \
SWM_WSI_MARKCURRENT | SWM_WSI_PRINTNAMES)
#define SWM_WM_CLASS_INSTANCE "spectrwm"
#define SWM_WM_CLASS_BAR "panel"
#define SWM_CONF_DEFAULT (0)
#define SWM_CONF_KEYMAPPING (1)
#define SWM_CONF_DELIMLIST ","
#define SWM_CONF_WHITESPACE " \t\n"
#ifndef SWM_LIB
#define SWM_LIB "/usr/local/lib/libswmhack.so"
#endif
char **start_argv;
xcb_atom_t a_state;
xcb_atom_t a_change_state;
xcb_atom_t a_prot;
xcb_atom_t a_delete;
xcb_atom_t a_net_frame_extents;
xcb_atom_t a_net_wm_check;
xcb_atom_t a_net_wm_pid;
xcb_atom_t a_net_supported;
xcb_atom_t a_takefocus;
xcb_atom_t a_utf8_string;
xcb_atom_t a_swm_pid;
xcb_atom_t a_swm_ws;
volatile sig_atomic_t running = 1;
volatile sig_atomic_t restart_wm = 0;
xcb_timestamp_t event_time = 0;
int outputs = 0;
xcb_window_t pointer_window = XCB_WINDOW_NONE;
bool randr_support = false;
bool randr_scan = false;
int randr_eventbase;
unsigned int numlockmask = 0;
bool xinput2_support = false;
int xinput2_opcode;
bool xinput2_raw = false;
Display *display;
xcb_connection_t *conn;
xcb_key_symbols_t *syms;
int boundary_width = 50;
int snap_range = 25;
bool cycle_empty = false;
bool cycle_visible = false;
int term_width = 0;
int font_adjusted = 0;
uint16_t mod_key = MODKEY;
xcb_keysym_t cancel_key = CANCELKEY;
xcb_keycode_t cancel_keycode = XCB_NO_SYMBOL;
bool warp_focus = false;
bool warp_pointer = false;
bool workspace_autorotate = false;
bool workspace_clamp = false;
/* dmenu search */
struct swm_region *search_r;
int select_list_pipe[2];
int select_resp_pipe[2];
pid_t searchpid;
volatile sig_atomic_t search_resp;
int search_resp_action;
struct search_window {
TAILQ_ENTRY(search_window) entry;
int idx;
struct ws_win *win;
xcb_gcontext_t gc;
xcb_window_t indicator;
};
TAILQ_HEAD(search_winlist, search_window) search_wl =
TAILQ_HEAD_INITIALIZER(search_wl);
/* search actions */
enum {
SWM_SEARCH_NONE,
SWM_SEARCH_UNICONIFY,
SWM_SEARCH_NAME_WORKSPACE,
SWM_SEARCH_SEARCH_WORKSPACE,
SWM_SEARCH_SEARCH_WINDOW
};
#define SWM_STACK_TOP (0)
#define SWM_STACK_BOTTOM (1)
#define SWM_STACK_ABOVE (2)
#define SWM_STACK_BELOW (3)
#define SWM_STACK_PRIOR (4)
/* dialog windows */
double dialog_ratio = 0.6;
/* status bar */
#define SWM_BAR_MAX (1024)
#define SWM_BAR_JUSTIFY_LEFT (0)
#define SWM_BAR_JUSTIFY_CENTER (1)
#define SWM_BAR_JUSTIFY_RIGHT (2)
#define SWM_BAR_OFFSET (4)
#define SWM_BAR_FONTS "-*-terminus-medium-*-*-*-12-*-*-*-*-*-*-*," \
"-*-profont-*-*-*-*-12-*-*-*-*-*-*-*," \
"-*-times-medium-r-*-*-12-*-*-*-*-*-*-*," \
"-misc-fixed-medium-r-*-*-12-*-*-*-*-*-*-*," \
"-*-*-*-r-*-*-*-*-*-*-*-*-*-*"
#define SWM_BAR_FONTS_FALLBACK "-*-fixed-*-r-*-*-*-*-*-*-*-*-*-*," \
"-*-*-*-*-*-r-*-*-*-*-*-*-*-*," \
"-*-*-*-*-*-*-*-*-*-*-*-*-*-*"
#ifdef X_HAVE_UTF8_STRING
#define DRAWSTRING(x...) Xutf8DrawString(x)
#define TEXTEXTENTS(x...) Xutf8TextExtents(x)
#else
#define DRAWSTRING(x...) XmbDrawString(x)
#define TEXTEXTENTS(x...) XmbTextExtents(x)
#endif
/* CSS like directions used for individual region_padding for each side, */
/* but could also be useful for other values, f.e. tile_gap? */
enum {
SWM_BOX_TOP, /* 0 */
SWM_BOX_RIGHT, /* + -- + */
SWM_BOX_BOTTOM, /* 3 | | 1 */
SWM_BOX_LEFT, /* + -- + */
SWM_BOX_N, /* 2 */
SWM_UNFOCUS_NONE,
SWM_UNFOCUS_RESTORE,
SWM_UNFOCUS_ICONIFY,
SWM_UNFOCUS_FLOAT,
SWM_UNFOCUS_BELOW,
SWM_UNFOCUS_QUICK_BELOW,
};
char *bar_argv[] = { NULL, NULL };
char bar_ext[SWM_BAR_MAX];
char bar_ext_buf[SWM_BAR_MAX];
char bar_vertext[SWM_BAR_MAX];
bool bar_version = false;
bool bar_enabled = true;
int bar_border_width = 1;
bool bar_at_bottom = false;
bool bar_extra = false;
int bar_height = 0;
int bar_justify = SWM_BAR_JUSTIFY_LEFT;
char *bar_format = NULL;
bool bar_action_expand = false;
int bar_workspace_limit = 0;
bool stack_enabled = true;
bool clock_enabled = true;
bool iconic_enabled = false;
int fullscreen_unfocus = SWM_UNFOCUS_NONE;
bool fullscreen_hide_other = false;
int maximized_unfocus = SWM_UNFOCUS_RESTORE;
bool maximize_hide_bar = false;
bool maximize_hide_other = false;
bool max_layout_maximize = true;
bool urgent_enabled = false;
bool urgent_collapse = false;
char *clock_format = NULL;
bool window_class_enabled = false;
bool window_instance_enabled = false;
bool window_name_enabled = false;
bool click_to_raise = true;
uint32_t workspace_indicator = SWM_WSI_DEFAULT;
unsigned int focus_mode = SWM_FOCUS_MODE_DEFAULT;
int focus_close = SWM_STACK_BELOW;
bool focus_close_wrap = true;
int focus_default = SWM_STACK_TOP;
int spawn_position = SWM_STACK_TOP;
bool disable_border = false;
bool disable_border_always = false;
int border_width = 1;
/* Padding can be defined like in CSS, eg.: a [b [c [d]]] */
/* This also ensures backwards compatibility when only one value is given. */
int region_padding[SWM_BOX_N] = { 0, 0, 0, 0};
int tile_gap = 0;
bool verbose_layout = false;
bool debug_enabled;
time_t time_started;
pid_t bar_pid;
XFontSet bar_fs = NULL;
XFontSetExtents *bar_fs_extents;
char **bar_fontnames = NULL;
int num_xftfonts = 0;
char *bar_fontname_pua = NULL;
int font_pua_index = 0;
bool bar_font_legacy = true;
char *bar_fonts = NULL;
XftColor search_font_color;
char *startup_exception = NULL;
unsigned int nr_exceptions = 0;
char *workspace_mark_current = NULL;
char *workspace_mark_current_suffix = NULL;
char *workspace_mark_urgent = NULL;
char *workspace_mark_urgent_suffix = NULL;
char *workspace_mark_active = NULL;
char *workspace_mark_active_suffix = NULL;
char *workspace_mark_empty = NULL;
char *workspace_mark_empty_suffix = NULL;
char *focus_mark_none = NULL;
char *focus_mark_normal = NULL;
char *focus_mark_floating = NULL;
char *focus_mark_free = NULL;
char *focus_mark_maximized = NULL;
char *stack_mark_floating = NULL;
char *stack_mark_max = NULL;
char *stack_mark_vertical = NULL;
char *stack_mark_vertical_flip = NULL;
char *stack_mark_horizontal = NULL;
char *stack_mark_horizontal_flip = NULL;
size_t stack_mark_maxlen = 1; /* Start with null byte. */
#define ROTATION_DEFAULT (XCB_RANDR_ROTATION_ROTATE_0)
#define ROTATION_VERT (XCB_RANDR_ROTATION_ROTATE_0 | \
XCB_RANDR_ROTATION_ROTATE_180)
/* layout manager data */
struct swm_geometry {
int16_t x;
int16_t y;
uint16_t w;
uint16_t h;
uint16_t r; /* RandR rotation. */
};
struct swm_screen;
struct workspace;
struct swm_stackable {
SLIST_ENTRY(swm_stackable) entry;
enum stackable {
STACKABLE_WIN,
STACKABLE_BAR,
STACKABLE_REGION,
STACKABLE_INVALID
} type;
union {
struct ws_win *win;
struct swm_bar *bar;
struct swm_region *region;
};
enum swm_layer {
SWM_LAYER_REGION,
SWM_LAYER_DESKTOP,
SWM_LAYER_BELOW,
SWM_LAYER_TILED,
SWM_LAYER_DOCK,
SWM_LAYER_BAR,
SWM_LAYER_ABOVE,
SWM_LAYER_MAXIMIZED,
SWM_LAYER_FULLSCREEN,
SWM_LAYER_RAISED,
SWM_LAYER_INVALID
} layer;
struct swm_screen *s; /* always valid, never changes */
};
SLIST_HEAD(swm_stack_list, swm_stackable);
struct swm_bar {
struct swm_stackable *st; /* Always valid, never changes. */
xcb_window_t id;
struct swm_geometry g;
struct swm_region *r; /* Associated region. */
bool disabled;
xcb_pixmap_t buffer;
};
/* virtual "screens" */
struct swm_region {
TAILQ_ENTRY(swm_region) entry;
struct swm_stackable *st; /* Always valid, never changes. */
xcb_window_t id;
struct swm_geometry g;
struct swm_geometry g_usable;
struct workspace *ws; /* current workspace on this region */
struct workspace *ws_prior; /* prior workspace on this region */
struct swm_screen *s; /* screen idx */
struct swm_bar *bar;
};
TAILQ_HEAD(swm_region_list, swm_region);
struct swm_strut {
SLIST_ENTRY(swm_strut) entry;
struct ws_win *win;
/* _NET_WM_STRUT_PARTIAL: CARDINAL[12]/32 */
uint32_t left;
uint32_t right;
uint32_t top;
uint32_t bottom;
uint32_t left_start_y;
uint32_t left_end_y;
uint32_t right_start_y;
uint32_t right_end_y;
uint32_t top_start_x;
uint32_t top_end_x;
uint32_t bottom_start_x;
uint32_t bottom_end_x;
};
SLIST_HEAD(swm_strut_list, swm_strut);
struct ws_win {
TAILQ_ENTRY(ws_win) entry;
TAILQ_ENTRY(ws_win) manage_entry;
TAILQ_ENTRY(ws_win) focus_entry;
TAILQ_ENTRY(ws_win) priority_entry;
struct swm_stackable *st; /* Always valid, never changes */
xcb_window_t id;
xcb_window_t frame;
xcb_window_t transient_for; /* WM_TRANSIENT_FOR (WINDOW). */
xcb_visualid_t visual;
struct ws_win *main; /* Always valid. */
struct ws_win *parent; /* WM_TRANSIENT_FOR ws_win. */
struct ws_win *focus_redirect;/* focus on transient */
struct swm_geometry g; /* current geometry */
struct swm_geometry g_grav; /* win-gravity reference. */
struct swm_geometry g_float; /* root coordinates */
struct swm_geometry g_floatref; /* reference coordinates */
bool g_floatref_root;
bool g_float_xy_valid;
uint8_t gravity;
bool mapped;
uint32_t mapping; /* # of pending operations */
uint32_t unmapping; /* # of pending operations */
uint32_t state; /* current ICCCM WM_STATE */
bool normalmax;
bool maxstackmax;
bool bordered;
uint32_t type; /* _NET_WM_WINDOW_TYPE */
uint32_t ewmh_flags;
int font_size_boundary[SWM_MAX_FONT_STEPS];
int font_steps;
int last_inc;
bool can_delete;
bool take_focus;
uint32_t quirks;
struct workspace *ws; /* always valid */
struct swm_screen *s; /* always valid, never changes */
xcb_size_hints_t sh;
xcb_icccm_get_wm_class_reply_t ch;
xcb_icccm_wm_hints_t hints;
struct swm_strut *strut;
xcb_window_t debug; /* Debug overlay window. */
};
TAILQ_HEAD(ws_win_list, ws_win);
TAILQ_HEAD(ws_win_focus, ws_win);
TAILQ_HEAD(ws_win_managed, ws_win);
TAILQ_HEAD(ws_win_priority, ws_win);
/* pid goo */
struct pid_e {
TAILQ_ENTRY(pid_e) entry;
pid_t pid;
int ws;
};
TAILQ_HEAD(pid_list, pid_e) pidlist = TAILQ_HEAD_INITIALIZER(pidlist);
/* layout handlers */
static void stack(struct swm_region *);
static void vertical_config(struct workspace *, int);
static void vertical_stack(struct workspace *, struct swm_geometry *);
static void horizontal_config(struct workspace *, int);
static void horizontal_stack(struct workspace *, struct swm_geometry *);
static void max_config(struct workspace *, int);
static void max_stack(struct workspace *, struct swm_geometry *);
static void floating_stack(struct workspace *, struct swm_geometry *);
static void plain_stacker(struct workspace *);
static void fancy_stacker(struct workspace *);
enum {
SWM_V_STACK,
SWM_H_STACK,
SWM_MAX_STACK,
SWM_FLOATING_STACK,
SWM_STACK_COUNT
};
struct layout {
char *name;
void (*l_stack)(struct workspace *, struct swm_geometry *);
void (*l_config)(struct workspace *, int);
uint32_t flags;
#define SWM_L_FOCUSPREV (1 << 0)
#define SWM_L_MAPONFOCUS (1 << 1)
#define SWM_L_NOTILE (1 << 2)
void (*l_string)(struct workspace *);
} layouts[SWM_STACK_COUNT] = {
{ "vertical", vertical_stack, vertical_config,
0, plain_stacker },
{ "horizontal", horizontal_stack, horizontal_config,
0, plain_stacker },
{ "max", max_stack, max_config,
SWM_L_MAPONFOCUS | SWM_L_FOCUSPREV, plain_stacker },
{ "floating", floating_stack, NULL,
SWM_L_NOTILE, plain_stacker },
};
struct layout *layout_order[SWM_STACK_COUNT];
int layout_order_count = 0;
#define SWM_H_SLICE (32)
#define SWM_V_SLICE (32)
#define SWM_FANCY_MAXLEN (8) /* Includes null byte. */
/* define work spaces */
struct workspace {
RB_ENTRY(workspace) entry;
int idx; /* workspace index */
char *name; /* workspace name */
bool always_raise; /* raise windows on focus */
bool bar_enabled; /* bar visibility */
struct layout *cur_layout; /* current layout handlers */
struct layout *prev_layout; /* may be NULL */
struct ws_win *focus; /* may be NULL */
struct ws_win *focus_raise; /* may be NULL */
struct swm_screen *s; /* Always valid, never changes. */
struct swm_region *r; /* may be NULL */
struct swm_region *old_r; /* may be NULL */
struct ws_win_list winlist; /* list of windows in ws */
char *stacker; /* stack_mark buffer */
size_t stacker_len;
uint16_t rotation; /* Layout reference. */
/* stacker state */
struct {
int horizontal_msize;
int horizontal_mwin;
int horizontal_stacks;
bool horizontal_flip;
int vertical_msize;
int vertical_mwin;
int vertical_stacks;
bool vertical_flip;
} l_state;
};
RB_HEAD(workspace_tree, workspace);
enum {
SWM_S_COLOR_BAR,
SWM_S_COLOR_BAR_UNFOCUS,
SWM_S_COLOR_BAR_FREE,
SWM_S_COLOR_BAR_SELECTED,
SWM_S_COLOR_BAR_BORDER,
SWM_S_COLOR_BAR_BORDER_UNFOCUS,
SWM_S_COLOR_BAR_BORDER_FREE,
SWM_S_COLOR_BAR_FONT,
SWM_S_COLOR_BAR_FONT_UNFOCUS,
SWM_S_COLOR_BAR_FONT_FREE,
SWM_S_COLOR_BAR_FONT_SELECTED,
SWM_S_COLOR_FOCUS,
SWM_S_COLOR_FOCUS_MAXIMIZED,
SWM_S_COLOR_UNFOCUS,
SWM_S_COLOR_UNFOCUS_MAXIMIZED,
SWM_S_COLOR_URGENT,
SWM_S_COLOR_URGENT_MAXIMIZED,
SWM_S_COLOR_FOCUS_FREE,
SWM_S_COLOR_FOCUS_MAXIMIZED_FREE,
SWM_S_COLOR_UNFOCUS_FREE,
SWM_S_COLOR_UNFOCUS_MAXIMIZED_FREE,
SWM_S_COLOR_URGENT_FREE,
SWM_S_COLOR_URGENT_MAXIMIZED_FREE,
SWM_S_COLOR_MAX
};
/* physical screen mapping */
#define SWM_WS_MAX (22) /* hard limit */
int workspace_limit = 10; /* soft limit */
#define SWM_RATE_DEFAULT (60) /* Default for swm_screen. */
struct swm_color {
uint16_t r;
uint16_t g;
uint16_t b;
uint16_t a;
uint16_t r_orig;
uint16_t g_orig;
uint16_t b_orig;
uint32_t pixel;
XftColor xft_color;
bool manual;
};
struct swm_screen {
int idx; /* screen index */
xcb_window_t root;
struct swm_region *r; /* Root region is always valid. */
struct swm_region_list rl; /* Additional regions on this screen. */
struct swm_region_list orl; /* Old/unused regions on this screen. */
struct swm_region *r_focus; /* Current active region. */
xcb_window_t active_window; /* current _NET_ACTIVE_WINDOW */
xcb_window_t swmwin; /* ewmh wm check/default input */
struct workspace_tree workspaces; /* Dynamic workspaces. */
struct ws_win_priority priority; /* Window floating priority. */
struct swm_stack_list stack; /* Current stacking order. */
struct ws_win *focus; /* Currently focused window. */
struct ws_win_focus fl; /* Previous focus queue. */
struct ws_win_managed managed; /* All client windows. */
int managed_count;
struct swm_strut_list struts;
struct swm_color_type {
struct swm_color **colors;
int count;
} c[SWM_S_COLOR_MAX];
uint8_t depth;
xcb_timestamp_t rate; /* Max updates/sec for move and resize */
xcb_visualid_t visual;
Visual *xvisual; /* Needed for Xft. */
xcb_colormap_t colormap;
xcb_gcontext_t gc;
XftFont **bar_xftfonts;
};
struct swm_screen *screens;
/* args to functions */
union arg {
int id;
#define SWM_ARG_ID_FOCUSNEXT (0)
#define SWM_ARG_ID_FOCUSPREV (1)
#define SWM_ARG_ID_FOCUSMAIN (2)
#define SWM_ARG_ID_FOCUSURGENT (3)
#define SWM_ARG_ID_FOCUSPRIOR (4)
#define SWM_ARG_ID_FOCUSFREE (5)
#define SWM_ARG_ID_SWAPNEXT (10)
#define SWM_ARG_ID_SWAPPREV (11)
#define SWM_ARG_ID_SWAPMAIN (12)
#define SWM_ARG_ID_MASTERSHRINK (20)
#define SWM_ARG_ID_MASTERGROW (21)
#define SWM_ARG_ID_MASTERADD (22)
#define SWM_ARG_ID_MASTERDEL (23)
#define SWM_ARG_ID_FLIPLAYOUT (24)
#define SWM_ARG_ID_STACKRESET (30)
#define SWM_ARG_ID_STACKINIT (31)
#define SWM_ARG_ID_STACKBALANCE (32)
#define SWM_ARG_ID_CYCLEWS_UP (40)
#define SWM_ARG_ID_CYCLEWS_DOWN (41)
#define SWM_ARG_ID_CYCLERG_UP (42)
#define SWM_ARG_ID_CYCLERG_DOWN (43)
#define SWM_ARG_ID_CYCLEWS_UP_ALL (44)
#define SWM_ARG_ID_CYCLEWS_DOWN_ALL (45)
#define SWM_ARG_ID_CYCLEWS_MOVE_UP (46)
#define SWM_ARG_ID_CYCLEWS_MOVE_DOWN (47)
#define SWM_ARG_ID_STACKINC (50)
#define SWM_ARG_ID_STACKDEC (51)
#define SWM_ARG_ID_CYCLE_LAYOUT (60)
#define SWM_ARG_ID_LAYOUT_VERTICAL (61)
#define SWM_ARG_ID_LAYOUT_HORIZONTAL (62)
#define SWM_ARG_ID_LAYOUT_MAX (63)
#define SWM_ARG_ID_PRIOR_LAYOUT (64)
#define SWM_ARG_ID_LAYOUT_FLOATING (65)
#define SWM_ARG_ID_DONTCENTER (70)
#define SWM_ARG_ID_CENTER (71)
#define SWM_ARG_ID_KILLWINDOW (80)
#define SWM_ARG_ID_DELETEWINDOW (81)
#define SWM_ARG_ID_WIDTHGROW (90)
#define SWM_ARG_ID_WIDTHSHRINK (91)
#define SWM_ARG_ID_HEIGHTGROW (92)
#define SWM_ARG_ID_HEIGHTSHRINK (93)
#define SWM_ARG_ID_MOVEUP (100)
#define SWM_ARG_ID_MOVEDOWN (101)
#define SWM_ARG_ID_MOVELEFT (102)
#define SWM_ARG_ID_MOVERIGHT (103)
#define SWM_ARG_ID_BAR_TOGGLE (110)
#define SWM_ARG_ID_BAR_TOGGLE_WS (111)
#define SWM_ARG_ID_CYCLERG_MOVE_UP (112)
#define SWM_ARG_ID_CYCLERG_MOVE_DOWN (113)
#define SWM_ARG_ID_WS_EMPTY (120)
#define SWM_ARG_ID_WS_EMPTY_MOVE (121)
#define SWM_ARG_ID_RESTARTOFDAY (130)
char **argv;
};
#define SWM_ASOP_BASIC (1 << 0)
#define SWM_ASOP_ADD (1 << 1)
#define SWM_ASOP_SUBTRACT (1 << 2)
/* quirks */
struct quirk {
TAILQ_ENTRY(quirk) entry;
char *class; /* WM_CLASS:class */
char *instance; /* WM_CLASS:instance */
char *name; /* WM_NAME */
regex_t regex_class;
regex_t regex_instance;
regex_t regex_name;
uint32_t type;
uint8_t mode; /* Assignment mode. */
uint32_t quirk;
int ws; /* Initial workspace. */
#define SWM_Q_FLOAT (1 << 0) /* Float this window. */
#define SWM_Q_TRANSSZ (1 << 1) /* Transient window size too small. */
#define SWM_Q_ANYWHERE (1 << 2) /* Don't position this window */
#define SWM_Q_XTERM_FONTADJ (1 << 3) /* Adjust xterm fonts when resizing. */
#define SWM_Q_FULLSCREEN (1 << 4) /* Remove border when fullscreen. */
#define SWM_Q_FOCUSPREV (1 << 5) /* Focus on caller. */
#define SWM_Q_NOFOCUSONMAP (1 << 6) /* Don't focus on window when mapped.*/
#define SWM_Q_FOCUSONMAP_SINGLE (1 << 7) /* Only focus if single win of type. */
#define SWM_Q_OBEYAPPFOCUSREQ (1 << 8) /* Focus when applications ask. */
#define SWM_Q_IGNOREPID (1 << 9) /* Ignore PID when determining ws. */
#define SWM_Q_IGNORESPAWNWS (1 << 10)/* Ignore _SWM_WS when managing win. */
#define SWM_Q_NOFOCUSCYCLE (1 << 11)/* Remove from normal focus cycle. */
#define SWM_Q_MINIMALBORDER (1 << 12)/* No border when floating/unfocused.*/
#define SWM_Q_MAXIMIZE (1 << 13)/* Maximize window when mapped. */
#define SWM_Q_BELOW (1 << 14)/* Put window below when mapped. */
#define SWM_Q_ICONIFY (1 << 15)/* Put window below when mapped. */
};
TAILQ_HEAD(quirk_list, quirk) quirks = TAILQ_HEAD_INITIALIZER(quirks);
/*
* Supported EWMH hints should be added to
* both the enum and the ewmh array
*/
enum {
_NET_ACTIVE_WINDOW,
_NET_CLIENT_LIST,
_NET_CLOSE_WINDOW,
_NET_CURRENT_DESKTOP,
_NET_DESKTOP_GEOMETRY,
_NET_DESKTOP_NAMES,
_NET_DESKTOP_VIEWPORT,
_NET_MOVERESIZE_WINDOW,
_NET_NUMBER_OF_DESKTOPS,