Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How is a terminal chosen for .desktop files with Terminal=true ? #127

Closed
epsilon-0 opened this issue Nov 2, 2020 · 6 comments · Fixed by #129
Closed

How is a terminal chosen for .desktop files with Terminal=true ? #127

epsilon-0 opened this issue Nov 2, 2020 · 6 comments · Fixed by #129

Comments

@epsilon-0
Copy link

epsilon-0 commented Nov 2, 2020

Currently no terminal UI based applications (e.g. htop) can be started.

@nwg-piotr
Copy link
Owner

nwg-piotr commented Nov 2, 2020

It's unsupported, at least for now. TBH I know no universal method to check the default terminal emulator. Ideas?

@epsilon-0
Copy link
Author

There is none...
This a big hole in freedesktop sepcifications of .desktop files.
This (among many other such threads) was the state of setting and finding terminal application:
https://xdg.freedesktop.narkive.com/bL3IsaJQ/spec-to-define-the-default-terminal#post11

How gnome does the finding is just cancerous
https://gitlab.gnome.org/GNOME/glib/-/blob/master/gio/gdesktopappinfo.c#L2548

My simple solution (though not universal or "adhering to [nonexistent] standards"): add it as a option in the config file.
Something like - terminal_exec_command: "alacritty -e ", which will run - alacritty -e "{command from Exec=}"

Because the current "solution" that everyone uses is to add the above alacritty -e to the start of the Exec= command.
This was it is atleast centralized and easily configurable.

Freedesktop specifications are a swiss cheese block, this one is just another hole.

@nwg-piotr
Copy link
Owner

nwg-piotr commented Nov 2, 2020

I'll try detecting several mostly used emulators, and save the first found one's name to ~/.config/nwg-launchers/nwggrid/term txt file for further use. The user will be able to replace it with their preferred terminal.

@nwg-piotr
Copy link
Owner

nwg-piotr commented Nov 3, 2020

I've added a function to detect the installed terminal emulator. It loops though 6 <terminal> -v commands, until one of them returns exit code 0, and saves the terminal name to the ~/.config/nwg-launchers/nwggrid/term file. In case it doesn't happen, the xterm name is being saved, regardless of whether it is installed or not. In both cases users may edit the term file content to use their favorite terminal emulator.

If you know any other terminal emulator with a command, which returns 0 exit code and terminates, it may be added to the list. AFAIK st, sakura and gnome-terminal have no such command (st and sakura return 1).

If you'd like to test changes, please build from the term branch.

@epsilon-0
Copy link
Author

will do tonight.

@nwg-piotr
Copy link
Owner

It turns out that there's a much better way to check the command availability, which I was unaware of (stupid me!). Now we can check any terminal we want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants