Repository: qtile/qtile

Issue:
widget.KeyboardLayout - cannot call next_keyboard()
With following conig in top.Bar

                widget.KeyboardLayout(
                    configured_keyboards=['us', 'us intl', 'us colemak_dh_iso'],
                    display_map={'us colemak_dh_iso': 'COLEMAK'},
                    fmt=' {}',
                    ),

it is possible to switch the keyboard layouts via clicking the widget in the Bar, but as soon as I add:

Key([mod], “space”, lazy.widget[“keyboardlayout”].next_keyboard(), desc=”Next keyboard layout.”),

into keys

the config is not loadable via lazy.restart()


Discussion:
Do you get any log output when trying to restart?
@m-col .. nope.. but to be fair I do not see where I could see the stdout/stderr whilst reloading the config file
You need to look in your log. Have a look in `~/.local/share/qtile/qtile.log`.
2021-11-11 12:49:20,350 ERROR libqtile manager.py:cmd_restart():L1043 Preventing restart because of a configuration error: invalid character '“' (U+201C) (config.py, line 92)
ok I found the problem.. thanks guys..

The problem was, that whilst copying from the docu there was another quote char:

“ instead of " ..perhaps that should be edited
Great.

Where did you copy it from? If you post the link, we can fix it.
@elParaguayo sure it was in the latest:

https://docs.qtile.org/en/latest/manual/ref/widgets.html#keyboardlayout

but also in the source code.. I tried from both 
The docs are generated from the source code so it's the same bug.

Thanks for reporting. Will get this fixed.
after giving it a second look the examples for the keyboardlayouts itself have the same issue with the single quotes.. I did not encounter that since I typed them by hand instead of copying but at a closer look they also look different. Perhpas this could also be a problem for other people who try to copy from there.
if I can support further here please let me know

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -207,6 +207,10 @@ def __dir__(self):
 # typographically correct entities.
 #html_use_smartypants = True
 
+# smartypants was deprecated in favour of smartquotes
+# We want to disable this so users can copy an paste text into their configs
+smartquotes = False
+
 # Custom sidebar templates, maps document names to template names.
 #html_sidebars = {}
 
diff --git a/libqtile/widget/base.py b/libqtile/widget/base.py
--- a/libqtile/widget/base.py
+++ b/libqtile/widget/base.py
@@ -562,7 +562,7 @@ class ThreadPoolText(_TextBox):
     """
     defaults = [
         ("update_interval", 600, "Update interval in seconds, if none, the "
-            "widget updates whenever it's done'."),
+            "widget updates whenever it's done."),
     ]  # type: List[Tuple[str, Any, str]]
 
     def __init__(self, text, **config):
diff --git a/libqtile/widget/keyboardlayout.py b/libqtile/widget/keyboardlayout.py
--- a/libqtile/widget/keyboardlayout.py
+++ b/libqtile/widget/keyboardlayout.py
@@ -142,7 +142,7 @@ class KeyboardLayout(base.InLoopPollText):
             "['us', 'us colemak', 'es', 'fr']."),
         ("display_map", {}, "Custom display of layout. Key should be in format "
             "'layout variant'. For example: "
-            "{'us': 'us ', 'lt sgs': 'sgs', 'ru phonetic': 'ru '}"),
+            "{'us': 'us', 'lt sgs': 'sgs', 'ru phonetic': 'ru'}"),
         ("option", None, "string of setxkbmap option. Ex., 'compose:menu,grp_led:scroll'"),
     ]
 


Test patch: