diff --git a/lib/awful/widget/keyboardlayout.lua b/lib/awful/widget/keyboardlayout.lua index 0d98cc2b..ced2543e 100644 --- a/lib/awful/widget/keyboardlayout.lua +++ b/lib/awful/widget/keyboardlayout.lua @@ -118,7 +118,9 @@ local function update_status (self) self._current = awesome.xkb_get_layout_group(); local text = "" if (#self._layout > 0) then - text = (" " .. self._layout[self._current] .. " ") + -- Please note that the group number reported by xkb_get_layout_group + -- is lower by one than the group numbers reported by xkb_get_group_names. + text = (" " .. self._layout[self._current+1] .. " ") end self.widget:set_text(text) end @@ -238,13 +240,10 @@ local function update_layout(self) return end if #layouts == 1 then - layouts[1].group_idx = 0 + layouts[1].group_idx = 1 end for _, v in ipairs(layouts) do - local layout_name = self.layout_name(v) - -- Please note that numbers of groups reported by xkb_get_group_names - -- is greater by one than the real group number. - self._layout[v.group_idx - 1] = layout_name + self._layout[v.group_idx] = self.layout_name(v) end update_status(self) end