-
Notifications
You must be signed in to change notification settings - Fork 0
/
simpleBar.py
187 lines (174 loc) · 5.36 KB
/
simpleBar.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
from libqtile.lazy import lazy
from libqtile.bar import Bar
from libqtile.widget import (
GroupBox,
Systray,
Clock,
TextBox,
Spacer,
Mpd2,
Wttr,
ImapWidget,
Pomodoro,
GenPollText,
Image,
Sep,
DoNotDisturb,
)
# from colorschemes.gruvbox_dark import colors
from colorschemes.colors import colors
# from colorschemes.nostalgia_dark import colors
import subprocess
from modules.distrologo import get_distro_logo
# from modules.battery import has_battery
# def notify_current_song():
# mpc_output = subprocess.check_output(["mpc", "current"]).decode().strip()
# artist, song_title = mpc_output.split(" - ")
# message = f"{artist}\n{song_title}"
# subprocess.Popen(["notify-send", "Now playing:", message])
def notify_date():
date = subprocess.check_output(["date", "+%D"]).decode().strip()
subprocess.Popen(["notify-send", f"Today is: {date}"])
# def exchange(currency):
# value = (
# subprocess.check_output(["rates", "1", currency, "to", "pln", "--short"])
# .decode()
# .strip()
# )
# return value
separator = "|"
font = "JetBrains Mono Nerd Font"
widget_defaults = dict(
font=font,
fontsize=16,
background=colors["bg"],
foreground=colors["fg"],
)
bar = Bar(
[
# Image(
# filename="~/Pictures/nix (copy 1).png",
# width=30,
# margin=3,
# ),
TextBox(
get_distro_logo(),
width=34,
foreground=colors["fg"],
font="Iosevka Nerd Font",
fontsize=18,
mouse_callbacks={
"Button1": lazy.spawn("rofi -show drun"),
"Button3": lazy.spawn("kitty"),
},
),
# TextBox(separator, font=font, fontsize=16, foreground=colors["fg"]),
Sep(foreground=colors["fg"], padding=10, linewidth=2, size_percent=70),
GroupBox(
fontsize=16,
disable_drag=True,
hide_unused=False,
active=colors["fg2"],
inactive=colors["gray"],
highlight_method="line",
block_highlight_text_color=colors["fg"],
borderwidth=0,
highlight_color=colors["bg"],
background=colors["bg"],
font=font,
padding=10,
),
# ExchangePriceWidget(),
Spacer(),
Mpd2(
width=500,
font=font,
foreground=colors["fg"],
status_format="{artist} - {title} [{album}]",
scroll=True,
idle_format="{play_status} {idle_message}",
idle_message="Queue Empty",
mouse_callbacks={
"Button2": lazy.group["scratchpad"].dropdown_toggle("music"),
},
),
Spacer(),
# TextBox(separator, font=font, fontsize=16),
# TextBox(
# "XMR %szł" % exchange("xmr"),
# font=font,
# ),
# TextBox(
# "BTC %szł" % exchange("btc"),
# font=font,
# ),
# TextBox(separator, font=font, fontsize=16, foreground=colors["fg"]),
# GenPollText(
# foreground=colors["fg"],
# name="BTC",
# fmt="{} BTC",
# update_interval=60,
# func=lambda: subprocess.check_output(
# ["rates", "1", "btc", "to", "pln", "--short"]
# )
# .strip()
# .decode(),
# ),
# TextBox(separator, font=font, fontsize=16, foreground=colors["fg"]),
# GenPollText(
# foreground=colors["fg"],
# name="XMR",
# fmt="{} XMR",
# update_interval=60,
# func=lambda: subprocess.check_output(
# ["rates", "1", "xmr", "to", "pln", "--short"]
# )
# .strip()
# .decode(),
# ),
Sep(foreground=colors["fg"], padding=10, linewidth=2, size_percent=70),
Wttr(
location={"Wrocław": "Home"},
format="%C %f",
update_interval=30,
foreground=colors["fg"],
font=font,
),
Sep(foreground=colors["fg"], padding=10, linewidth=2, size_percent=70),
Clock(
foreground=colors["fg"],
format="%H:%M:%S",
font=font,
mouse_callbacks={
"Button1": lazy.group["scratchpad"].dropdown_toggle("cal"),
"Button3": lambda: notify_date(),
},
),
Sep(foreground=colors["fg"], padding=10, linewidth=2, size_percent=70),
Systray(
# System tray for apps like discord, obs and such
background=colors["bg"],
padding=10,
icon_size=16,
),
TextBox(
" ",
font=font,
fontsize=16,
width=10,
foreground=colors["fg"],
),
Sep(foreground=colors["fg"], padding=10, linewidth=2, size_percent=70),
DoNotDisturb(
enabled_icon=" ",
disabled_icon=" ",
fontsize=16,
),
],
# margin=[5, 5, 5, 5],
background=colors["bg"],
foreground=colors["fg"],
font=font,
opacity=1,
size=25,
)