You are not logged in.
I have freshly installed my first arch to newly acquired computer. I was using kde for years and for the sake using tiling windows managers, I have ditched kde and I am now trying to connect pieces of desktop environment by myself. I have one major problem left which is the file manager. I have installed dolphin, vifm etc via pacman. I am using alacritty as terminal application. I have made vifm or dolphin default file manager with xdg-mime commands. They response xdg-open ~ correctly inside terminal.
When I tried to open a folder from certain applications such as browsers, firefox chromium etc, the folder is not displayed. Either dolphin or vifm manager has .desktop files at /usr/share/applications which are installed by package manager. In my ~/.local/share/applications folder, I have following file as well.
defaults.list -> /home/toktay/.config/mimeapps.list with following content.
[Default Applications]
x-scheme-handler/msteams=teams.desktop
text/html=firefox.desktop
text/plain=gvim.desktop
x-scheme-handler/http=firefox.desktop
x-scheme-handler/https=firefox.desktop
x-scheme-handler/about=firefox.desktop
x-scheme-handler/unknown=firefox.desktop
application/pdf=okularApplication_pdf.desktop
application/epub+zip=okularApplication_epub.desktop
inode/directory=vifm.desktop
In my system xterm is not installed. I suspect system does know which application it will use as terminal. I have not been able to identify a mime type for a terminal application so I could not set it.
How can make alacritty default terminal application to be used in these circumstances?
How can I make firefox, chromium to open dolphin or vifm (inside my selection of terminal)?
Any insight is much appreciated. Thanks in advance.
Offline
Afaics there's no way to set the default terminal, but a bunch of client specific implementations.
You can try to "export TERMINAL=/usr/bin/alacritty" (NOT! "TERM"!!!) and if you cannot convince the runner at question anyway else, simply symlink alacritty to xterm…
Offline
When I tried to open a folder from certain applications such as browsers, firefox chromium etc
What does this mean? Web browsers don't "open folders". Do you mean when you try to download/save a file or select a file for upload to a website? These use file dialog windows built in to the browser / toolkit (GTK3 in the case of firefox and chromium). This has nothing to do with your file manager - nor anything at all to do with a "default terminal".
In my system xterm is not installed. I suspect system does know which application it will use as terminal. I have not been able to identify a mime type for a terminal application so I could not set it.
How can make alacritty default terminal application to be used in these circumstances?
In what circumstances? You've not referred to any situation in which a process needs to open a terminal. In many cases programs may use the TERMINAL environment variable, but this completely depends on which program we are talking about.
How can I make firefox, chromium to open dolphin or vifm (inside my selection of terminal)?
You don't. Web browsers browse the web. They don't open file managers or terminals. EDIT: perhaps there are exceptions as noted below - but is that what you are talking about - I suspect you are rather referring to the file dialog windows provided by the widget toolkit which are not file managers.
Last edited by Trilby (2022-02-24 17:07:36)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
The major browser will offer you to open the folder where you just downloaded a file ("show in folder" or something like that in the context menu)
Offline
I have not been able to identify a mime type for a terminal application so I could not set it.
Offline
teckk, what part of that page is relevant to the point you quoted. There is no mime-type for "terminal application". Specific launchers can be configured to use a given terminal, but not through mime types. I believe xdg-open will use the setting of TERMINAL if it is available, then if not, it will go through it's own list of candidate terminal emulators until if finds one that is available.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Thank you for all the responses, I am very happy that I am getting such support. Glad to be in arch community.
I believe, I could not laid out the details in my previous post very well. I will give the complete case to clarify.
I am running dwm window manager without a desktop environment.
As an example, in Firefox the is a dialog which shows history of downloaded files. It can be accessed from top right menu or via short cut Ctrl-Shift-Y. In this dialog, for each entry of previously downloaded files, there is an folder icon on the far right side of the dialog. It has tool tip stating "Show in folder". When I click it, nothing happens. Normally in desktop systems such as kde, it opens a file manager of that desktop environment, such as dolphin in kde.
Before I did any fiddling with xdg, such an action used to show list of files on a new tab of the default browser which is firefox.
I read the whole wiki at Arch wiki default applications . After that I set default file manager application as follows.
xdg-mime default vifm.desktop inode/directory
, but unfortunately I get no response such as in firefox while clicking "Show in folder" icon. However when I give the command from a terminal such as
xdg-open ~
, vifm display the home or any other directory properly. The same goes with dolphin as well, if I make it default application, I can activate it via
xdg-open ~
. Chromium does the same thing, discord or any other gui application behaves the same. They can not open xdg registered default file manager application.
How can I make these gui applications to be aware of or open the system default file manager?
I really need to solve this problem to properly interact with gui applications.
Offline
Ah, I stand corrected, you really are looking for file manager settings then. This description was very helpful. Specifically:
However when I give the command from a terminal such as
xdg-open ~
, vifm display the home or any other directory properly.
Does vifm open in the same terminal that you typed that command in, or does a new terminal window open with vifm running? If the latter, is TERMINAL set in the shell environment? If so, where is it set (if TERMINAL is set somewhere that is inherited by the interactive shell but not by dwm, this could explain your symptoms). If vifm opens in the same terminal you typed the command in, then that would identify the problem as being with the vifm.desktop file, it would need the "needs terminal" setting (which I don't recall the exact name/syntax off of hand).
Last edited by Trilby (2022-02-25 02:25:34)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
vifm.desktop has "Terminal=true", but xdg-open will re-use an existing terminal and trying to use this setup from chromium will result in defunct xdg-open and chromium processes… as I just figured.
But setting TERMINAL will work in that case because chromium relies on xdg-open.
Offline
Xdg-mime types are useful for assigning default applications to handle certain filetypes or actions. Xdg-mime is not the only method for achieving this. Terminal applications (although usually able to execute CLI applications with an argument upon launch, eg. $ alacritty -e htop) are usually not required to be a default application to open a certain filetype per se.
Do you have a specific reason or goal in mind for why you want to do this? Maybe there is a simpler way to achieve your desired result.
Desktop: Dual boot {Arch & Windows 11} | Hyprland | AMD Ryzen 5700X | 32GB DDR4 | AMD Radeon RX 6700XT | Dual display DP-1 & DP-2=2560x1440
Laptop: Triple boot {Arch & Mint & Windows 11} | Dell Latitude E7270 | Intel Core i5-6300U | 16GB DDR4 | eDP-1=1920x1080
~ Do or do not, there is no try ~
Offline
Hello,
I have tried many things, even though there are warnings not execute xdg-mime defaut as root, it helped and once firefox and chromium opened folders in dolphin. Then I tried the same vifm, which it did not work out and somehow it affected back dolphin which did not work anymore. Yes I have this time defined TERMINAL environment variable to map alacritty.
I have found following paragraph in xdg-mime man page
default
Ask the desktop environment to make application the default application for opening files of type
mimetype. An application can be made the default for several file types by specifying multiple
mimetypes.application is the desktop file id of the application and has the form vendor-name.desktop.
application must already be installed in the desktop menu before it can be made the default handler.
The application's desktop file must list support for all the MIME types that it wishes to be the
default handler for.Requests to make an application a default handler may be subject to system policy or approval by the
end-user. xdg-mime query can be used to verify whether an application is the actual default handler for
a specific file type.The default option is for use inside a desktop session only. It is not recommended to use xdg-mime
default as root.me man page.
It basically states that if the application is not registered in the desktop menu, it can not be declared default.
I did
xdg-deskop-menu install --mode system --novendor org.kde.dolphin.desktop
xdg-deskop-menu install --mode system --novender vifm.desktop
Then I tried both dolpin or vifm as default inode/directory mime application, now xdg-opens vifm.desktop from dmenu which I could not do previously, but still firefox or chromium can not activate it to open folders (Show in folders). The same goes for dolphin as well. Dolphin is accessible dmenu, from terminal but to from firefox, chromium etc.
There is an undocumented thing in xdg with relevant to these applications. I do not know what desktop environments do to make them work. Before above actions, any xdg-open commant related inode/directory mime open firefox tab listing directory. Now nothing happens. Currently, unknown mimes are registered to x-scheme-handler/unknown=firefox.desktop.
Offline
Hello
I have also tried modifying vifm.desktop file by changing the Exec command to include alacritty and setting Terminal=false.
Exec=vifm %F #to
Exec=/usr/bin/alacritty -e vifm %F
Terminal=False
It did not change anything.
Offline
Yes I have this time defined TERMINAL environment variable to map alacritty.
Where and how? Is it properly exported to the browser process?
now xdg-opens vifm.desktop from dmenu which I could not do previously
Sure this isn't because you set the TERMINAL variable?
The same goes for dolphin as well. Dolphin is accessible dmenu, from terminal but to from firefox, chromium etc.
Did you change the default inode handler and then restart the browser?
I have also tried modifying vifm.desktop file
There're now two exec lines…
Offline
Yes I have this time defined TERMINAL environment variable to map alacritty.
Where and how? Is it properly exported to the browser process?
Yes. I start X server currently not automatically. I use .xinitrc. I login from tty then gave the command startx. I checked many that $TERMINAL is exported before starting X or during the session. The TERMINAL variable is exported from my .bashrc file.
now xdg-opens vifm.desktop from dmenu which I could not do previously
Sure this isn't because you set the TERMINAL variable?
I believe not. I have defined TERMINAL environment, as soon as I saw your recommendation your initial post. I have done many things on top of that. If I remember right, previously xdg-open started vifm only within the terminal. Outside a terminal environment, it could not open it. Because of that I tried to change the vifm.desktop file by changing the Exec command, as I described in my other post. After registering vifm to desktop menu, it became available at X environment. I would like emphize that I used following which definitely changed the behavior.
sudo xdg-desktop-menu install --mode system --novendor /usr/local/applications/vifm.desktop
The same goes for dolphin as well. Dolphin is accessible dmenu, from terminal but to from firefox, chromium etc.
Did you change the default inode handler and then restart the browser?
Yes, I did better, I killed windows manager along with always changing default inode/directory handler.
Offline
sudo xdg-desktop-menu install --mode system --novendor /usr/local/applications/vifm.desktop
So you ultimately did that to add your altered vifm.desktop ?
Does it still have two "Exec=" lines?
Does chromium trigger an xdg-open subprocess? What's its state?
Did you try to symlink alacritty to xterm (just for experimentation)?
Offline