about summary refs log tree commit diff stats
path: root/dot_config/qtile/config.py
blob: 2d5ebad5b20f939e5299c611dda18e4f197ba008 (plain) (blame)
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
from libqtile import bar, layout, widget
from libqtile.config import Click, Drag, Group, Key, Match, Screen
from libqtile.lazy import lazy

mod = "mod4"
terminal = "alacritty"
browser = "firefox"
run_prompt = "dmenu_run"

# colors
accent  = "#ea6962"
accent2 = "#d8a657"
bg_col  = "#282828"
fg_col  = "#d4be98"

# custom functions
def SplitString(string):
    return list(string.split(" "))

keys = [
    Key([mod], "j",
        lazy.layout.down(),
        desc="Move focus down"),
    Key([mod], "k",
        lazy.layout.up(),
        desc="Move focus up"),

    Key([mod, "shift"], "j",
        lazy.layout.shuffle_down(),
        desc="Move window down"),
    Key([mod, "shift"], "k",
        lazy.layout.shuffle_up(),
        desc="Move window up"),

    Key([mod], "h",
        lazy.layout.grow(),
        desc="Grow window to the left"),
    Key([mod], "l",
        lazy.layout.shrink(),
        desc="Grow window to the right"),
    Key([mod], "n",
        lazy.layout.normalize(),
        desc="Reset all window sizes"),

    Key([mod], "Return",
        lazy.spawn(terminal),
        desc="Launch terminal"),
    Key([mod], "b",
        lazy.spawn(browser),
        desc="Launch browser"),
    Key([mod], "r",
        lazy.spawn(run_prompt),
        desc="Spawn a command using a prompt widget"),
    Key([mod], "p",
        lazy.spawn("screenshotit"),
        desc="Literally a screenshot utility, wow"),
    Key([mod, "shift"], "s",
        lazy.spawn("shorten-clipb"),
        desc="Shortens a url (via 0.vern.cc) that's on the clipboard"),

    Key([mod], "space",
        lazy.next_layout(),
        desc="Toggle between layouts"),
    Key([mod], "w",
        lazy.window.kill(),
        desc="Kill focused window"),
    Key([mod, "shift"], "r",
        lazy.reload_config(),
        desc="Reload the config"),
    Key([mod, "shift"], "q",
        lazy.shutdown(),
        desc="Shutdown Qtile"),
]

groups = [Group(i) for i in "123456789"]

for i in groups:
    keys.extend(
        [
            # mod1 + letter of group = switch to group
            Key(
                [mod],
                i.name,
                lazy.group[i.name].toscreen(),
                desc="Switch to group {}".format(i.name),
            ),

            # mod1 + shift + letter of group = move focused window to group
            Key([mod, "shift"], i.name,
                lazy.window.togroup(i.name),
                desc="move focused window to group {}".format(i.name)),
        ]
    )

layouts = [
    layout.MonadTall(border_focus = accent,
                     border_unfocus = "#222222",
                     border_width = 1,
                     margin = 2),
    layout.Max(),
]

widget_defaults = dict(
    font       = "monospace",
    fontsize   = 12,
    padding    = 3,
    background = bg_col,
    foreground = fg_col,
)

screens = [
    Screen(
        top=bar.Bar(
            [
                widget.CurrentLayoutIcon(scale=0.8, custom_icon_paths="~/.config/qtile/icons"),
                widget.GroupBox(rounded=False, highlight_method="block", active=fg_col, inactive=fg_col, urgent_border=accent2, this_current_screen_border=accent, margin=5, disable_drag=True),
                #widget.WindowName(),
                widget.Spacer(length=bar.STRETCH),
                widget.Chord(
                    chords_colors={
                        "launch": ("#ff0000", "#ffffff"),
                    },
                    name_transform=lambda name: name.upper(),
                ),
                # widget.StatusNotifier(),
                widget.Systray(),
                widget.Clock(format="%Y-%m-%d %a %I:%M %p"),
            ],
            24,
            # border_width=[2, 0, 2, 0],  # Draw top and bottom borders
            # border_color=["ff00ff", "000000", "ff00ff", "000000"]  # Borders are magenta
        ),
    ),
]

# Drag floating layouts.
mouse = [
    Drag([mod], "Button1", lazy.window.set_position_floating(), start=lazy.window.get_position()),
    Drag([mod], "Button3", lazy.window.set_size_floating(), start=lazy.window.get_size()),
    Click([mod], "Button2", lazy.window.toggle_floating())
]

dgroups_key_binder = None
dgroups_app_rules = []  # type: list
follow_mouse_focus = True
bring_front_click = False
cursor_warp = False
floating_layout = layout.Floating(
    float_rules=[
        # Run the utility of `xprop` to see the wm class and name of an X client.
        *layout.Floating.default_float_rules,
        Match(wm_class="confirmreset"),  # gitk
        Match(wm_class="makebranch"),  # gitk
        Match(wm_class="maketag"),  # gitk
        Match(wm_class="ssh-askpass"),  # ssh-askpass
        Match(title="branchdialog"),  # gitk
        Match(title="pinentry"),  # GPG key password entry
    ]
)
auto_fullscreen = True
focus_on_window_activation = "smart"
reconfigure_screens = True

auto_minimize = False

wl_input_rules = None

wmname = "LG3D"