2bwm/config.h (view raw)
1///---User configurable stuff---///
2
3///---Modifiers---///
4#define MOD XCB_MOD_MASK_4 /* Super/Windows key or check xmodmap(1) with -pm defined in /usr/include/xcb/xproto.h */
5
6///--Speed---///
7/* Move this many pixels when moving or resizing with keyboard unless the window has hints saying otherwise.
8 *0)move step slow 1)move step fast
9 *2)mouse slow 3)mouse fast */
10static const uint16_t movements[] = {
11 20,
12 100,
13 15,
14 400
15};
16
17/* resize by line like in mcwm -- jmbi */
18static const bool resize_by_line = false;
19
20/* the ratio used when resizing and keeping the aspect */
21static const float resize_keep_aspect_ratio= 1.03;
22
23///---Offsets---///
24/*0)offsetx 1)offsety
25 *2)maxwidth 3)maxheight */
26static const uint8_t offsets[] = {0,0,0,0};
27
28///---Colors---///
29/*0)focuscol 1)unfocuscol
30 *2)fixedcol 3)unkilcol
31 *4)fixedunkilcol 5)outerbordercol
32 *6)emptycol */
33static const char *colors[] = {
34 "#35586c",
35 "#333333",
36 "#7a8c5c",
37 "#ff6666",
38 "#cc9933",
39 "#0d131a",
40 "#FAFAFA"
41};
42
43/* if this is set to true the inner border and outer borders colors will be swapped */
44static const bool inverted_colors = true;
45
46///---Cursor---///
47/* default position of the cursor:
48 * correct values are:
49 * TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT, MIDDLE
50 * All these are relative to the current window. */
51#define CURSOR_POSITION MIDDLE
52
53///---Borders---///
54/*0) Outer border size. If you put this negative it will be a square.
55 *1) Full borderwidth 2) Magnet border size
56 *3) Resize border size */
57static const uint8_t borders[] = {
58 0,
59 0,
60 5,
61 4
62};
63
64/* Windows that won't have a border.
65 * It uses substring comparison with what is found in the WM_NAME
66 * attribute of the window. You can test this using `xprop WM_NAME`
67 */
68#define LOOK_INTO "WM_NAME"
69static const char *ignore_names[] = {"bar", "xclock"};
70
71///--Menus and Programs---///
72static const char *terminal[] = {"st", NULL};
73static const char *dmenu[] = {"dmenu_run", NULL};
74
75///--Custom foo---///
76static void halfandcentered(const Arg *arg)
77{
78 Arg arg2 = {.i=TWOBWM_MAXHALF_VERTICAL_LEFT};
79 maxhalf(&arg2);
80 Arg arg3 = {.i=TWOBWM_TELEPORT_CENTER};
81 teleport(&arg3);
82}
83
84
85///---Shortcuts---///
86/* Check /usr/include/X11/keysymdef.h for the list of all keys
87 * 0x000000 is for no modkey
88 * If you are having trouble finding the right keycode use the `xev` to get it
89 * For example:
90 * KeyRelease event, serial 40, synthetic NO, window 0x1e00001,
91 * root 0x98, subw 0x0, time 211120530, (128,73), root:(855,214),
92 * state 0x10, keycode 171 (keysym 0x1008ff17, XF86AudioNext), same_screen YES,
93 * XLookupString gives 0 bytes:
94 * XFilterEvent returns: False
95 *
96 * The keycode here is keysym 0x1008ff17, so use 0x1008ff17
97 *
98 *
99 * For AZERTY keyboards XK_1...0 should be replaced by :
100 * DESKTOPCHANGE( XK_ampersand, 0)
101 * DESKTOPCHANGE( XK_eacute, 1)
102 * DESKTOPCHANGE( XK_quotedbl, 2)
103 * DESKTOPCHANGE( XK_apostrophe, 3)
104 * DESKTOPCHANGE( XK_parenleft, 4)
105 * DESKTOPCHANGE( XK_minus, 5)
106 * DESKTOPCHANGE( XK_egrave, 6)
107 * DESKTOPCHANGE( XK_underscore, 7)
108 * DESKTOPCHANGE( XK_ccedilla, 8)
109 * DESKTOPCHANGE( XK_agrave, 9)*
110 */
111#define DESKTOPCHANGE(K,N) \
112{ MOD , K, changeworkspace, {.i=N}}, \
113{ MOD |SHIFT, K, sendtoworkspace, {.i=N}},
114static key keys[] = {
115 /* modifier key function argument */
116 // Focus to next/previous window
117 { ALT, XK_Tab, focusnext, {.i=TWOBWM_FOCUS_NEXT}},
118 { ALT |SHIFT, XK_Tab, focusnext, {.i=TWOBWM_FOCUS_PREVIOUS}},
119 // Kill a window
120 { MOD | SHIFT, XK_q, deletewin, {}},
121 // Resize a window
122 { MOD |SHIFT, XK_k, resizestep, {.i=TWOBWM_RESIZE_UP}},
123 { MOD |SHIFT, XK_j, resizestep, {.i=TWOBWM_RESIZE_DOWN}},
124 { MOD |SHIFT, XK_l, resizestep, {.i=TWOBWM_RESIZE_RIGHT}},
125 { MOD |SHIFT, XK_h, resizestep, {.i=TWOBWM_RESIZE_LEFT}},
126 // Resize a window slower
127 { MOD |SHIFT|CONTROL,XK_k, resizestep, {.i=TWOBWM_RESIZE_UP_SLOW}},
128 { MOD |SHIFT|CONTROL,XK_j, resizestep, {.i=TWOBWM_RESIZE_DOWN_SLOW}},
129 { MOD |SHIFT|CONTROL,XK_l, resizestep, {.i=TWOBWM_RESIZE_RIGHT_SLOW}},
130 { MOD |SHIFT|CONTROL,XK_h, resizestep, {.i=TWOBWM_RESIZE_LEFT_SLOW}},
131 // Move a window
132 { MOD , XK_k, movestep, {.i=TWOBWM_MOVE_UP}},
133 { MOD , XK_j, movestep, {.i=TWOBWM_MOVE_DOWN}},
134 { MOD , XK_l, movestep, {.i=TWOBWM_MOVE_RIGHT}},
135 { MOD , XK_h, movestep, {.i=TWOBWM_MOVE_LEFT}},
136 // Move a window slower
137 { MOD |CONTROL, XK_k, movestep, {.i=TWOBWM_MOVE_UP_SLOW}},
138 { MOD |CONTROL, XK_j, movestep, {.i=TWOBWM_MOVE_DOWN_SLOW}},
139 { MOD |CONTROL, XK_l, movestep, {.i=TWOBWM_MOVE_RIGHT_SLOW}},
140 { MOD |CONTROL, XK_h, movestep, {.i=TWOBWM_MOVE_LEFT_SLOW}},
141 // Teleport the window to an area of the screen.
142 // Center:
143 { MOD , XK_g, teleport, {.i=TWOBWM_TELEPORT_CENTER}},
144 // Center y:
145 { MOD |SHIFT, XK_g, teleport, {.i=TWOBWM_TELEPORT_CENTER_Y}},
146 // Center x:
147 { MOD |CONTROL, XK_g, teleport, {.i=TWOBWM_TELEPORT_CENTER_X}},
148 // Top left:
149 { MOD , XK_y, teleport, {.i=TWOBWM_TELEPORT_TOP_LEFT}},
150 // Top right:
151 { MOD , XK_u, teleport, {.i=TWOBWM_TELEPORT_TOP_RIGHT}},
152 // Bottom left:
153 { MOD , XK_b, teleport, {.i=TWOBWM_TELEPORT_BOTTOM_LEFT}},
154 // Bottom right:
155 { MOD , XK_n, teleport, {.i=TWOBWM_TELEPORT_BOTTOM_RIGHT}},
156 // Resize while keeping the window aspect
157 { MOD , XK_Home, resizestep_aspect, {.i=TWOBWM_RESIZE_KEEP_ASPECT_GROW}},
158 { MOD , XK_End, resizestep_aspect, {.i=TWOBWM_RESIZE_KEEP_ASPECT_SHRINK}},
159 // Maximize (ignore offset and no EWMH atom)
160 { MOD | SHIFT, XK_space, maximize, {}},
161 // Full screen (disregarding offsets and adding EWMH atom)
162 { MOD |SHIFT , XK_x, fullscreen, {}},
163 // Maximize vertically
164 { MOD , XK_m, maxvert_hor, {.i=TWOBWM_MAXIMIZE_VERTICALLY}},
165 // Maximize horizontally
166 { MOD |SHIFT, XK_m, maxvert_hor, {.i=TWOBWM_MAXIMIZE_HORIZONTALLY}},
167 // Maximize and move
168 // vertically left
169 { MOD |SHIFT, XK_y, maxhalf, {.i=TWOBWM_MAXHALF_VERTICAL_LEFT}},
170 // vertically right
171 { MOD |SHIFT, XK_u, maxhalf, {.i=TWOBWM_MAXHALF_VERTICAL_RIGHT}},
172 // horizontally left
173 { MOD |SHIFT, XK_b, maxhalf, {.i=TWOBWM_MAXHALF_HORIZONTAL_BOTTOM}},
174 // horizontally right
175 { MOD |SHIFT, XK_n, maxhalf, {.i=TWOBWM_MAXHALF_HORIZONTAL_TOP}},
176 //fold half vertically
177 { MOD |SHIFT|CONTROL,XK_y, maxhalf, {.i=TWOBWM_MAXHALF_FOLD_VERTICAL}},
178 //fold half horizontally
179 { MOD |SHIFT|CONTROL,XK_b, maxhalf, {.i=TWOBWM_MAXHALF_FOLD_HORIZONTAL}},
180 //unfold vertically
181 { MOD |SHIFT|CONTROL,XK_u, maxhalf, {.i=TWOBWM_MAXHALF_UNFOLD_VERTICAL}},
182 //unfold horizontally
183 { MOD |SHIFT|CONTROL,XK_n, maxhalf, {.i=TWOBWM_MAXHALF_UNFOLD_HORIZONTAL}},
184 // Next/Previous screen
185 { MOD , XK_comma, changescreen, {.i=TWOBWM_NEXT_SCREEN}},
186 { MOD , XK_period, changescreen, {.i=TWOBWM_PREVIOUS_SCREEN}},
187 // Raise or lower a window
188 { MOD , XK_r, raiseorlower, {}},
189 // Next/Previous workspace
190 { MOD , XK_q, nextworkspace, {}},
191 { MOD , XK_c, prevworkspace, {}},
192 // Move to Next/Previous workspace
193 { MOD |SHIFT , XK_v, sendtonextworkspace,{}},
194 { MOD |SHIFT , XK_c, sendtoprevworkspace,{}},
195 // Make the window unkillable
196 { MOD , XK_a, unkillable, {}},
197 // Make the window appear always on top
198 { MOD, XK_t, always_on_top, {}},
199 // Make the window stay on all workspaces
200 { MOD , XK_f, fix, {}},
201 // Move the cursor
202 { MOD , XK_Up, cursor_move, {.i=TWOBWM_CURSOR_UP_SLOW}},
203 { MOD , XK_Down, cursor_move, {.i=TWOBWM_CURSOR_DOWN_SLOW}},
204 { MOD , XK_Right, cursor_move, {.i=TWOBWM_CURSOR_RIGHT_SLOW}},
205 { MOD , XK_Left, cursor_move, {.i=TWOBWM_CURSOR_LEFT_SLOW}},
206 // Move the cursor faster
207 { MOD |SHIFT, XK_Up, cursor_move, {.i=TWOBWM_CURSOR_UP}},
208 { MOD |SHIFT, XK_Down, cursor_move, {.i=TWOBWM_CURSOR_DOWN}},
209 { MOD |SHIFT, XK_Right, cursor_move, {.i=TWOBWM_CURSOR_RIGHT}},
210 { MOD |SHIFT, XK_Left, cursor_move, {.i=TWOBWM_CURSOR_LEFT}},
211 // Start programs
212 { MOD , XK_Return, start, {.com = terminal}},
213 { MOD , XK_d, start, {.com = dmenu}},
214 // Exit or restart 2bwm
215 { MOD |CONTROL, XK_q, twobwm_exit, {.i=0}},
216 { MOD |CONTROL, XK_r, twobwm_restart, {.i=0}},
217 { MOD , XK_space, halfandcentered, {.i=0}},
218 // Change current workspace
219 DESKTOPCHANGE( XK_1, 0)
220 DESKTOPCHANGE( XK_2, 1)
221 DESKTOPCHANGE( XK_3, 2)
222 DESKTOPCHANGE( XK_4, 3)
223 DESKTOPCHANGE( XK_5, 4)
224};
225// the last argument makes it a root window only event
226static Button buttons[] = {
227 { MOD ,XCB_BUTTON_INDEX_1, mousemotion, {.i=TWOBWM_MOVE}, false},
228 { MOD ,XCB_BUTTON_INDEX_3, mousemotion, {.i=TWOBWM_RESIZE}, false},
229 { MOD ,XCB_BUTTON_INDEX_1, raisewindow, {.i=TWOBWM_RESIZE}, false}
230};