summaryrefslogtreecommitdiff
path: root/files/old-config/qtile/config.py
blob: beee8aaabb8be8eaffe2f4efc272277218114ba4 (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
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
#     ______     __      __  __                                                 ______   __
#    /      \   /  |    /  |/  |                                               /      \ /  |
#   /$$$$$$  | _$$ |_   $$/ $$ |  ______          _______   ______   _______  /$$$$$$  |$$/   ______
#   $$ |  $$ |/ $$   |  /  |$$ | /      \        /       | /      \ /       \ $$ |_ $$/ /  | /      \
#   $$ |  $$ |$$$$$$/   $$ |$$ |/$$$$$$  |      /$$$$$$$/ /$$$$$$  |$$$$$$$  |$$   |    $$ |/$$$$$$  |
#   $$ |_ $$ |  $$ | __ $$ |$$ |$$    $$ |      $$ |      $$ |  $$ |$$ |  $$ |$$$$/     $$ |$$ |  $$ |
#   $$ / \$$ |  $$ |/  |$$ |$$ |$$$$$$$$/       $$ \_____ $$ \__$$ |$$ |  $$ |$$ |      $$ |$$ \__$$ |
#   $$ $$ $$<   $$  $$/ $$ |$$ |$$       |      $$       |$$    $$/ $$ |  $$ |$$ |      $$ |$$    $$ |
#    $$$$$$  |   $$$$/  $$/ $$/  $$$$$$$/        $$$$$$$/  $$$$$$/  $$/   $$/ $$/       $$/  $$$$$$$ |
#       $$$/                                                                               /  \__$$ |
#                                                                                          $$    $$/
#                                                                                           $$$$$$/

#----------------------------------------------------------------------------------#
#                                    Imports                                       #
#              Basically dependancys needed to run some commands                   #
#----------------------------------------------------------------------------------#

from libqtile import bar, layout, widget
from libqtile.config import Click, Drag, Group, Key, Match, Screen
from libqtile.lazy import lazy
from libqtile.utils import guess_terminal
from libqtile import hook
import subprocess

#----------------------------------------------------------------------------------#
#                                     Key binds                                    #
#----------------------------------------------------------------------------------#

mod = "mod4"
terminal = guess_terminal()

keys = [
    Key([mod], "h", lazy.layout.left(), desc="Move focus to left"),
    Key([mod], "l", lazy.layout.right(), desc="Move focus to right"),
    Key([mod], "j", lazy.layout.down(), desc="Move focus down"),
    Key([mod], "k", lazy.layout.up(), desc="Move focus up"),
    Key([mod], "space", lazy.layout.next(), desc="Move window focus to other window"),

    Key([mod, "shift"], "h", lazy.layout.shuffle_left(), desc="Move window to the left"),
    Key([mod, "shift"], "l", lazy.layout.shuffle_right(), desc="Move window to the right"),
    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, "control"], "h", lazy.layout.grow_left(), desc="Grow window to the left"),
    Key([mod, "control"], "l", lazy.layout.grow_right(), desc="Grow window to the right"),
    Key([mod, "control"], "j", lazy.layout.grow_down(), desc="Grow window down"),
    Key([mod, "control"], "k", lazy.layout.grow_up(), desc="Grow window up"),

    Key([mod], "n", lazy.layout.normalize(), desc="Reset all window sizes"),

    Key([mod, "shift"], "Return", lazy.layout.toggle_split(), desc="Toggle between split and unsplit sides of stack"),
    Key([mod], "Return", lazy.spawn(terminal), desc="Launch terminal"),
    Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"),
    Key([mod], "w", lazy.window.kill(), desc="Kill focused window"),
    Key([mod], "f", lazy.window.toggle_fullscreen(), desc="Toggle fullscreen on the focused window"),
    Key([mod], "t", lazy.window.toggle_floating(), desc="Toggle floating on the focused window"),
    Key([mod, "control"], "r", lazy.reload_config(), desc="Reload the config"),
    Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"),

    # Programs shortcuts
    Key([mod], "f", lazy.spawn("librewolf")),
    Key([mod], "d", lazy.spawn("discord")),
    Key([mod], "s", lazy.spawn("steam")),
    Key([mod], "v", lazy.spawn("alacritty -e vim")),
    Key([mod], "p", lazy.spawn("pavucontrol")),
    Key([mod], "n", lazy.spawn("nitrogen")),

    Key([mod], "r", lazy.spawn("rofi -show drun -show-icons")),

    Key([mod, "shift"], "t", lazy.spawn("thunar")),
    Key([mod, "shift"], "p", lazy.spawn("prismlauncher")),
    #Screenshot
    Key([], "Print", lazy.spawn("scrot -s")),
]
#----------------------------------------------------------------------------------#
#                                    Groups                                        #
#----------------------------------------------------------------------------------#


groups = [
    Group("1"),
    Group("2"),
    Group("3"),
    Group("4"),
    Group("5"),
    Group("6"),
    Group("7"),
    Group("8"),
    Group("9"),
]


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

            Key(
                [mod, "shift"],
                i.name,
                lazy.window.togroup(i.name, switch_group=True),
                desc="Switch to & move focused window to group {}".format(i.name),
            ),

        ]
    )

#----------------------------------------------------------------------------------#
#                     Diffrent layouts that are available                          #
#----------------------------------------------------------------------------------#
layouts = [

     layout.Bsp(
        border_focus_stack=["#00ff00", "#00ff00"],
        border_focus= purple,
        border_normal= dpurple,
        border_width=4,
     ),

     layout.Max(),
]

widget_defaults = dict(
    font="bold_sans",
    fontsize=15,
    padding=3,
)

#----------------------------------------------------------------------------------#
#                             Widgets and status bar                               #
#----------------------------------------------------------------------------------#
screens = [ Screen() ]
# Nothing here because I use picom
#----------------------------------------------------------------------------------#
#                             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.bring_to_front()),
]

dgroups_key_binder = None
dgroups_app_rules = []  # type: list
follow_mouse_focus = True
bring_front_click = False
floats_kept_above = True
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


#----------------------------------------------------------------------------------#
#                            If programs want to maxamize                          #
#     this allows things like steam or virtual box to function in full screen      #
#----------------------------------------------------------------------------------#

auto_minimize = True


# When using the Wayland backend, this can be used to configure input devices.
wl_input_rules = None

#----------------------------------------------------------------------------------#
#                  window manager name (will show on neofetch)                     #
#       I suggest just leaving it, since it has something to do with java          #
#----------------------------------------------------------------------------------#

wmname = "LG3D"

#----------------------------------------------------------------------------------#
#                                   Autostart programs                             #
#                     Please be careful and double check if all works              #
#----------------------------------------------------------------------------------#
#                           lauches nitrogen wallpaper                             #
#----------------------------------------------------------------------------------#

@hook.subscribe.startup_once
def autostart():
    subprocess.Popen(["nitrogen", "--restore"])

#----------------------------------------------------------------------------------#
#                                launches picom :D                                 #
#----------------------------------------------------------------------------------#

@hook.subscribe.startup_once
def autostart():
    subprocess.Popen(["picom", "&"], shell=True)

#----------------------------------------------------------------------------------#
#           Runs redshift so I don't get sick after a day of coding                #
#----------------------------------------------------------------------------------#

@hook.subscribe.startup_once
def autostart():
    subprocess.Popen(["redshift"], shell=True)

#----------------------------------------------------------------------------------#
#                      Polybar for the status bar                                  #
#----------------------------------------------------------------------------------#

@hook.subscribe.startup_once
def autostart():
    subprocess.Popen(["polybar"], shell=True)