Gnome-layout-switcher KeyError: 'mate'

Hey Guys, I wanted make some changes to my gnome layout and found out I can’t run the gnome-layout-switcher. It crashes every time with:

  gnome-layout-switcher
 current layout: mate
 Traceback (most recent call last):
   File "/usr/bin/gnome-layout-switcher", line 45, in <module
     win = HeaderBarWindow()
   File "/usr/bin/gnome-layout-switcher", line 32, in __init__
     self.app_box = LayoutBox(self)
   File "/usr/lib/python3.9/site-packages/layoutswitcherlib/layoutsbox.py", line 521, in __init__
     self.previews[dirty_hack].get_parent().btn.set_active(True)
 KeyError: 'mate'

Any ideas how to fix that?

You are calling the mate layout without having defined it.

If you want mate, you might want to take a look at this commit:

1 Like

No. When I installed the manjaro there used to be layout called mate and I chose that. Since then the layout was removed/renamed (based on your link to the commit). And this most likely broke the layout switcher as it has somewhere stored the now non-existing layout and crashes without giving me a chance to switch from the mate to anything else. So most likely what I’m looking for is how can I switch the layout to something existing without using the gnome-layout-switcher.

1 Like

Hi Ifs,

I ran into similar issue and resolved it by manually editing the layoutbox.py file and temporarily setting self.layout = ‘manjaro’ this did resolve the issue. That is I was able to launch the layout switcher successsfully afterwards. Hope this helps.

Inside the class LayoutBox(Gtk.Box) find below:

with UserConf() as conf:
#self.layout = conf.read(“layout”, “manjaro”) ## temporarily comment this line and undo once you have changed your mate layout
self.layout = ‘manjaro’
print(“current layout:”, self.layout)

Sorry, my bad, unhandled exception.

The solution is to edit ~/.config/gnome-layout-switcher.conf and set manjaro for layout in that file.

1 Like

That worked like a charm. Thanks!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.