-
Notifications
You must be signed in to change notification settings - Fork 12
/
smartmenu.lua
39 lines (34 loc) · 1.2 KB
/
smartmenu.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
local menu = require('awful.menu')
local util = require('awful.util')
local utility = require('utility')
local smartmenu = {}
local scripts_dir = util.getdir("config") .. "/scripts/"
local fm_script = scripts_dir .. "flashmanager"
local function flashmanager()
if not util.file_readable(fm_script) then
return
end
local f = io.popen("sudo " .. fm_script)
if (f ~= nil) then
local actions = { theme = { width = vista.scale(300) } }
local i = 1
for l in f:lines() do
table.insert(actions, { string.format("[&%i] %s", i, l),
fm_script .. " " .. i})
i = i + 1
end
return actions
end
end
function smartmenu.show()
local mainmenu = { items = {
{ '&awesome', { { "restart", awesome.restart },
{ "quit", awesome.quit } } },
{ '&flashmanager', flashmanager() },
{ '&music', function() utility.spawn_in_terminal("ncmpc") end },
{ '&display', vista.xrandr.menu() } },
theme = { width = vista.scale(150) } }
local m = menu(mainmenu)
m:show()
end
return smartmenu