-
Notifications
You must be signed in to change notification settings - Fork 3
/
scratchpad.py
75 lines (62 loc) · 1.74 KB
/
scratchpad.py
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
"""
Scratchpad and DropDowns
========================
The scratchpads are the same with either backend, but the terminal used differs. I
prefer these terminals over something like alacritty, which would be an easier
alternative to configure because it works under both Wayland and X.
"""
import os
from libqtile import qtile
from libqtile.config import DropDown, ScratchPad
from libqtile.lazy import lazy
HOME: str = os.path.expanduser("~")
IS_WAYLAND: bool = qtile.core.name == "wayland"
IS_XEPHYR: bool = int(os.environ.get("QTILE_XEPHYR", 0)) > 0
mod = "mod1" if IS_XEPHYR else "mod4"
if IS_WAYLAND:
term = "foot "
else:
term = "xterm -e "
conf = {
"warp_pointer": False,
"on_focus_lost_hide": False,
"opacity": 1,
}
GHCI = "ghci"
# GHCI = "ghci-9.2.2"
dropdowns = [
DropDown("tmux", term + "tmux", height=0.4, **conf),
DropDown(
"ncmpcpp", term + "ncmpcpp", x=0.12, y=0.2, width=0.56, height=0.7, **conf
),
DropDown("python", term + "python", x=0.05, y=0.1, width=0.2, height=0.3, **conf),
DropDown(GHCI, term + GHCI, y=0.6, height=0.4, **conf),
]
# Keybindings to open each DropDown
keys_scratchpad = [
(
[mod, "shift"],
"Return",
lazy.group["scratchpad"].dropdown_toggle("tmux"),
"Toggle tmux scratchpad",
),
(
[mod, "control"],
"m",
lazy.group["scratchpad"].dropdown_toggle("ncmpcpp"),
"Toggle ncmpcpp scratchpad",
),
(
[mod],
"c",
lazy.group["scratchpad"].dropdown_toggle("python"),
"Toggle python scratchpad",
),
(
[mod],
"g",
lazy.group["scratchpad"].dropdown_toggle(GHCI),
"Toggle GHCI scratchpad",
),
]
scratchpad = ScratchPad("scratchpad", dropdowns)