0

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?

JohnDoe
  • 111

2 Answers2

0

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.

Paolo42
  • 101
  • 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 https://bugs.kde.org/show_bug.cgi?id=417115 – JohnDoe Feb 05 '20 at 18:33
0

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

JohnDoe
  • 111