aboutsummaryrefslogtreecommitdiff
path: root/.config/qtile/groups.py
blob: 3f13d52eca4f18b0c9e2a01ad93be4e4720064fe (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
# Justine Smithies
# https://github.com/justinesmithies/qtile-wayland-dotfiles

# Groups configuration

from libqtile.config import Key, Group
from libqtile.command import lazy
from keys import mod, keys
from workspaces import workspaces
from screens import connected_monitors
from libqtile.config import ScratchPad, DropDown
from os import environ

# Get terminal from environment variables
terminal = environ.get("TERMINAL")

groups = []
for workspace in workspaces:
    matches = workspace["matches"] if "matches" in workspace else None
    layouts = workspace["layout"] if "layout" in workspace else None
    groups.append(Group(workspace["name"], matches=matches, layout=layouts))
    keys.append(Key([mod], workspace["key"], lazy.group[workspace["name"]].toscreen()))
    keys.append(Key([mod, "shift"], workspace["key"], lazy.window.togroup(workspace["name"])))

for i in range(connected_monitors):
    keys.extend([Key([mod, "mod1"], str(i), lazy.window.toscreen(i))])

# Append a scratchpad group

conf = {
    "warp_pointer": False,
    "on_focus_lost_hide": False,
    "opacity": 0.80,
}

groups.append(
    ScratchPad(
        "scratchpad", [
            # Define a drop down terminal
            # it is placed in the upper third of the screen by default
            DropDown(
                "term",
                terminal + " -a 'Terminal'",
                height=0.50,
                width=0.50,
                x=0.25,
                y=0.2,
                **conf
            ),

        ]
    )
)

# Define keys to toggle the dropdown terminals
keys.extend([
    Key([mod, "shift"], "Return", lazy.group["scratchpad"].dropdown_toggle("term")),
])