1

What I want to achieve is to have a specific emoji appear next to dotfiles inside file manager "LF" (these can be made visible in the file manager with the "zh" shortcut).

In my ~/.config/lf/icons these are the first 9 lines in it:

^\..*   πŸ‘‘  
di  πŸ“  
fi  πŸ—žοΈ  
tw  🀝  
ow  ❌  
ln  πŸ”—  
or  ❔  
ex  πŸš€  
*.txt   πŸ—žοΈ  

These are additional things I've tried:

 1. ^\..*   πŸ‘‘
 2. ^\.*    πŸ‘‘
 3. ^.* πŸ‘‘
 4. .*  πŸ‘‘
 5. ..* πŸ‘‘

I've also tried reordering this "icons" file, i.e. putting one of these 5 before or after "fi" and similar filetypes.

Is this even possible in "LF"?

Other emojis seem to work fine.

I'm not sure what kind of information I would need to provide for this kind of issue, but here is some(please correct me and/or suggest additional info I should provide)

Distro: Manjaro
WM: i3
TE: xfce4-terminal
Emojis: Noto Color Emoji

4
  • 1
    What "if"? What "fi"? What is the actual desired behavior? Are you expecting the crown symbol to appear with hidden files? What happens now? Are these file not shown? Are they shown with a different icon? Perhaps you also need to activate some setting to show these files in the first place? What is LF? Is it this? Please edit and clarify. Commented Jul 7, 2024 at 17:05
  • Hi, by "lf", as I've stated right at the beginning, I mean "file manager named LF". The desired behavior is also included in that first sentence: What I want to achieve is - Have a specific emoji for dotfiles inside file manager "lf". Hidden files are shown if you press "zh" when LF is running. (That is the default keybinding) or you can set in ~/.config/lf/lfrc "set hidden true" and then you will see hidden files at all times. And yes, that is the "LF" I'm talking about. I'm not sure what should I clarify? Everything that is important is written in the post. Commented Jul 11, 2024 at 20:47
  • Sigh, it's the sans serif font, Noa! You had written "Is this even possible in 'lf'?" and I managed to read that as if instead of lf; possibly because of your earlier mention of fi which is often used to close an if. My fault, not yours, but I made an edit to clarify in case anyone else has the same dumb problem. Commented Jul 11, 2024 at 20:58
  • Oh, I understand now. Good that you've changed it. Thanks. Commented Jul 12, 2024 at 10:54

1 Answer 1

2

The documentation on icons in lf file manager is pretty vague:

first column is filetype or filename pattern

and the example icons file currently states

# file patterns (vim-devicons) (patterns not supported in lf)

so, patterns are not supported in lf as of 2024-07-07.

However, by looking at the source code, we can see that some kind of very basic "pattern" support is present:

func (im iconMap) get(f *file) iconDef {
    
    // ...

    if val, ok := im.icons[f.Name()+"*"]; ok {
        return val
    }

    if val, ok := im.icons["*"+f.Name()]; ok {
        return val
    }

    if val, ok := im.icons[filepath.Base(f.Name())+".*"]; ok {
        return val
    }

    if val, ok := im.icons["*"+strings.ToLower(f.ext)]; ok {
        return val
    }

    if val, ok := im.icons["fi"]; ok {
        return val
    }

    return iconWithoutStyle(" ")
}

first, the files are tested for being in one of the "icon categories" of lf, given in the documentation:

ln, or, tw, ow, st, di, pi, so, bd, cd, su, sg, ex

If they are not, then the files are matched against "patterns". Note that this doesn't do any wildcard expansion, but simply matches the keys from the icons file literally with the file name or extension with the character * prepended or appended.

Unfortunately, the conclusion seems to be that configuring icons for all files beginning with a dot based on a pattern is currently (2024-07-07) not possible in lf. At most one could add individual files in the icons file:

.gitignore*   πŸ‘‘
.vimrc*   πŸ‘‘
# and so on...

or

*.gitignore   πŸ‘‘
*.vimrc   πŸ‘‘
# and so on...

and even that provided they don't fall into one of the categories which are tested for before taking into account the "patterns". For example, if .vimrc is a symbolic link (or executable, etc.), the icon will be that of a symbolic link, etc.

Edit 2024-07-08: Since full pathname match is done before checking if the file belongs to one of the "icon categories" in the linked source code, to override lf assigning the icon from the "icon category" to the file which is a symbolic link (or executable, etc.), pathnames must be specified with absolute path; the pathnames are affected by tilde expansion, however:

~/.bashrc   πŸ‘‘
~/.vimrc   πŸ‘‘
# and so on...
1
  • Thank you very much for taking the time to write such detailed comment. Hopefully in the future, they can add that feature. Maybe I can even help, we'll see. After reading your comment, something came to mind. Instead of manually writing every single dotfile on my system, what I can do instead is specify different emojis for all the other extensions and then doing this: fi πŸ‘‘ That way, the only thing that doesn't have a filetype will be "captured" by a crown and those will, essentially, be dotfiles. Thanks again for your time and effort. Your answered helped. Commented Jul 8, 2024 at 10:37

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.