Adds 'Close' menu option to tasks list.

This commit is contained in:
Ian Adam Naval 2014-04-21 14:25:56 -04:00
parent b960d648ac
commit 9a324c3682

View File

@ -22,26 +22,26 @@ local freedesktopmenu = require('freedesktop.menu')
-- Check if awesome encountered an error during startup and fell back to
-- another config (This code will only ever execute for the fallback config)
if awesome.startup_errors then
naughty.notify({
naughty.notify({
preset = naughty.config.presets.critical,
title = "Oops, there were errors during startup!",
text = awesome.startup_errors
text = awesome.startup_errors
})
end
-- Handle runtime errors after startup
do
local in_error = false
awesome.connect_signal("debug::error",
awesome.connect_signal("debug::error",
function (err)
-- Make sure we don't go into an endless error loop
if in_error then return end
in_error = true
naughty.notify({
naughty.notify({
preset = naughty.config.presets.critical,
title = "Oops, an error happened!",
text = err
text = err
})
in_error = false
end)
@ -113,16 +113,16 @@ myawesomemenu = {
{ "quit", awesome.quit }
}
-- Add freedesktop menu
-- Add freedesktop menu
menu_items = freedesktop.menu.new()
table.insert(menu_items, { "awesome", myawesomemenu, beautiful.awesome_icon })
table.insert(menu_items, { "open terminal", terminal })
mymainmenu = awful.menu({ items = menu_items })
mylauncher = awful.widget.launcher({
mylauncher = awful.widget.launcher({
image = beautiful.awesome_icon,
menu = mymainmenu
menu = mymainmenu
})
-- }}}
@ -162,19 +162,20 @@ mytasklist.buttons = awful.util.table.join(
c:raise()
end
end),
awful.button({ }, 3, function ()
awful.button({ }, 3, function (c)
if instance then
instance:hide()
instance = nil
else
instance = awful.menu.clients({ width=250 })
killmenu = { "Close", function () c:kill() end }
instance = awful.menu.clients({ items = { killmenu } })
end
end),
awful.button({ }, 4, function ()
awful.client.focus.byidx(1)
if client.focus then client.focus:raise() end
end),
awful.button({ }, 5, function ()
awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end
@ -202,47 +203,47 @@ for s = 1, screen.count() do
-- Only create sysmon stuff for one screen
if s == 1 then
batterywidget = wibox.widget.textbox()
batterywidget:set_text("No battery | ")
batterywidgettimer = timer({ timeout = 5 })
batterywidgettimer:connect_signal("timeout",
function()
batterywidget = wibox.widget.textbox()
batterywidget:set_text("No battery | ")
batterywidgettimer = timer({ timeout = 5 })
batterywidgettimer:connect_signal("timeout",
function()
fh = assert(io.popen("cat /sys/class/power_supply/BAT1/capacity", "r"))
battery = fh:read("*l")
if battery then
batterywidget:set_text(battery .. "% | ")
batterywidget:set_text(battery .. "% | ")
end
fh:close()
end)
fh:close()
end)
batterywidgettimer:start()
memorywidget = wibox.widget.textbox()
memorywidget:set_text("Memory | ")
memorywidgettimer = timer({ timeout = 5 })
memorywidgettimer:connect_signal("timeout",
function()
fh = assert(io.popen("free -m | grep '-' | awk '{print $4}'", "r"))
memorywidget = wibox.widget.textbox()
memorywidget:set_text("Memory | ")
memorywidgettimer = timer({ timeout = 5 })
memorywidgettimer:connect_signal("timeout",
function()
fh = assert(io.popen("free -m | grep '-' | awk '{print $4}'", "r"))
memory = fh:read("*l")
if memory then
memorywidget:set_text(memory .. " MB | ")
memorywidget:set_text(memory .. " MB | ")
end
fh:close()
end)
fh:close()
end)
memorywidgettimer:start()
loadwidget = wibox.widget.textbox()
loadwidget:set_text("Load | ")
loadwidgettimer = timer({ timeout = 5 })
loadwidgettimer:connect_signal("timeout",
function()
fh = assert(io.popen("uptime | sed -e 's/.*average: //' | sed -e 's/,.*//'", "r"))
loadwidget = wibox.widget.textbox()
loadwidget:set_text("Load | ")
loadwidgettimer = timer({ timeout = 5 })
loadwidgettimer:connect_signal("timeout",
function()
fh = assert(io.popen("uptime | sed -e 's/.*average: //' | sed -e 's/,.*//'", "r"))
loadavg = fh:read("*l")
if loadavg then
loadwidget:set_text(loadavg .. " | ")
loadwidget:set_text(loadavg .. " | ")
end
fh:close()
end
)
fh:close()
end
)
loadwidgettimer:start()
end
@ -264,7 +265,7 @@ for s = 1, screen.count() do
right_layout:add(batterywidget)
right_layout:add(mytextclock)
end
right_layout:add(mylayoutbox[s])
right_layout:add(mylayoutbox[s])
-- Now bring it all together (with the tasklist in the middle)
local layout = wibox.layout.align.horizontal()