Lf: Default file browser in Linux

Created on 15 Aug 2019  路  14Comments  路  Source: gokcehan/lf

Has anyone configured lf to be their default file browser in Linux? I'd like file browsing prompts from applications like Google Chrome to use lf, but I can think of two unknowns:

  1. How can I configure this? I've read a little about XDG defaults, but I've never set any myself. Perhaps I'd set it to zsh -c lf or something similar.
  2. If I could accomplish step 1, how would lf handle file selection? I'm imagining the use case of selecting a file for an email attachment. Maybe Enter could return the full path to the currently selected file. Unsure of what other file browsers like Nautilus do.

If anyone has attempted or achieve this, I'd love to hear their story.

question

Most helpful comment

It might be worth thinking to add an official lf.desktop to Lf's source code and recommend package installers etc to use it. What do you think @gokcehan ?

All 14 comments

I think you need to create desktop entry for lf and set it as default handler for inode/directory mimetype.

I've created a desktop entry for Lf based on ranger's and it works for me.

Note that if you are using Firefox and you intend to use your new lf.desktop file for the 'Open containing folder' button, you may experience the following issue: https://github.com/ranger/ranger/issues/1164 . Checkout my comment at the end of that thread for a fix or my answer here: https://superuser.com/a/1469035/430539

It might be worth thinking to add an official lf.desktop to Lf's source code and recommend package installers etc to use it. What do you think @gokcehan ?

@doronbehar It sounds like a good idea though I don't know much about how this works. Do you have the version for lf somewhere? Is there any significant changes from ranger's?

No significant changes, just the name of the application of course and the executable.

@gokcehan would you be interested in a PR?

@doronbehar PR would be nice to speed things up because I'm having difficulties to spare time working on lf nowadays.

@doronbehar would you mind explaining more about your solution? Greatly appreciated.

What do you wish to do @pabloaguirrenck ?

@doronbehar Would like to define lf as default file browser. Current setup goes as follows:

  1. Create new .desktop application:
    cd /usr/share/applications
    vim LF.desktop
    [Desktop Entry]
    Type=Application
    Name=lf
    Comment=Launches lf file manager
    Icon=utilities-terminal
    Terminal=true
    Exec=lf
    Categories=ConsoleOnly;System;FileTools;FileManager
    MimeType=inode/directory;
    Keywords=File;Manager;Browser;Explorer;Launcher;Vi;Vim;PythonDesktop Entry]
    xdg-mime default LF.desktop application/x-directory

Firefox does not handle open correctly when trying to open dir (downloaded file).
Chromium does not handle open correctly when trying to open dir (downloaded file).

xdg-open .

Opens lf correctly on Termite (default Terminal emulator).

Any suggestions?

I think you're experiencing the following issue: ranger/ranger#1164 . Checkout my comment at the end of that thread for a fix or my answer here: https://superuser.com/a/1469035/430539 .

No luck with symlink, neither Firefox nor Chromium are recognizing.

Among These terminals:

https://gitlab.gnome.org/GNOME/glib/blob/2.21.6/gio/gdesktopappinfo.c#L783-792

Which are available in your $PATH ?

Those terminal bin paths are not per se defined on $PATH, just generic /usr/bin
echo $TERM returns xterm-termite (set on .zshenv)

@pabloaguirrenck I don't feel comfortable talking here while adding notifications for everyone who have been involved in this thread. You can contact me on the matrix as @doronbehar:matrix.org.

Was this page helpful?
0 / 5 - 0 ratings