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