I am using KDE plasma version 5.17.5 but I have the feeling that my question is equally relevant for Gnome, XFCE, etc.

I am using gvim (under Wayland) with plugins which rely on environment variables. When I call gvim from the shell (konsole), gvim inherits the environment variables I have set in .bashrc. However, when I call gvim from the menu, the environment variables are not available to gvim.

I find this strange default behavior, shouldn't applications which are executed as the same user which is logged into the graphical environment expect the same environment variables?

How can I change that gvim started via the menu will see my .bashrc - set environment variables?

2 Answers 2


The .bashrc file is sourced only when starting a new shell session, and only in so-called interactive mode.

I'm not sure what you mean by "the menu", but it probably only runs the gvim as a command, it doesn't start a new session.

If you are using the Application Launcher (activated by pressing "windows" key or clicking on icon in left-bottom corner), you can write the gvim, then right-click on the autocomplete result, in context menu select Edit Application, then click on tab Application and check content of command field. There you can see what command is actually used when you run the gvim this way.

You can try clicking on Advanced Options button in the same location and then check Run in terminal. And if it still doesn't work, just define the env variables manually there.

But BE CAREFUL - I didn't try it, so I'm not sure it does what I think.

I mean to say - I'm sure it's okay to run gvim this way, but I don't use it. Don't rely on it with wild experiments only because I mentioned it here.

Hope this helps.

  • Thanks for the suggestion, I tried that under Plasma/X and setting the environment variables straight in the menu editor worked, failed for Wayland Plasma. Filed a bug bugs.kde.org/show_bug.cgi?id=417115
    – JohnDoe
    Feb 5, 2020 at 18:33

The problem is that under Plasma Wayland the .profile or .bashrc are not read any more. Wayland Gnome run into that issue too and later manually source .profile

When using system.d the way to go is to create a file under `~.conf/environemnt.d/.conf and include KEY=value pairs. Any will do, extension has to be .conf. system.d will read those entries and guarantee they are available even under Wayland.

Read more on https://in.waw.pl/~zbyszek/blog/environmentd.html

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .