0

Whenever I want to upload a file via Chromium or Firefox a dialog to select files will pop up.

Is it possible to replace this dialog with ranger --choosefiles in a new terminal window?

ranger manpage: https://ranger.github.io/ranger.1.html

Ubuntu 18.04. My window manager is i3.

0

Yes, it is possible - at least for Firefox.

A new standard has been developed to allow arbitrary program to use the current desktop environment's "default" file dialogs without needing to know about the specific implementation. This is called the xdg-desktop-portal protocol and it was developed for desktop containers, but Firefox has recently added support for it (see below for details).

If you can create a new xdg-desktop-portal implementation for Ranger (there are already implementations for KDE and GTK file dialogs), then you can use these under Firefox.

Chrome has a different mechanism (it chooses correctly KDE or GTK file dialogs depending if running under Plasma or GNOME), but I'm not sure if it can be overriden to support another implementation.

  • Just checked, Chrome has specific implementation for GTK and KDE: codereview.chromium.org/7885002/patch/11002/11003 , so there's no way to add another option without patching Chrome (which you can't - contrary to what @vanadium say. You can patch Chromium, but that will not help you if you want to use Chrome and its additional feature). – Guss Jan 18 at 10:18
0

Is it possible? Probably yes. It is all open source software, after all. Will it be trivial? Most likely not.

Applications can provide their own "open file" dialog, but more frequently call upon the common dialog provided by the toolbox that the application uses, e.g. GTK3 or QT5, to provide consistency between different applications that use the same toolkit. That is also what Chromium or Firefox do. Replacing these calls to the system dialogs with your custom dialog would require to "hack" the API of the specific toolkit such that a call to that dialog returns your custom dialog instead.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.