Bug 447203 - startplasma-wayland overwrites $XKB_DEFAULT_*
Summary: startplasma-wayland overwrites $XKB_DEFAULT_*
Status: CONFIRMED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Startup process (show other bugs)
Version: 5.23.4
Platform: Debian unstable Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: wayland-only
Depends on:
Blocks:
 
Reported: 2021-12-18 20:00 UTC by Marc Mezzarobba
Modified: 2022-02-15 15:21 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Mezzarobba 2021-12-18 20:00:04 UTC
SUMMARY

startplasma-wayland sets the environment variables XKB_DEFAULT_MODEL, XKB_DEFAULT_LAYOUT, XKB_DEFAULT_VARIANT, and XKB_DEFAULT_OPTIONS with values supplied by systemd-localed, possibly overwriting values set by a particular user with system-wide default.

STEPS TO REPRODUCE
1. export XKB_DEFAULT_LAYOUT=favorite_layout in .profile
2. launch plasma wayland session

OBSERVED RESULT

After session launch:

$echo $XKB_DEFAULT_LAYOUT
<system-wide default>

EXPECTED RESULT

$echo $XKB_DEFAULT_LAYOUT
favorite_layout

ADDITIONAL INFORMATION

It is possible to set these variables in ~/.config/plasma-workspace/env instead as a workaroud, but it took me a lot of time to realize that!
Comment 1 Nate Graham 2022-02-11 19:27:57 UTC
Would you like to submit a merge request to fix it?
Comment 2 Marc Mezzarobba 2022-02-15 08:25:20 UTC
(In reply to Nate Graham from comment #1)
> Would you like to submit a merge request to fix it?

I suppose I could try, but (a) I am not sure what the right thing to do would be (just skip importing the values from systemd-localed when any of the XKB_* envvars is set?), and (b) I have zero experience with KDE development. Where should I start?
Comment 3 Nate Graham 2022-02-15 15:21:24 UTC
This is pretty much what you'd need to change: https://invent.kde.org/plasma/plasma-workspace/-/blob/master/startkde/startplasma-wayland.cpp#L47

Inside queryAndSet, you'd check to see if the value of `var` is already set using `qgetenv()`; if it is, skip the `qputenv()` function call.