-
Notifications
You must be signed in to change notification settings - Fork 10
/
widgets.py
216 lines (206 loc) · 7.19 KB
/
widgets.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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
import os
from libqtile import bar, widget
from libqtile.lazy import lazy
from libqtile.config import Screen
from functions import PWA
# widget_defaults = dict(
# font="Ubuntu Mono",
# fontsize = 12,
# padding = 2,
# background=colors[2]
# )
# extension_defaults = widget_defaults.copy()
class MyWidgets:
def __init__(self):
self.colors = [["#292d3e", "#292d3e"], # panel background
# background for current screen tab
["#434758", "#434758"],
["#ffffff", "#ffffff"], # font color for group names
# border line color for current tab
["#bc13fe", "#bc13fe"], # Group down color
# border line color for other tab and odd widgets
["#8d62a9", "#8d62a9"],
["#668bd7", "#668bd7"], # color for the even widgets
["#e1acff", "#e1acff"], # window name
["#000000", "#000000"],
["#AD343E", "#AD343E"],
["#f76e5c", "#f76e5c"],
["#F39C12", "#F39C12"],
["#F7DC6F", "#F7DC6F"],
["#f1ffff", "#f1ffff"],
["#4c566a", "#4c566a"], ]
self.termite = "termite"
def init_widgets_list(self):
'''
Function that returns the desired widgets in form of list
'''
widgets_list = [
widget.Sep(
linewidth=0,
padding=6,
foreground=self.colors[2],
background=self.colors[0]
),
widget.Image(
filename="~/.config/qtile/icons/terminal-iconx14.png",
mouse_callbacks={
'Button1': lambda qtile: qtile.cmd_spawn('dmenu_run -p "Run: "')}
),
widget.Sep(
linewidth=0,
padding=5,
foreground=self.colors[2],
background=self.colors[0]
),
widget.GroupBox(
font="Ubuntu Bold",
fontsize=12,
margin_y=2,
margin_x=0,
padding_y=5,
padding_x=3,
borderwidth=3,
active=self.colors[-2],
inactive=self.colors[-1],
# rounded=True,
rounded=False,
# highlight_color=self.colors[9],
# highlight_method="line",
highlight_method='block',
urgent_alert_method='block',
# urgent_border=self.colors[9],
this_current_screen_border=self.colors[9],
this_screen_border=self.colors[4],
other_current_screen_border=self.colors[0],
other_screen_border=self.colors[0],
foreground=self.colors[2],
background=self.colors[0],
disable_drag=True
),
widget.Prompt(
prompt=lazy.spawncmd(),
font="Ubuntu Mono",
padding=10,
foreground=self.colors[3],
background=self.colors[1]
),
widget.Sep(
linewidth=0,
padding=40,
foreground=self.colors[2],
background=self.colors[0]
),
widget.WindowName(
foreground=self.colors[6],
background=self.colors[0],
padding=0
),
widget.Systray(
background=self.colors[0],
padding=5
),
widget.TextBox(
text='',
background=self.colors[0],
foreground=self.colors[11],
padding=0,
fontsize=37
),
widget.TextBox(
text=" 🖬",
foreground=self.colors[7],
background=self.colors[11],
padding=0,
fontsize=14
),
widget.Memory(
foreground=self.colors[7],
background=self.colors[11],
mouse_callbacks={'Button1': lambda qtile: qtile.cmd_spawn(
self.termite + ' -e htop')},
padding=5
),
widget.TextBox(
text='',
background=self.colors[11],
foreground=self.colors[10],
padding=0,
fontsize=37
),
widget.TextBox(
text=" ",
foreground=self.colors[7],
background=self.colors[10],
padding=0,
mouse_callbacks={
"Button1": lambda qtile: qtile.cmd_spawn("pavucontrol")}
),
widget.Volume(
foreground=self.colors[7],
background=self.colors[10],
padding=5
),
widget.TextBox(
text='',
background=self.colors[10],
foreground=self.colors[9],
padding=0,
fontsize=37
),
widget.CurrentLayoutIcon(
custom_icon_paths=[os.path.expanduser(
"~/.config/qtile/icons")],
foreground=self.colors[0],
background=self.colors[9],
padding=0,
scale=0.7
),
widget.CurrentLayout(
foreground=self.colors[7],
background=self.colors[9],
padding=5
),
widget.TextBox(
text='',
foreground=self.colors[8],
background=self.colors[9],
padding=0,
fontsize=37
),
widget.Clock(
foreground=self.colors[7],
background=self.colors[8],
mouse_callbacks={
"Button1": lambda qtile: qtile.cmd_spawn(PWA.calendar())},
format="%B %d [ %H:%M ]"
),
widget.Sep(
linewidth=0,
padding=10,
foreground=self.colors[0],
background=self.colors[8]
),
]
return widgets_list
def init_widgets_screen(self):
'''
Function that returns the widgets in a list.
It can be modified so it is useful if you have a multimonitor system
'''
widgets_screen = self.init_widgets_list()
return widgets_screen
def init_widgets_screen2(self):
'''
Function that returns the widgets in a list.
It can be modified so it is useful if you have a multimonitor system
'''
widgets_screen2 = self.init_widgets_screen()
return widgets_screen2
def init_screen(self):
'''
Init the widgets in the screen
'''
return [Screen(top=bar.Bar(widgets=self.init_widgets_screen(), opacity=1.0, size=20)),
Screen(top=bar.Bar(
widgets=self.init_widgets_screen2(), opacity=1.0, size=20))
]