local awful = require("awful") local beautiful = require("beautiful") local freedesktop_utils = require("freedesktop.utils") local freedesktop_menu = require("freedesktop.menu") local debmenu = require("debian.menu") local io = io local table = table local awesome = awesome local ipairs = ipairs local os = os local string = string local mouse = mouse module("mainmenu") local env = {} -- Reserved. function init(enviroment) env = enviroment end -- Creates main menu -- Note: Uses beautiful.icon_theme and beautiful.icon_theme_size -- env - table with string constants - command line to different apps function build() local terminal = (env.terminal or "x-terminal-emulator") .. " " local editor = (env.editor or "x-terminal-emulator -e " .. (os.getenv("EDITOR") or "vim")) .. " " local browser = (env.browser or "firefox") .. " " local fileman = env.fileman or "x-terminal-emulator -e mc" local xkill = env.xkill or "xkill" .. " " freedesktop_utils.terminal = terminal freedesktop_utils.icon_theme = beautiful.icon_theme freedesktop_utils.icon_sizes = {beautiful.icon_theme_size} local myawesomemenu = { { "Manual", terminal .. " -e man awesome " }, { "Edit config", editor .. awful.util.getdir("config") .. "/rc.lua", freedesktop_utils.lookup_icon({ icon = 'package_settings' }) }, { "Restart", awesome.restart, freedesktop_utils.lookup_icon({ icon = 'gtk-refresh' }) } } local mymainmenu_items_head = { { "Awesome", myawesomemenu, beautiful.awesome_icon }, { "Terminal", terminal, freedesktop_utils.lookup_icon({icon = 'terminal'}) }, { "File Manager", fileman, freedesktop_utils.lookup_icon({icon = 'file-manager'}) }, { "Browser", browser, freedesktop_utils.lookup_icon({icon = 'browser'}) }, { "", nil, nil} --separator } local dbuscmd = "dbus-send --session --dest=org.gnome.PowerManager --type=method_call --print-reply --reply-timeout=2000 /org/gnome/PowerManager org.gnome.PowerManager." local mysessionmenu = { { "Suspend", awful.util.getdir("config").."/shutdown-dlg Suspend" }, { "Hibernate", awful.util.getdir("config").."/shutdown-dlg Hibernate" }, { "Reboot", awful.util.getdir("config").."/shutdown-dlg Reboot"}, { "Shutdown", awful.util.getdir("config").."/shutdown-dlg Shutdown"} } local mymainmenu_items_tail = { { "", nil, nil}, --separator { "Xkill", xkill, freedesktop_utils.lookup_icon({ icon = "weather-storm"}) }, { "Lock", env.locker, freedesktop_utils.lookup_icon({ icon = "access"}) }, { "", nil, nil}, --separator { "Session", mysessionmenu}, { "", nil, nil}, --separator { "Logout", awesome.quit, freedesktop_utils.lookup_icon({ icon = 'gnome-logout' })}, } local mymainmenu_items = {} for _, item in ipairs(mymainmenu_items_head) do table.insert(mymainmenu_items, item) end -- for _, item in ipairs(freedesktop_menu.new()) do table.insert(mymainmenu_items, item) end for _, item in ipairs(debmenu.Debian_menu.Debian) do table.insert(mymainmenu_items, item) end for _, item in ipairs(mymainmenu_items_tail) do table.insert(mymainmenu_items, item) end return awful.menu({ items = mymainmenu_items, x = 0, y = 0, width = 150}) end