|
@@ -22,26 +22,26 @@ local freedesktopmenu = require('freedesktop.menu')
|
22
|
22
|
-- Check if awesome encountered an error during startup and fell back to
|
23
|
23
|
-- another config (This code will only ever execute for the fallback config)
|
24
|
24
|
if awesome.startup_errors then
|
25
|
|
- naughty.notify({
|
|
25
|
+ naughty.notify({
|
26
|
26
|
preset = naughty.config.presets.critical,
|
27
|
27
|
title = "Oops, there were errors during startup!",
|
28
|
|
- text = awesome.startup_errors
|
|
28
|
+ text = awesome.startup_errors
|
29
|
29
|
})
|
30
|
30
|
end
|
31
|
31
|
|
32
|
32
|
-- Handle runtime errors after startup
|
33
|
33
|
do
|
34
|
34
|
local in_error = false
|
35
|
|
-awesome.connect_signal("debug::error",
|
|
35
|
+awesome.connect_signal("debug::error",
|
36
|
36
|
function (err)
|
37
|
37
|
-- Make sure we don't go into an endless error loop
|
38
|
38
|
if in_error then return end
|
39
|
39
|
in_error = true
|
40
|
40
|
|
41
|
|
- naughty.notify({
|
|
41
|
+ naughty.notify({
|
42
|
42
|
preset = naughty.config.presets.critical,
|
43
|
43
|
title = "Oops, an error happened!",
|
44
|
|
- text = err
|
|
44
|
+ text = err
|
45
|
45
|
})
|
46
|
46
|
in_error = false
|
47
|
47
|
end)
|
|
@@ -113,16 +113,16 @@ myawesomemenu = {
|
113
|
113
|
{ "quit", awesome.quit }
|
114
|
114
|
}
|
115
|
115
|
|
|
116
|
+-- Add freedesktop menu
|
116
|
117
|
menu_items = freedesktop.menu.new()
|
117
|
118
|
table.insert(menu_items, { "awesome", myawesomemenu, beautiful.awesome_icon })
|
118
|
119
|
table.insert(menu_items, { "open terminal", terminal })
|
119
|
120
|
|
120
|
121
|
mymainmenu = awful.menu({ items = menu_items })
|
121
|
122
|
|
122
|
|
-mylauncher = awful.widget.launcher({
|
|
123
|
+mylauncher = awful.widget.launcher({
|
123
|
124
|
image = beautiful.awesome_icon,
|
124
|
|
- menu = mymainmenu
|
|
125
|
+ menu = mymainmenu
|
125
|
126
|
})
|
126
|
127
|
|
127
|
128
|
-- }}}
|
|
@@ -162,19 +162,20 @@ mytasklist.buttons = awful.util.table.join(
|
162
|
162
|
c:raise()
|
163
|
163
|
end
|
164
|
164
|
end),
|
165
|
|
-awful.button({ }, 3, function ()
|
|
165
|
+awful.button({ }, 3, function (c)
|
166
|
166
|
if instance then
|
167
|
167
|
instance:hide()
|
168
|
168
|
instance = nil
|
169
|
169
|
else
|
170
|
|
- instance = awful.menu.clients({ width=250 })
|
|
170
|
+ killmenu = { "Close", function () c:kill() end }
|
|
171
|
+ instance = awful.menu.clients({ items = { killmenu } })
|
171
|
172
|
end
|
172
|
173
|
end),
|
173
|
174
|
awful.button({ }, 4, function ()
|
174
|
175
|
awful.client.focus.byidx(1)
|
175
|
176
|
if client.focus then client.focus:raise() end
|
176
|
177
|
end),
|
177
|
|
-
|
|
178
|
+
|
178
|
179
|
awful.button({ }, 5, function ()
|
179
|
180
|
awful.client.focus.byidx(-1)
|
180
|
181
|
if client.focus then client.focus:raise() end
|
|
@@ -202,47 +203,47 @@ for s = 1, screen.count() do
|
202
|
203
|
|
203
|
204
|
-- Only create sysmon stuff for one screen
|
204
|
205
|
if s == 1 then
|
205
|
|
- batterywidget = wibox.widget.textbox()
|
206
|
|
- batterywidget:set_text("No battery | ")
|
207
|
|
- batterywidgettimer = timer({ timeout = 5 })
|
208
|
|
- batterywidgettimer:connect_signal("timeout",
|
209
|
|
- function()
|
|
206
|
+ batterywidget = wibox.widget.textbox()
|
|
207
|
+ batterywidget:set_text("No battery | ")
|
|
208
|
+ batterywidgettimer = timer({ timeout = 5 })
|
|
209
|
+ batterywidgettimer:connect_signal("timeout",
|
|
210
|
+ function()
|
210
|
211
|
fh = assert(io.popen("cat /sys/class/power_supply/BAT1/capacity", "r"))
|
211
|
212
|
battery = fh:read("*l")
|
212
|
213
|
if battery then
|
213
|
|
- batterywidget:set_text(battery .. "% | ")
|
|
214
|
+ batterywidget:set_text(battery .. "% | ")
|
214
|
215
|
end
|
215
|
|
- fh:close()
|
216
|
|
- end)
|
|
216
|
+ fh:close()
|
|
217
|
+ end)
|
217
|
218
|
batterywidgettimer:start()
|
218
|
219
|
|
219
|
|
- memorywidget = wibox.widget.textbox()
|
220
|
|
- memorywidget:set_text("Memory | ")
|
221
|
|
- memorywidgettimer = timer({ timeout = 5 })
|
222
|
|
- memorywidgettimer:connect_signal("timeout",
|
223
|
|
- function()
|
224
|
|
- fh = assert(io.popen("free -m | grep '-' | awk '{print $4}'", "r"))
|
|
220
|
+ memorywidget = wibox.widget.textbox()
|
|
221
|
+ memorywidget:set_text("Memory | ")
|
|
222
|
+ memorywidgettimer = timer({ timeout = 5 })
|
|
223
|
+ memorywidgettimer:connect_signal("timeout",
|
|
224
|
+ function()
|
|
225
|
+ fh = assert(io.popen("free -m | grep '-' | awk '{print $4}'", "r"))
|
225
|
226
|
memory = fh:read("*l")
|
226
|
227
|
if memory then
|
227
|
|
- memorywidget:set_text(memory .. " MB | ")
|
|
228
|
+ memorywidget:set_text(memory .. " MB | ")
|
228
|
229
|
end
|
229
|
|
- fh:close()
|
230
|
|
- end)
|
|
230
|
+ fh:close()
|
|
231
|
+ end)
|
231
|
232
|
memorywidgettimer:start()
|
232
|
233
|
|
233
|
|
- loadwidget = wibox.widget.textbox()
|
234
|
|
- loadwidget:set_text("Load | ")
|
235
|
|
- loadwidgettimer = timer({ timeout = 5 })
|
236
|
|
- loadwidgettimer:connect_signal("timeout",
|
237
|
|
- function()
|
238
|
|
- fh = assert(io.popen("uptime | sed -e 's/.*average: //' | sed -e 's/,.*//'", "r"))
|
|
234
|
+ loadwidget = wibox.widget.textbox()
|
|
235
|
+ loadwidget:set_text("Load | ")
|
|
236
|
+ loadwidgettimer = timer({ timeout = 5 })
|
|
237
|
+ loadwidgettimer:connect_signal("timeout",
|
|
238
|
+ function()
|
|
239
|
+ fh = assert(io.popen("uptime | sed -e 's/.*average: //' | sed -e 's/,.*//'", "r"))
|
239
|
240
|
loadavg = fh:read("*l")
|
240
|
241
|
if loadavg then
|
241
|
|
- loadwidget:set_text(loadavg .. " | ")
|
|
242
|
+ loadwidget:set_text(loadavg .. " | ")
|
242
|
243
|
end
|
243
|
|
- fh:close()
|
244
|
|
- end
|
245
|
|
- )
|
|
244
|
+ fh:close()
|
|
245
|
+ end
|
|
246
|
+ )
|
246
|
247
|
loadwidgettimer:start()
|
247
|
248
|
end
|
248
|
249
|
|
|
@@ -264,7 +265,7 @@ for s = 1, screen.count() do
|
264
|
265
|
right_layout:add(batterywidget)
|
265
|
266
|
right_layout:add(mytextclock)
|
266
|
267
|
end
|
267
|
|
- right_layout:add(mylayoutbox[s])
|
|
268
|
+ right_layout:add(mylayoutbox[s])
|
268
|
269
|
|
269
|
270
|
-- Now bring it all together (with the tasklist in the middle)
|
270
|
271
|
local layout = wibox.layout.align.horizontal()
|