summaryrefslogtreecommitdiff
path: root/src/config.rs
blob: 76a9463889122fbad4ea8886d9f7e2b53374764b (plain)
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
//! 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, mouse_move, mouse_resize, 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::N4;

/// Command for application menu / launcher.
pub const MENU_COMMAND: &str = "j4-dmenu-desktop";

/// The keybinds to use.
pub const KEYBINDS: Keybinds = Keybinds(&[
    bind!(MAIN_MODIFIER , Return -> &|_| spawn::<_, &str>(MENU_COMMAND, [])),
    bind!(MAIN_MODIFIER , t -> &|_| spawn::<_, &str>("alacritty", [])),
    bind!(MAIN_MODIFIER , i -> &|_| spawn::<_, &str>("sh", ["-c", "if pgrep eww; then pkill eww; else eww daemon && eww open overlay; fi"])),
    bind!(MAIN_MODIFIER , XF86_AudioRaiseVolume -> &|_| spawn::<_, &str>("/run/current-system/sw/bin/wpctl", ["set-volume", "@DEFAULT_AUDIO_SINK@", "5%+"])),
    bind!(MAIN_MODIFIER , F7 -> &|_| spawn::<_, &str>("/run/current-system/sw/bin/wpctl", ["set-volume", "@DEFAULT_AUDIO_SINK@", "5%+"])),
    bind!(MAIN_MODIFIER , XF86_AudioLowerVolume -> &|_| spawn::<_, &str>("/run/current-system/sw/bin/wpctl", ["set-volume", "@DEFAULT_AUDIO_SINK@", "5%-"])),
    bind!(MAIN_MODIFIER , F6 -> &|_| spawn::<_, &str>("/run/current-system/sw/bin/wpctl", ["set-volume", "@DEFAULT_AUDIO_SINK@", "5%+"])),
    bind!(MAIN_MODIFIER , XF86_AudioMute -> &|_| spawn::<_, &str>("/run/current-system/sw/bin/wpctl", ["set-mute", "toggle"])),
    bind!(MAIN_MODIFIER , F8 -> &|_| spawn::<_, &str>("/run/current-system/sw/bin/wpctl", ["set-volume", "@DEFAULT_AUDIO_SINK@", "5%+"])),
    bind!(MAIN_MODIFIER , XF86_MonBrightnessUp -> &|_| spawn::<_, &str>("/run/current-system/sw/bin/light", ["-A", "5"])),
    bind!(MAIN_MODIFIER , XF86_MonBrightnessDown -> &|_| spawn::<_, &str>("/run/current-system/sw/bin/light", ["-U", "5"])),
    bind!(MAIN_MODIFIER , Print -> &|_| spawn::<_, &str>("sh", ["-c", "screenshot"])),
    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,                       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 } },
    // { MODKEY|ShiftMask,             XK_q,      quit,           {0} },
]);

/// The (mouse) button binds to use
pub const BUTTON_BINDS: ButtonBinds = ButtonBinds(&[
    bind_btn!(MAIN_MODIFIER , N1 -> &mouse_move),
    bind_btn!(MAIN_MODIFIER , N2 -> &mouse_resize),
]);