| 1 | # Qtile config -- Darkmatter |
| 2 | # Palette matches the Darkmatter GTK theme, alacritty, and emacs themes. |
| 3 | |
| 4 | import os |
| 5 | |
| 6 | from libqtile import bar, layout, qtile, widget |
| 7 | from libqtile.config import Click, Drag, Group, Key, Match, Screen |
| 8 | from libqtile.lazy import lazy |
| 9 | |
| 10 | mod = "mod4" |
| 11 | terminal = "alacritty" |
| 12 | launcher = "rofi -show drun" |
| 13 | |
| 14 | # Darkmatter palette (see the gtk3 theme README for the roles) |
| 15 | colors = { |
| 16 | "shadow": "#060506", |
| 17 | "bg": "#121113", |
| 18 | "bg_alt": "#1c1b1d", |
| 19 | "hover": "#222222", |
| 20 | "border": "#2b2b2b", |
| 21 | "grey": "#333333", |
| 22 | "disabled": "#888888", |
| 23 | "muted": "#999999", |
| 24 | "near_fg": "#c1c1c1", |
| 25 | "fg": "#ffffff", |
| 26 | "green": "#5f8787", |
| 27 | "yellow": "#fbcb97", |
| 28 | "accent": "#fbcb97", |
| 29 | "red": "#e75353", |
| 30 | } |
| 31 | |
| 32 | font = "BerkeleyMono Nerd Font Mono" |
| 33 | |
| 34 | keys = [ |
| 35 | # Switch between windows |
| 36 | Key([mod], "h", lazy.layout.left(), desc="Move focus to left"), |
| 37 | Key([mod], "l", lazy.layout.right(), desc="Move focus to right"), |
| 38 | Key([mod], "j", lazy.layout.down(), desc="Move focus down"), |
| 39 | Key([mod], "k", lazy.layout.up(), desc="Move focus up"), |
| 40 | Key([mod], "space", lazy.layout.next(), desc="Move window focus to other window"), |
| 41 | # Move windows between columns or up/down in the current stack |
| 42 | Key([mod, "shift"], "h", lazy.layout.shuffle_left(), desc="Move window to the left"), |
| 43 | Key([mod, "shift"], "l", lazy.layout.shuffle_right(), desc="Move window to the right"), |
| 44 | Key([mod, "shift"], "j", lazy.layout.shuffle_down(), desc="Move window down"), |
| 45 | Key([mod, "shift"], "k", lazy.layout.shuffle_up(), desc="Move window up"), |
| 46 | # Grow windows |
| 47 | Key([mod, "control"], "h", lazy.layout.grow_left(), desc="Grow window to the left"), |
| 48 | Key([mod, "control"], "l", lazy.layout.grow_right(), desc="Grow window to the right"), |
| 49 | Key([mod, "control"], "j", lazy.layout.grow_down(), desc="Grow window down"), |
| 50 | Key([mod, "control"], "k", lazy.layout.grow_up(), desc="Grow window up"), |
| 51 | Key([mod], "n", lazy.layout.normalize(), desc="Reset all window sizes"), |
| 52 | Key( |
| 53 | [mod, "shift"], |
| 54 | "Return", |
| 55 | lazy.layout.toggle_split(), |
| 56 | desc="Toggle between split and unsplit sides of stack", |
| 57 | ), |
| 58 | Key([mod], "Return", lazy.spawn(terminal), desc="Launch terminal"), |
| 59 | Key([mod], "d", lazy.spawn(launcher), desc="Launch application"), |
| 60 | Key([mod], "Tab", lazy.next_layout(), desc="Toggle between layouts"), |
| 61 | Key([mod], "w", lazy.window.kill(), desc="Kill focused window"), |
| 62 | Key([mod], "f", lazy.window.toggle_fullscreen(), desc="Toggle fullscreen"), |
| 63 | Key([mod], "t", lazy.window.toggle_floating(), desc="Toggle floating"), |
| 64 | Key([mod], "b", lazy.hide_show_bar(), desc="Toggle the bar"), |
| 65 | Key([mod, "control"], "r", lazy.reload_config(), desc="Reload the config"), |
| 66 | Key([mod, "control"], "q", lazy.shutdown(), desc="Shutdown Qtile"), |
| 67 | Key([mod], "r", lazy.spawncmd(), desc="Spawn a command using a prompt widget"), |
| 68 | ] |
| 69 | |
| 70 | # Switch VTs under Wayland; deferred since qtile.core isn't set at load time |
| 71 | for vt in range(1, 8): |
| 72 | keys.append( |
| 73 | Key( |
| 74 | ["control", "mod1"], |
| 75 | f"f{vt}", |
| 76 | lazy.core.change_vt(vt).when(func=lambda: qtile.core.name == "wayland"), |
| 77 | desc=f"Switch to VT{vt}", |
| 78 | ) |
| 79 | ) |
| 80 | |
| 81 | groups = [Group(i) for i in "123456789"] |
| 82 | |
| 83 | for i in groups: |
| 84 | keys.extend( |
| 85 | [ |
| 86 | Key([mod], i.name, lazy.group[i.name].toscreen(), desc=f"Switch to group {i.name}"), |
| 87 | Key( |
| 88 | [mod, "shift"], |
| 89 | i.name, |
| 90 | lazy.window.togroup(i.name, switch_group=True), |
| 91 | desc=f"Switch to & move focused window to group {i.name}", |
| 92 | ), |
| 93 | ] |
| 94 | ) |
| 95 | |
| 96 | layout_theme = dict( |
| 97 | border_width=2, |
| 98 | margin=6, |
| 99 | border_focus=colors["yellow"], |
| 100 | border_normal=colors["bg"], |
| 101 | ) |
| 102 | |
| 103 | layouts = [ |
| 104 | layout.Columns( |
| 105 | **layout_theme, |
| 106 | border_focus_stack=colors["accent"], |
| 107 | border_normal_stack=colors["bg"], |
| 108 | border_on_single=True, |
| 109 | ), |
| 110 | layout.Max(margin=6), |
| 111 | ] |
| 112 | |
| 113 | widget_defaults = dict( |
| 114 | font=font, |
| 115 | fontsize=14, |
| 116 | padding=6, |
| 117 | background=colors["bg"], |
| 118 | foreground=colors["near_fg"], |
| 119 | ) |
| 120 | extension_defaults = widget_defaults.copy() |
| 121 | |
| 122 | |
| 123 | def sep(): |
| 124 | return widget.TextBox("│", foreground=colors["grey"], padding=2) |
| 125 | |
| 126 | |
| 127 | screens = [ |
| 128 | Screen( |
| 129 | wallpaper=os.path.expanduser("~/wallpapers/assets/temple.png"), |
| 130 | wallpaper_mode="fill", |
| 131 | top=bar.Bar( |
| 132 | [ |
| 133 | widget.GroupBox( |
| 134 | highlight_method="line", |
| 135 | highlight_color=[colors["bg"], colors["bg"]], |
| 136 | this_current_screen_border=colors["accent"], |
| 137 | this_screen_border=colors["grey"], |
| 138 | other_current_screen_border=colors["green"], |
| 139 | other_screen_border=colors["grey"], |
| 140 | active=colors["fg"], |
| 141 | inactive=colors["grey"], |
| 142 | urgent_alert_method="text", |
| 143 | urgent_text=colors["red"], |
| 144 | rounded=False, |
| 145 | disable_drag=True, |
| 146 | padding_x=6, |
| 147 | ), |
| 148 | sep(), |
| 149 | widget.CurrentLayout(foreground=colors["yellow"]), |
| 150 | sep(), |
| 151 | widget.Prompt( |
| 152 | foreground=colors["accent"], |
| 153 | cursor_color=colors["fg"], |
| 154 | prompt="run: ", |
| 155 | ), |
| 156 | widget.WindowName(foreground=colors["muted"], max_chars=80), |
| 157 | widget.Chord( |
| 158 | chords_colors={"launch": (colors["accent"], colors["bg"])}, |
| 159 | name_transform=lambda name: name.upper(), |
| 160 | ), |
| 161 | widget.Systray(background=colors["bg"]), |
| 162 | sep(), |
| 163 | widget.Clock( |
| 164 | format="%a, %b %d - %-I:%M %p", |
| 165 | foreground=colors["fg"], |
| 166 | ), |
| 167 | ], |
| 168 | 28, |
| 169 | background=colors["bg"], |
| 170 | border_width=[0, 0, 1, 0], |
| 171 | border_color=colors["border"], |
| 172 | ), |
| 173 | ), |
| 174 | ] |
| 175 | |
| 176 | # Drag floating layouts. |
| 177 | mouse = [ |
| 178 | Drag([mod], "Button1", lazy.window.set_position_floating(), start=lazy.window.get_position()), |
| 179 | Drag([mod], "Button3", lazy.window.set_size_floating(), start=lazy.window.get_size()), |
| 180 | Click([mod], "Button2", lazy.window.bring_to_front()), |
| 181 | ] |
| 182 | |
| 183 | dgroups_key_binder = None |
| 184 | dgroups_app_rules = [] # type: list |
| 185 | follow_mouse_focus = True |
| 186 | bring_front_click = False |
| 187 | floats_kept_above = True |
| 188 | cursor_warp = False |
| 189 | floating_layout = layout.Floating( |
| 190 | border_width=2, |
| 191 | border_focus=colors["green"], |
| 192 | border_normal=colors["grey"], |
| 193 | float_rules=[ |
| 194 | # Run `xprop` to see the wm class and name of an X client. |
| 195 | *layout.Floating.default_float_rules, |
| 196 | Match(wm_class="confirmreset"), # gitk |
| 197 | Match(wm_class="makebranch"), # gitk |
| 198 | Match(wm_class="maketag"), # gitk |
| 199 | Match(wm_class="ssh-askpass"), # ssh-askpass |
| 200 | Match(title="branchdialog"), # gitk |
| 201 | Match(title="pinentry"), # GPG key password entry |
| 202 | ], |
| 203 | ) |
| 204 | auto_fullscreen = True |
| 205 | focus_on_window_activation = "smart" |
| 206 | reconfigure_screens = True |
| 207 | auto_minimize = True |
| 208 | |
| 209 | wl_input_rules = None |
| 210 | wl_xcursor_theme = None |
| 211 | wl_xcursor_size = 24 |
| 212 | |
| 213 | # Keeps java UI toolkits happy |
| 214 | wmname = "LG3D" |