! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Support for environment variables or desktop files in Preferred Applications
Status:
RESOLVED: MOVED

Comments

Description Harish Rajagopal 2020-03-16 09:05:58 CET
I would like to configure default applications using environment variables for use with exo-open.

In my use case, I want to set Alacritty as the default terminal emulator, but with the environment variable WINIT_HIDPI_FACTOR=1. The way I've currently registered this in the Preferred Applications GUI, in the Utilites tab for the Terminal Emulator, is:

  bash -c 'env WINIT_HIDPI_FACTOR=1 alacritty'

This works if I run the following:

  $ exo-open --launch TerminalEmulator

However, if I pass additional arguments, they are ignored. For example:

  $ exo-open --launch TerminalEmulator htop

This simply opens Alacritty without opening htop. Similarly, when certain .desktop files are set to open in the terminal, they will not open. Instead, only an ordinary terminal window opens.

The above setting in the Preferred Applications GUI is the only way in which the first command can run. I have tried the following setups:

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

None of them work.

I have already configured the desktop file for Alacritty to have the required environment variables set. Is there a way to get exo-open to use the desktop file? Or is there another way to pass environment variables in the Preferred Applications GUI along with possible command line options ("%s")?

This issue has been discussed here: https://forum.xfce.org/viewtopic.php?id=13829
Comment 1 Theo Linkspfeifer editbugs 2020-03-16 11:04:20 CET
Is this not a duplicate of Bug 16346?
Comment 2 Harish Rajagopal 2020-03-16 11:09:47 CET
This is very similar, but slightly different. That bug is for the command line exo-open, where as I would like this feature to be in the Preferred Applications GUI. I do not want to set the environment variable every time I run exo-open in the command line, but only once in the GUI.

Also, sometimes I cannot set it manually, for eg. if a desktop file is set to run inside a terminal. I can manually edit every such desktop file, but it is annoying to keep doing this when I install a new program that has a desktop file set to open the program in the terminal.
Comment 3 Harish Rajagopal 2020-03-18 18:55:38 CET
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 an nice icon the GUI, but I'm not bothered by it.
Comment 4 Git Bot editbugs 2020-05-25 22:56:44 CEST
-- GitLab Migration Automatic Message --

This bug has been migrated to xfce.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.xfce.org/xfce/exo/-/issues/22.

Please create an account or use an existing account on one of our supported OAuth providers. 

If you want to fork to submit patches and merge requests please continue reading here: https://docs.xfce.org/contribute/dev/git/start#gitlab_forks_and_merge_requests

Also feel free to reach out to us on the mailing list https://mail.xfce.org/mailman/listinfo/xfce4-dev

Bug #16559

Reported by:
Harish Rajagopal
Reported on: 2020-03-16
Last modified on: 2020-05-25

People

Assignee:
Xfce Bug Triage
CC List:
0 users

Version

Version:
0.12.11

Attachments

Additional information