Move the tag menu to a new file (issue #21)
This commit is contained in:
parent
f746a8b347
commit
801d2ca2b4
|
@ -0,0 +1,27 @@
|
|||
local radical = require("radical")
|
||||
local capi = { screen = screen, }
|
||||
local awful = require( "awful" )
|
||||
local module = {}
|
||||
|
||||
local function createTagList(aScreen)
|
||||
local tagList = radical.context({autodiscard = true})
|
||||
for _, v in ipairs(awful.tag.gettags(aScreen)) do
|
||||
tagList:add_item({text = v.name,icon=awful.tag.geticon(v)})
|
||||
end
|
||||
return tagList
|
||||
end
|
||||
|
||||
function module.listTags()
|
||||
if capi.screen.count() == 1 then
|
||||
return createTagList(1)
|
||||
else
|
||||
local screenSelect = radical.context(({autodiscard = true}))
|
||||
for i=1, capi.screen.count() do
|
||||
screenSelect:add_item({text="Screen "..i , sub_menu = createTagList(i)})
|
||||
end
|
||||
return screenSelect
|
||||
end
|
||||
end
|
||||
|
||||
return setmetatable(module, { __call = function(_, ...) return module.listTags(...) end })
|
||||
-- kate: space-indent on; indent-width 2; replace-tabs on;
|
|
@ -7,28 +7,10 @@ local beautiful = require( "beautiful" )
|
|||
local awful = require( "awful" )
|
||||
local util = require( "awful.util" )
|
||||
local wibox = require( "wibox" )
|
||||
local listTags = require( "radical.impl.common.tag" ).listTags
|
||||
|
||||
local module,mainMenu = {},nil
|
||||
|
||||
local function listTags()
|
||||
function createTagList(aScreen)
|
||||
local tagList = radical.context({autodiscard = true})
|
||||
for _, v in ipairs(awful.tag.gettags(aScreen)) do
|
||||
tagList:add_item({text = v.name,icon=awful.tag.geticon(v)})
|
||||
end
|
||||
return tagList
|
||||
end
|
||||
if capi.screen.count() == 1 then
|
||||
return createTagList(1)
|
||||
else
|
||||
local screenSelect = radical.context(({autodiscard = true}))
|
||||
for i=1, capi.screen.count() do
|
||||
screenSelect:add_item({text="Screen "..i , sub_menu = createTagList(i)})
|
||||
end
|
||||
return screenSelect
|
||||
end
|
||||
end
|
||||
|
||||
local function createNewTag()
|
||||
return awful.tag.add(module.client.class,{})
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue