Xfce Forum

Sub domains
 

You are not logged in.

#1 2020-03-11 04:41:38

rharish
Member
Registered: 2017-11-19
Posts: 26

Adding environment variables to exo-open

I would like to configure exo-open to open Alacritty using the environment variable `WINIT_HIDPI_FACTOR=1`. I entered the following in Preferred Application in the Utilites tab for Terminal Emulator:

env WINIT_HIDPI_FACTOR=1 alacritty "%s"

However, it isn't working at all. Launching exo-open in the termnial simply prints all environment variables, as if it is only running "env", and ignoring everything else.

I have already configured the desktop file for Alacritty to have this behavior. Is there a way to get exo-open to use the desktop file?

Offline

#2 2020-03-11 10:26:28

alcornoqui
Member
Registered: 2014-07-28
Posts: 831

Re: Adding environment variables to exo-open

I think there are some clues in this thread. It'd be great if you followed up with your results, good luck!

Offline

#3 2020-03-11 10:37:57

rharish
Member
Registered: 2017-11-19
Posts: 26

Re: Adding environment variables to exo-open

The workaround mentioned is to export the environment variable in a shell before calling the exo-open function. Also, this is inside a ".desktop" launcher file. I'm simply looking to integrate this inside exo-open itself, so that I don't have to export it everytime. Further, in some cases, like the "Open Terminal Here" option in Thunar, I don't have the liberty of exporting the environment variable, as it directly calls exo-open.

Offline

#4 2020-03-11 15:55:48

alcornoqui
Member
Registered: 2014-07-28
Posts: 831

Re: Adding environment variables to exo-open

Doesn't this work?

bash -c 'env WINIT_HIDPI_FACTOR=1 alacritty "%s"'

I just tried something similar now (passing a different language value to Thunar as default file manager, editing the preferred applications item), and it worked.

Offline

#5 2020-03-11 16:13:43

rharish
Member
Registered: 2017-11-19
Posts: 26

Re: Adding environment variables to exo-open

Nope, doesn't work. I entered the exact same command in the "Preferred Applications" GUI, and then running exo-open via the command line didn't give me any output. Nothing occurs at all. Could you list the steps that you've followed for Thunar?

Offline

#6 2020-03-11 16:38:56

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,948

Re: Adding environment variables to exo-open

This works for me:

bash -c 'env WINIT_HIDPI_FACTOR=1.5 alacritty'

Don't enter the "%s". It seems to get added to the string automatically I believe. If you edit the content of the text field, delete the displayed "%s" before clicking okay. Probably a bug here.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#7 2020-03-11 16:58:26

rharish
Member
Registered: 2017-11-19
Posts: 26

Re: Adding environment variables to exo-open

Thanks a lot! The "%s" was the culprit. Should I file a bug?

Offline

#8 2020-03-11 17:18:23

alcornoqui
Member
Registered: 2014-07-28
Posts: 831

Re: Adding environment variables to exo-open

Great!

[Off-topic] For the record, the command I used to test was:

bash -c 'LC_ALL=C thunar'

I have LC_ALL=C aliased to 'eng', so that I can take screenshots in english for forum posting, and that's the only env tweak I know of smile

Offline

#9 2020-03-11 17:59:08

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,948

Re: Adding environment variables to exo-open

rharish wrote:

Should I file a bug?

Probably, yes. I thought there was one, or a similar one, but I can't find anything.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#10 2020-03-13 07:24:56

rharish
Member
Registered: 2017-11-19
Posts: 26

Re: Adding environment variables to exo-open

I found a side-effect of omitting the "%s". If a desktop file is set to launch via the terminal, using "Terminal=true", then it simply launches the default terminal (Alacritty) without launching htop. This can also be replicated via the CLI as follows:

exo-open --launch TerminalEmulator htop

This simply launches Alacritty w/o htop. I'll add the details to the bug that I'll file.

Offline

#11 2020-03-16 08:08:08

rharish
Member
Registered: 2017-11-19
Posts: 26

Re: Adding environment variables to exo-open

For reference, the bug is filed here: https://bugzilla.xfce.org/show_bug.cgi?id=16559

Offline

#12 2020-03-18 17:57:35

rharish
Member
Registered: 2017-11-19
Posts: 26

Re: Adding environment variables to exo-open

I found a workaround to this. I created a new script to export any environment variables and control the "%s" options passed to exo-open. The contents are as follow:

#!/usr/bin/bash
export WINIT_HIDPI_FACTOR=1
if [ -z "$*" ]; then
    alacritty
else
    alacritty -e $@
fi

By passing the path to the script in the Preferred Applications GUI, I now have a workaround to the absence of desktop file support in the GUI. The only missing thing is a nice icon the GUI, but I'm not bothered by it.

Offline

Board footer

Powered by FluxBB