Skip to content

Commit

Permalink
Cleanup Qtile config
Browse files Browse the repository at this point in the history
  • Loading branch information
Sigmanificient committed Mar 23, 2024
1 parent 0747860 commit 252847b
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 71 deletions.
7 changes: 2 additions & 5 deletions home/qtile/src/core/bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,13 @@ def __init__(self, id_):
widgets=self._build_widgets(),
size=24,
background=Color.BG_DARK,
margin=[0, 0, 8, 0],
margin=[0, 0, 8, 0]
)

def _build_widgets(self):
widgets_copy = [
widget_builder()
for widget_builder in self._widgets]
widgets_copy = [widget_cls() for widget_cls in self._widgets]

if self.id == 0:
widgets_copy.insert(13, Systray())

return widgets_copy

43 changes: 12 additions & 31 deletions home/qtile/src/core/groups.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import re

from libqtile.config import DropDown, Group, Key, ScratchPad, Match
from libqtile.config import DropDown, Group, Key, ScratchPad
from libqtile.lazy import lazy

from .keys import keys, mod
Expand Down Expand Up @@ -33,38 +31,21 @@ def setup_keys(self):

keys.extend((move, switch))

_scratchpad_defaults = dict(
x=0.05,
y=0.05,
opacity=0.95,
height=0.9,
width=0.9,
on_focus_lost_hide=False
)

_scratchpads = [
ScratchPad(
"scratchpad", [
DropDown(
"term",
"kitty",
x=0.05,
y=0.05,
opacity=0.95,
height=0.9,
width=0.9,
on_focus_lost_hide=False,
),
DropDown(
"discord",
"discord",
x=0.05,
y=0.05,
opacity=0.95,
height=0.9,
width=0.9,
on_focus_lost_hide=False,
match=Match(title=re.compile(".*(d|D)iscord.*"))
)
]
"scratchpad",
[DropDown("term", "kitty", **_scratchpad_defaults)]
)
]

_Group.setup_single_keys()
groups = _scratchpads + [
_Group(lb, k) for lb, k in zip(
"ζπδωλσς", "1234567"
)
]
groups = _scratchpads + [_Group(lb, k) for lb, k in zip("ζπδωλσς", "1234567")]
1 change: 0 additions & 1 deletion home/qtile/src/core/keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ def _toggle(*args, **kwargs):
def wrapper(func):
state: bool = False


def wrapped(_):
nonlocal state

Expand Down
15 changes: 5 additions & 10 deletions home/qtile/src/core/layouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
border_width=2,
margin=4,
border_focus=Color.BLUE_DARK,
border_normal=Color.BG_DARK,
)
border_normal=Color.BG_DARK)
]

floating_layout = Floating(
Expand All @@ -19,14 +18,10 @@
border_normal=Color.BG_DARK,
float_rules=[
*Floating.default_float_rules,
Match(wm_class="pavucontrol"), # gitk
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
Match(title="splash"), # .Idea loader
Match(wm_class="pavucontrol"),
Match(wm_class="confirmreset"),
Match(wm_class="ssh-askpass"),
Match(title="pinentry"),
Match(title="kitty"),
],
)
6 changes: 2 additions & 4 deletions home/qtile/src/core/mouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@
[mod],
"Button1",
lazy.window.set_position_floating(),
start=lazy.window.get_position(),
),
start=lazy.window.get_position()),
Drag(
[mod],
"Button3",
lazy.window.set_size_floating(),
start=lazy.window.get_size(),
),
start=lazy.window.get_size()),
Click([mod], "Button2", lazy.window.bring_to_front()),
]
26 changes: 6 additions & 20 deletions home/qtile/src/core/screens.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,14 @@
import pathlib
import os

from libqtile.bar import Gap
from libqtile.config import Screen

from core.bar import Bar

gap = Gap(4)
_gap = Gap(4)
_screen_attr = dict(
bottom=_gap, left=_gap, right=_gap,
wallpaper=os.path.expanduser("~/assets/wallpaper.png"),
wallpaper_mode="fill")

_cwd = pathlib.Path(os.path.dirname(os.path.realpath(__file__)))

wallpaper_path = os.path.expanduser("~/assets/wallpaper.png")

if not os.path.exists(wallpaper_path):
wallpaper_path = str((_cwd / ".." / ".." / "wallpaper.png").absolute())

screens = [
Screen(
top=Bar(i),
bottom=gap,
left=gap,
right=gap,
wallpaper=wallpaper_path,
wallpaper_mode="fill",
)
for i in range(2)
]
screens = [Screen(top=Bar(i), **_screen_attr) for i in range(2)]

0 comments on commit 252847b

Please sign in to comment.