You are not logged in.
Hi, I have just installed Awesome WM, copied the rc.lua and according to Awesome wiki page put the text in rc.lua but when I restar the Awesome unfortunatelly I get error message:
/home/archie/.config/awesome/rc.lua:93: attempt to index global 'right_layout' (a nil value)
It is said to put the text before wibox definition, am I right that it is the part begginning with --{{{ Wibox --Create a textclock widget?
I am also confused about index part, on the awesome page is said:
You have to set the current index to your default layout in order to be consistent with your system configuration.
Does this means I sould change the two lines
kbdcfg.layout = { { "us", "" }, { "de", "" } }
kbdcfg.current = 1 -- us is our default layout
?
And how? In the console before logging in I have layout which is swithed to by command loadkeys cz-qwertz. Could the two lined look like
kbdcfg.layout = { { "us", "" }, { "cz", "" } }
kbdcfg.current = 2 -- cz is our default layout
What sould I do to get rid of the error?
I'm using Arch in VirtualBox does it matter in this case? Awesome in version 3.5.5.
Thanks a lot for your help.
Last edited by ascamp (2014-06-14 17:58:07)
Offline
You can put the -- Keyboard map indicator and changer and -- Mouse bindings sections just above the -- Create a wibox for each screen and add it line/paragraph.
However the
-- Add widget to your layout
right_layout:add(kbdcfg.widget)
needs to be a little further down somewhere between
local right_layout = wibox.layout.fixed.horizontal()
and
local layout = wibox.layout.align.horizontal()
Because right_layout is local to that for s = 1, screen.count() do-loop (that's the error message).
This is a snippet from my rc.lua which works fine:
-- Keyboard map indicator and changer
kbdcfg = {}
kbdcfg.cmd = "setxkbmap"
kbdcfg.layout = { { "us", "" }, { "de", "" } }
kbdcfg.current = 2 -- de is our default layout
kbdcfg.widget = wibox.widget.textbox()
kbdcfg.widget:set_text(" " .. kbdcfg.layout[kbdcfg.current][1] .. " ")
kbdcfg.switch = function ()
kbdcfg.current = kbdcfg.current % #(kbdcfg.layout) + 1
local t = kbdcfg.layout[kbdcfg.current]
kbdcfg.widget:set_text(" " .. t[1] .. " ")
os.execute( kbdcfg.cmd .. " " .. t[1] .. " " .. t[2] )
end
-- Mouse bindings
kbdcfg.widget:buttons(
awful.util.table.join(awful.button({ }, 1, function () kbdcfg.switch() end))
)
-- Create a wibox for each screen and add it
mywibox = {}
mypromptbox = {}
mylayoutbox = {}
mytaglist = {}
mytaglist.buttons = awful.util.table.join(
awful.button({ }, 1, awful.tag.viewonly),
awful.button({ modkey }, 1, awful.client.movetotag),
awful.button({ }, 3, awful.tag.viewtoggle),
awful.button({ modkey }, 3, awful.client.toggletag),
awful.button({ }, 4, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end),
awful.button({ }, 5, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end)
)
mytasklist = {}
mytasklist.buttons = awful.util.table.join(
awful.button({ }, 1,
function (c)
if c == client.focus then
c.minimized = true
else
-- Without this, the following
-- :isvisible() makes no sense
c.minimized = false
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
),
awful.button({ }, 3,
function ()
if instance then
instance:hide()
instance = nil
else
instance = awful.menu.clients({
theme = { width = 250 }
})
end
end
),
awful.button({ }, 4,
function ()
awful.client.focus.byidx(1)
if client.focus then client.focus:raise() end
end
),
awful.button({ }, 5,
function ()
awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end
end
)
)
for s = 1, screen.count() do
-- Create a promptbox for each screen
mypromptbox[s] = awful.widget.prompt()
-- Create an imagebox widget which will contains an icon indicating which layout we're using.
-- We need one layoutbox per screen.
mylayoutbox[s] = awful.widget.layoutbox(s)
mylayoutbox[s]:buttons(awful.util.table.join(
awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)
))
-- Create a taglist widget
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
-- Create a tasklist widget
mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
-- Create the wibox
mywibox[s] = awful.wibox({ position = "top", screen = s })
-- Widgets that are aligned to the left
local left_layout = wibox.layout.fixed.horizontal()
left_layout:add(mylauncher)
left_layout:add(mytaglist[s])
left_layout:add(mypromptbox[s])
-- Widgets that are aligned to the right
local right_layout = wibox.layout.fixed.horizontal()
right_layout:add(mpdicon)
right_layout:add(mpdwidget)
right_layout:add(spacer)
right_layout:add(cpuwidget)
right_layout:add(memwidget_pb)
right_layout:add(netdownicon)
right_layout:add(netdowninfo)
right_layout:add(netupicon)
right_layout:add(netupinfo)
right_layout:add(kbdcfg.widget)
if s == 1 then right_layout:add(wibox.widget.systray()) end
right_layout:add(mytextclock)
right_layout:add(mylayoutbox[s])
-- Now bring it all together (with the tasklist in the middle)
local layout = wibox.layout.align.horizontal()
layout:set_left(left_layout)
layout:set_middle(mytasklist[s])
layout:set_right(right_layout)
mywibox[s]:set_widget(layout)
end
-- }}}
And
kbdcfg.layout = { { "us", "" }, { "cz-qwertz", "" } }
kbdcfg.current = 2 -- cz is our default layout
is probably what you want.
Don't know if "cz" instead of "cz-qwertz" is sufficient.
Offline
Thanks a lot, everything works fine, cz is enough.
Offline