diff --git a/lib/awful/widget/keyboardlayout.lua b/lib/awful/widget/keyboardlayout.lua index ced2543e..0a885a36 100644 --- a/lib/awful/widget/keyboardlayout.lua +++ b/lib/awful/widget/keyboardlayout.lua @@ -115,12 +115,15 @@ keyboardlayout.xkeyboard_country_code = { -- Callback for updating current layout. local function update_status (self) - self._current = awesome.xkb_get_layout_group(); + self._current = awesome.xkb_get_layout_group() local text = "" - if (#self._layout > 0) then + if #self._layout > 0 then -- 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] .. " ") + local name = self._layout[self._current+1] + if name then + text = " " .. name .. " " + end end self.widget:set_text(text) end