-
Notifications
You must be signed in to change notification settings - Fork 5
/
widgets.lua
140 lines (131 loc) · 4.18 KB
/
widgets.lua
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
-- Standard awesome library
local awful = require("awful")
local vicious = require("vicious")
-- Widget and layout library
local wibox = require("wibox")
---wibox2
--
-- Memory
-- Initialize widget
memwidget = wibox.widget.textbox()
-- Register widget
vicious.register(memwidget, vicious.widgets.mem, 'RAM: <span color="#CC9933">$1%</span> ($2MB/$3MB) ', 11)
-- Initialize widget
memwidget2 = wibox.widget.progressbar()
-- Progressbar properties
memwidget2:set_width(50)
memwidget2:set_vertical(true)
memwidget2:set_background_color("#494B4F")
memwidget2:set_border_color(nil)
memwidget2:set_color(
{
type = "linear",
from = {0, 0},
to = {10, 0},
stops = {
{0, "#AECF96"},
{0.5, "#88A175"},
{1, "#FF5656"}
}
}
)
-- Register widget
vicious.register(memwidget2, vicious.widgets.mem, "$1", 10)
-- Initialize widget
cpuwidget = awful.widget.graph()
-- Graph properties
cpuwidget:set_width(50)
cpuwidget:set_background_color("#494B4F")
cpuwidget:set_color(
{
type = "linear",
from = {0, 0},
to = {10, 0},
stops = {
{0, "#FF5656"},
{0.5, "#88A175"},
{1, "#AECF96"}
}
}
)
-- Register widget
vicious.register(cpuwidget, vicious.widgets.cpu, " $1")
-- Initialize widget
cpuwidget2 = wibox.widget.textbox()
-- Register widget
vicious.register(cpuwidget2, vicious.widgets.cpu, ' CPU: <span color="#CC9933">$1%</span>', 1)
-- wifi widget
wifiwidget = wibox.widget.textbox()
vicious.register(
wifiwidget,
vicious.widgets.wifi,
'Connected to <span color="#7F9F7F">${ssid}</span> at <span color="#7F9F7F">${linp}%</span> | ',
2,
"wlp3s0"
)
--Weather Widget
weather = wibox.widget.textbox()
vicious.register(
weather,
vicious.widgets.weather,
" Weather: ${city} | Temp: ${tempf}⁰F (${tempc}⁰C) | Humid: ${humid}% | ",
1200,
"KPVD"
)
---vicious.register(weather, vicious.widgets.weather, "Weather: ${city}. Sky: ${sky}. Temp: ${tempc}c Humid: ${humid}%. Wind: ${windkmh} KM/h", 1200, "LFBO")
-- network widget
--
-- Possible network devices
eths = {"eth0", "wlp3s0"}
netwidget = wibox.widget.textbox()
vicious.register(
netwidget,
vicious.widgets.net,
function(widget, args)
t = ""
for i = 1, #eths do
e = eths[i]
if args["{" .. e .. " carrier}"] == 1 then
if e == "wlp3s0" then
t =
t ..
" " ..
'Wifi: <span color="#CC9933"> down: ' ..
args["{" .. e .. " down_kb}"] ..
' kbps</span> <span color="#7F9F7F">up: ' ..
args["{" .. e .. " up_kb}"] ..
" kbps </span>" ..
"[ " ..
args["{" .. e .. " rx_gb}"] ..
" GB // " .. args["{" .. e .. " tx_gb}"] .. " GB ] "
else
t =
t ..
"| " ..
'Eth0: <span color="#CC9933"> down: ' ..
args["{" .. e .. " down_kb}"] ..
' kbps</span> <span color="#7F9F7F">up: ' ..
args["{" .. e .. " up_kb}"] ..
" kbps </span>" ..
"[ " ..
args["{" .. e .. " rx_gb}"] ..
" GB // " .. args["{" .. e .. " tx_gb}"] .. " GB ] "
end
end
end
if string.len(t) > 0 then -- remove leading '|'
return string.sub(t, 1, -1)
end
return "No network detected "
end,
1
)
-- Initialize widget battery
batwidget = wibox.widget.textbox()
vicious.register(
batwidget,
vicious.widgets.bat,
' | Bat:<span color="#CC9933"> $2% </span> [<span color="#7F9F7F"> $3</span> ] ',
60,
"BAT0"
)