mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-17 07:47:41 +01:00
Fix single layout not appearing in the keyboardlayout widget (#1771)
Change indexing so that a keyboard map with a single group still gets displayed in awful's keyboardlayout widget. Signed-off-by: Quentin Minster <quentin@minster.io>
This commit is contained in:
parent
01e61079c3
commit
155c37e759
1 changed files with 5 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue