I’ve encountered an issue with launching Anki on my Manjaro KDE Plasma running under Wayland, where the application requires explicit UTF-8 locale settings to launch correctly. Despite my system locale being set to en_US.UTF-8, Anki wouldn’t start from the KDE application launcher without specifying LANG and LC_ALL environment variables directly in the .desktop file’s Exec command. From the terminal it starts just as expected.
Here’s what I’ve done to address the issue:
Checked and confirmed that my system’s locale is set to en_US.UTF-8 using locale command.
Adjusted the Anki launcher (~/.local/share/applications/anki.desktop) to include LANG and LC_ALL in the Exec line:
This change allowed Anki to launch successfully from the KDE application menu.
I suspect this issue might be related to how I changed the system language or a particularity with KDE Plasma’s handling of environment variables under Wayland. Before this, I had switched my system language from German to English, which might not have been applied consistently across all locale settings.
I’m seeking advice on whether this is a known issue with a more systematic solution and if my current workaround could lead to other complications. Additionally, I’m wondering if there are specific commands or logs I should check to diagnose this issue further or provide more details.
For reference, here are my current locale settings:
Thank you for your response. Perhaps I wasn’t entirely clear in my initial post. The issue with launching Anki has been resolved by adjusting the .desktop file to explicitly set the locale environment variables, as shown below for reference:
[Desktop Entry]
Categories=Education;Languages;KDE;Qt;
Comment[en_US]=An intelligent spaced-repetition memory training program
Comment=An intelligent spaced-repetition memory training program
Exec=env LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 /usr/bin/anki
GenericName[en_US]=Flashcards
GenericName=Flashcards
Icon=anki
MimeType=
Name[en_US]=Anki
Name=Anki
Path=
SingleMainWindow=true
StartupNotify=true
Terminal=false
TerminalOptions=
TryExec=anki
Type=Application
Version=1.0
X-GNOME-SingleWindow=true
X-KDE-SubstituteUID=false
X-KDE-Username=
The workaround is effective, but it raises a question for me. Given that I’ve set LANG and LC_ALL to en_US.UTF-8 at the system level, why is it necessary to specify these environment variables again in the .desktop file? Shouldn’t the application inherit these settings from the system and function correctly without additional modification?
I’m concerned about the underlying cause of this discrepancy. If the locale was not properly set when I changed the system language, I’d like to understand how to correct this to ensure I don’t encounter similar issues with other applications in the future. The goal is to avoid having to manually prepend env LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 for applications to recognize the system-wide locale settings.