-
Notifications
You must be signed in to change notification settings - Fork 3
/
power_menu.py
59 lines (55 loc) · 1.63 KB
/
power_menu.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
from libqtile.lazy import lazy
from qtile_extras.popup.toolkit import PopupImage, PopupRelativeLayout, PopupText
def show_power_menu(qtile):
controls = [
PopupImage(
filename="~/pictures/icons/lock.svg",
pos_x=0.15,
pos_y=0.1,
width=0.1,
height=0.5,
mouse_callbacks={"Button1": lazy.spawn("swaylock")},
),
PopupImage(
filename="~/pictures/icons/sleep.svg",
pos_x=0.45,
pos_y=0.1,
width=0.1,
height=0.5,
mouse_callbacks={"Button1": lazy.spawn("systemctl suspend", shell=True)},
),
PopupImage(
filename="~/pictures/icons/shutdown.svg",
pos_x=0.75,
pos_y=0.1,
width=0.1,
height=0.5,
highlight="A00000",
mouse_callbacks={"Button1": lazy.spawn("backup-home-and-poweroff")},
),
PopupText(
text="Lock", pos_x=0.1, pos_y=0.7, width=0.2, height=0.2, h_align="center"
),
PopupText(
text="Sleep", pos_x=0.4, pos_y=0.7, width=0.2, height=0.2, h_align="center"
),
PopupText(
text="Shutdown",
pos_x=0.7,
pos_y=0.7,
width=0.2,
height=0.2,
h_align="center",
),
]
PopupRelativeLayout(
qtile,
width=1000,
height=200,
controls=controls,
background="000000c0",
initial_focus=2,
).show(centered=True)
keys_power_menu = [
([], "XF86PowerOff", lazy.function(show_power_menu), "Display the power menu.")
]