You are not logged in.
Pages: 1
Topic closed
if you've tried to edit a file from any gui, you know this. I used to link my terminal to xterm, but that's just bad design.
Has anything changed or is this still the only way to get Terminal=true apps work? EDIT: Yes, it appears to be so.
Also, I have ranger as default file browser (set for inode/directory), but it doesn't launch it when I am not using xdg-open from the terminal (which noone who uses the terminal does anyway - so it never does what I want it to).
Last edited by Kepis (2023-07-04 09:00:14)
Offline
Is this in Gnome by any chance?
The de-facto standard is to set TERMINAL to your TE of choice. But some DEs ignore this and have their own way of configuring a default terminal. Gnome, notably, is in a state of limbo where there may be no way for a user to reliably configure a default terminal.
Last edited by Trilby (2023-07-02 15:00:58)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
it doesn't launch it when I am not using xdg-open from the terminal
The actually failing context would be way more relevant.
nb. that file dialogs opened by applications to open/save files are NOT yor filemanager.
Online
The TERMINAL variable doesn't seem to affect anything. I don't have any more context, just when I try to open a directory from any gui, it opens the browser instead of ranger.
Offline
I don't have any more context, just when I try to open a directory from any gui, it opens the browser instead of ranger.
Start by defining "any gui" by listing some examples…
Online
firefox downloads "show in folder", Minecraft "open resourcepack folder". Just anything that opens a directory, what do you want from me?
Anyway, back to the original question: Is there a way to set a default terminal for xdg-open without linking something to xterm?
Last edited by Kepis (2023-07-02 16:05:09)
Offline
what do you want from me?
Yeah, good luck.
Online
What? What other context is relevant to xdg-open not launching a terminal filebrowser but a web browser when opening a directory from a non-terminal environment? I know I am still just repeating the same sentence over and over but I actually do not understand what you want me to give information about.
A gui application using xdg-open is just an application using xdg-open, it is not relevant what application it is, when I can replicate the same behaviour with just launching xdg-open ouside a terminal (from an application launcher) and getting the same result.
This cannot be DE related, because the problem is it launches the next fallback application and since I don't have any gui filemanagers, it launches firefox. The problem I see seems to be with xdg-open and provided I do not use an overriding script (otherwise I wouldn't be asking about xdg-open but about the script), I don't see anything else of value.
Last edited by Kepis (2023-07-02 16:40:01)
Offline
I'll give your the benefit of the doubt that this wasn't meant as gfy.
What I wanted was that: a list of examples, not "anywhere", https://bbs.archlinux.org/viewtopic.php?id=57855
For Firefox, see https://wiki.archlinux.org/title/Default_applications - https://freedesktop.org/wiki/Specificat … interface/
You'd probably have to write a dbus service to launch ranger instances in response, but at least
/usr/share/dbus-1/services/org.freedesktop.FileManager1.service
[D-BUS Service]
Name=org.freedesktop.FileManager1
Exec=/usr/bin/rangerwill spawn a ranger process when the service is called (but not open the desired location)
This has nothing to do w/ xdg-open (and idk what minecraft does)
There's also no globally supported spec for the default TE, for glib2 things are in flux, https://gitlab.gnome.org/GNOME/glib/-/i … te_1745989
Anything else depends heavily on what is actually invoking the TE, eg. i3 prefers $TERMINAL and then a hardcoded list of binaries it looks at.
Online
Oh, true, I could have held to some standards, sorry about that. I also thought I mentioned at least the browser fallback, but now I read my post again, I didn't do even that.
I have asked on unix.stackoverflow specifically in regards to the terminal filebrowser not opening from guis and found a solution by either overriding xdg-open entirely (with 'gio open') or writing a .desktop file which launches the filebrowser in a new terminal instance. The only downside to both aproaches was that it always opened a new terminal, even when some terminal application (I was also giving nnn a try) was the caller.
Also, as you kindly pointed out (and I have noticed just now upon trying), firefox doesn't call xdg-open. But, from my testing at least, it uses the same api as xdg-open, meaning overriding xdg-open didn't help but using a custom .desktop file did.
Last edited by Kepis (2023-07-03 08:19:57)
Offline
I have a similar issue with Jetbrains IDEs —the program offered to open a folder is Amberol, a music player. ?♂️
Offline
That is weird, if it happens only with Jetbrains. You can try searching for places, where Amberol is registered in '/usr/share/applications/mimeinfo.cache' or '~/.config/mimeapps.list' or '~/.local/share/applications/' contents.
Offline
writing a .desktop file which launches the filebrowser in a new terminal instance
For xdg-open you'll need some desktop service and point "xdg-mime query default inode/directory" there anyway - targeting an executable binary afaik won't work.
The only downside to both aproaches was that it always opened a new terminal, even when some terminal application (I was also giving nnn a try) was the caller.
Run sth. that queries the tty.
filemanager.desktop
[Desktop Entry]
Categories=System;FileTools;FileManager;Utility;ConsoleOnly;
Comment=A file manager
Exec=filemanager %F
GenericName=File Manager
Icon=filemanager
Name=Filemanager
Terminal=false
TryExec=filemanager
Type=Application
Keywords=File;Directory;Browse;
MimeType=inode/directory;~/bin/filemanager
#!/bin/bash
TTY="$(tty)"
if [[ "$TTY" = "/dev/pts/"* ]]; then
read ROWS COLS < <(stty -F "$TTY" size)
((COLS > 99 && ROWS > 15)) && exec mc "$@"
fi
. ~/bin/.funcs/daytime
frxvt -pixmap "$HOME/wallpapers/urxvt/filemanager.png;style=centered" -title Files \
-font 'xft:Source Code Pro:size=9:hinting=true,xft:Consolas:size=11:hinting=true' \
-name XMC -geometry 128x32 -e mc "$@" &
disown %1(the daytime functions provide frxvt which is bright or dark depending on the daylight level, it's irrelevant to your situation)
nb. that eg. mc fails for small™ terminals and xdg-open will resort to some default, why also the terminal geometry is sanity checked (mc will allow smaller terminals but be useless)
Online
Using the tty command to detect terminal interface is clever, I used a solution testing all the file descriptors (0,1,2), which worked for my usecase, but this is better. You can also use the exit code of 'tty' directly - no need to test text output. Thank you.
Also, from what I understand, there isn't a general way to set a terminal, other than link to xterm, which is a fallback default for xdg-open and most other apps, right?
Last edited by Kepis (2023-07-04 06:28:23)
Offline
there isn't a general way to set a terminal
Even symlinking xterm won't be global (and there's yet no xdg setting or invocation for the default TE either) but only apply to maybe the approaches you took.
The Terminal=true setting is relevant to whatever launches the .desktop service (in doubt your DE/launcher), eg. rofi has a "terminal" setting/parameter and defaults to "x-terminal-emulator" etc.
Online
here is my solution, setting kitty as the default terminal:
sudo ln -s /usr/bin/kitty /usr/local/bin/x-terminal-emulatorYou can natively execute programs in terminal by creating ~/.local/share/applications/superfile.desktop:
[Desktop Entry]
Version=1.0
Type=Application
Name=Superfile
Comment=Terminal-based file manager
Exec=spf %F
Terminal=true
Categories=Utility;FileManager;make sure x-terminal-emulator is not already in a system executable path.
Last edited by mostafatouny (2026-03-09 20:10:11)
Offline
Mod note: Closing this old thread.
Inofficial first vice president of the Rust Evangelism Strike Force
Offline
Pages: 1
Topic closed