92 lines
3.0 KiB
Lua
92 lines
3.0 KiB
Lua
local awful = require('awful')
|
|
local gears = require("gears")
|
|
local beautiful = require('beautiful')
|
|
local polymenu = require("widgets.polymenu")
|
|
local wibox = require("wibox")
|
|
local awmtk = require("awmtk")
|
|
local style = awmtk.style(awmtk.defaults,{},"powercontrol_")
|
|
local awesome_menu = {
|
|
{ "hotkeys", function() require("core.widgets.hotkeys_popup").show_help(nil, awful.screen.focused()) end },
|
|
{ "manual", global.terminal .. " -e man awesome" },
|
|
{ "edit config", global.editor_cmd .. " " .. awesome.conffile },
|
|
{ "restart", awesome.restart },
|
|
{ "quit", function() awesome.quit() end },
|
|
}
|
|
local before_table = {
|
|
{
|
|
widget = wibox.widget.textbox,
|
|
markup = "AwesomeWM"
|
|
}
|
|
}
|
|
local after_table = {}
|
|
awful.screen.connect_for_each_screen(function(s)
|
|
table.insert(before_table,{
|
|
{
|
|
widget = wibox.widget.textbox,
|
|
markup = "Screen "..tostring(s.index)
|
|
},
|
|
require("core.widgets.taglist")(s),
|
|
layout = wibox.layout.fixed.vertical
|
|
})
|
|
end)
|
|
table.insert(after_table,{
|
|
style.icon({
|
|
widget = wibox.widget.imagebox,
|
|
image = gears.color.recolor_image(style.powercontrol_icon_shutdown,style.powercontrol_button_fg_normal),
|
|
resize = true
|
|
},{
|
|
bg = style.powercontrol_button_bg_focus,
|
|
forced_width = style.powercontrol_button_width,
|
|
forced_height = style.powercontrol_button_height
|
|
},{
|
|
function()
|
|
awful.spawn("loginctl poweroff")
|
|
end
|
|
}),
|
|
style.icon({
|
|
widget = wibox.widget.imagebox,
|
|
image = gears.color.recolor_image(style.powercontrol_icon_suspend,style.powercontrol_button_fg_normal),
|
|
resize = true,
|
|
},{
|
|
bg = style.powercontrol_button_bg_focus,
|
|
forced_width = style.powercontrol_button_width,
|
|
forced_height = style.powercontrol_button_height
|
|
},{
|
|
function()
|
|
awful.spawn("loginctl suspend")
|
|
end
|
|
}),
|
|
style.icon({
|
|
widget = wibox.widget.imagebox,
|
|
image = gears.color.recolor_image(style.powercontrol_icon_lock,style.powercontrol_button_fg_normal),
|
|
resize = true,
|
|
},{
|
|
bg = style.powercontrol_button_bg_focus,
|
|
forced_width = style.powercontrol_button_width,
|
|
forced_height = style.powercontrol_button_height
|
|
},{
|
|
function()
|
|
awesome.emit_signal("lock_screen")
|
|
end
|
|
}),
|
|
spacing = style.powercontrol_container_spacing_horizontal,
|
|
layout = wibox.layout.fixed.horizontal
|
|
})
|
|
local items = require("widgets.xdg-menu") {
|
|
before = {{ "awesome", awesome_menu, beautiful.awesome_icon }},
|
|
after = {{ "open terminal", global.terminal }},
|
|
}
|
|
local menu_template = {
|
|
before = before_table,
|
|
items = items,
|
|
after = after_table,
|
|
vertical = true,
|
|
inverse = true
|
|
}
|
|
menu = polymenu(menu_template)
|
|
root.keys(gears.table.join(
|
|
root.keys(),
|
|
awful.key({ global.modkey, }, "w", function () menu:show() end,
|
|
{description = "show main menu", group = "awesome"})))
|
|
return menu
|