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
|
//! User configuration
#![allow(clippy::unreadable_literal)] // Colours are more readable this way imo
use xcb::x::ModMask;
use crate::{
bind, bind_btn,
buttons::ButtonBinds,
clients::TagFocus,
conn_info::Colour,
helpers::{
focus_next, focus_prev, set_tag, set_tag_focus, spawn, toggle_floating, toggle_fullscreen,
},
keys::Keybinds,
};
/// Width of the border around windows
pub const BORDER_WIDTH: u16 = 3;
/// Default border for windows
pub const BORDER_NORMAL: Colour = Colour::from_hex(0x000000);
/// Border around currently focused window
pub const BORDER_FOCUSED: Colour = Colour::from_hex(0xff0000);
/// The main modifier used for keybinds.
pub const MAIN_MODIFIER: ModMask = ModMask::CONTROL;
/// Command for application menu / launcher.
pub const MENU_COMMAND: &str = "dmenu_run";
/// The keybinds to use.
pub const KEYBINDS: Keybinds = Keybinds(&[
bind!(MAIN_MODIFIER , Return -> &|_| spawn::<_, &str>("xterm", [])),
bind!(MAIN_MODIFIER , p -> &|_| spawn::<_, &str>(MENU_COMMAND, [])),
bind!(MAIN_MODIFIER , j -> &focus_next),
bind!(MAIN_MODIFIER , k -> &focus_prev),
bind!(MAIN_MODIFIER.union(ModMask::SHIFT) , space -> &toggle_floating),
bind!(MAIN_MODIFIER.union(ModMask::SHIFT) , f -> &toggle_fullscreen),
bind!(MAIN_MODIFIER , _1 -> &|wm| set_tag_focus(wm, TagFocus::Tag(1))),
bind!(MAIN_MODIFIER , _2 -> &|wm| set_tag_focus(wm, TagFocus::Tag(2))),
bind!(MAIN_MODIFIER , _3 -> &|wm| set_tag_focus(wm, TagFocus::Tag(3))),
bind!(MAIN_MODIFIER , _4 -> &|wm| set_tag_focus(wm, TagFocus::Tag(4))),
bind!(MAIN_MODIFIER , _5 -> &|wm| set_tag_focus(wm, TagFocus::Tag(5))),
bind!(MAIN_MODIFIER , _6 -> &|wm| set_tag_focus(wm, TagFocus::Tag(6))),
bind!(MAIN_MODIFIER , _7 -> &|wm| set_tag_focus(wm, TagFocus::Tag(7))),
bind!(MAIN_MODIFIER , _8 -> &|wm| set_tag_focus(wm, TagFocus::Tag(8))),
bind!(MAIN_MODIFIER , _9 -> &|wm| set_tag_focus(wm, TagFocus::Tag(9))),
bind!(MAIN_MODIFIER , _0 -> &|wm| set_tag_focus(wm, TagFocus::All)),
bind!(MAIN_MODIFIER.union(ModMask::SHIFT) , _1 -> &|wm| set_tag(wm, 1)),
bind!(MAIN_MODIFIER.union(ModMask::SHIFT) , _2 -> &|wm| set_tag(wm, 2)),
bind!(MAIN_MODIFIER.union(ModMask::SHIFT) , _3 -> &|wm| set_tag(wm, 3)),
bind!(MAIN_MODIFIER.union(ModMask::SHIFT) , _4 -> &|wm| set_tag(wm, 4)),
bind!(MAIN_MODIFIER.union(ModMask::SHIFT) , _5 -> &|wm| set_tag(wm, 5)),
bind!(MAIN_MODIFIER.union(ModMask::SHIFT) , _6 -> &|wm| set_tag(wm, 6)),
bind!(MAIN_MODIFIER.union(ModMask::SHIFT) , _7 -> &|wm| set_tag(wm, 7)),
bind!(MAIN_MODIFIER.union(ModMask::SHIFT) , _8 -> &|wm| set_tag(wm, 8)),
bind!(MAIN_MODIFIER.union(ModMask::SHIFT) , _9 -> &|wm| set_tag(wm, 9)),
// { MODKEY, XK_j, focusstack, {.i = +1 } },
// { MODKEY, XK_k, focusstack, {.i = -1 } },
// { MODKEY, XK_i, incnmaster, {.i = +1 } },
// { MODKEY, XK_d, incnmaster, {.i = -1 } },
// { MODKEY, XK_h, setmfact, {.f = -0.05} },
// { MODKEY, XK_l, setmfact, {.f = +0.05} },
// { MODKEY, XK_Return, zoom, {0} },
// { MODKEY, XK_Tab, view, {0} },
// { MODKEY|ShiftMask, XK_c, killclient, {0} },
// { MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
// { MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
// { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
// { MODKEY, XK_space, setlayout, {0} },
// { MODKEY|ShiftMask, XK_space, togglefloating, {0} },
// { MODKEY, XK_0, view, {.ui = ~0 } },
// { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
// { MODKEY, XK_comma, focusmon, {.i = -1 } },
// { MODKEY, XK_period, focusmon, {.i = +1 } },
// { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
// { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
// TAGKEYS( XK_1, 0)
// TAGKEYS( XK_2, 1)
// TAGKEYS( XK_3, 2)
// TAGKEYS( XK_4, 3)
// TAGKEYS( XK_5, 4)
// TAGKEYS( XK_6, 5)
// TAGKEYS( XK_7, 6)
// TAGKEYS( XK_8, 7)
// TAGKEYS( XK_9, 8)
// { MODKEY|ShiftMask, XK_q, quit, {0} },
]);
/// The (mouse) button binds to use
pub const BUTTON_BINDS: ButtonBinds = ButtonBinds(&[
bind_btn!(MAIN_MODIFIER , N1 -> &toggle_floating),
// TODO
]);
|