Hi,
to get a better overview over my rc.lua-file I want to transfer all
function code into a separate file. For that I created a file named
"functions.lua" in my .config/awesome-directory next to my rc.lua.
The plan is to put all the function code into the functions.lua and just
call the functions by name in the rc.lua to make it shorter and better
readable.
I put a "require("funtions")" after the other "require"-calls into my
rc.lua and copied the function code (at the moment just three functions
for testing) into the functions.lua-file which starts with the line
"module("functions")".
The functions got names in the new file and are, as mentioned, called by
calling them by "functions.[functionname]" with "[functionname]" the
chosen name of the function in the functions.lua.
Unfortunately my configuration breaks, so obviously I haven't done it right.
Does anyone have an idea what's my mistake? Thanks in advance!
My testobjects were the functions in tasklist.buttons (surrounding code,
marked as "awesome-config-code" is from original rc.lua). My actual try
in the rc.lua is:
[code]
-- require-calls
require("functions")
-- some awesome-config-code
mytasklist.buttons = awful.util.table.join(
awful.button({ }, 1, functions.buttonone(c) ),
awful.button({ }, 3, functions.buttonthree() ),
awful.button({ }, 4, functions.buttonfour() ),
awful.button({ }, 5, function ()
awful.client.focus.byidx(-1)
if client.focus then
client.focus:raise() end
end))
-- more awesome-config-code
[/code]
And the complete functions.lua-file is:
[code]
module("functions")
--tasklist-stuff
function buttonone(c)
if c == client.focus then
c.minimized = true
else
if not c:isvisible() then
awful.tag.viewonly(c:tags()[1])
end
-- This will also un-minimize
-- the client, if needed
client.focus = c
c:raise()
end
end
function buttonthree()
if instance then
instance:hide()
instance = nil
else
instance = awful.menu.clients({ width=250 })
end
end
function buttonfour()
awful.client.focus.byidx(1)
if client.focus then client.focus:raise() end
end
[/code]
--
To unsubscribe, send mail to [email protected].