lsd icon indicating copy to clipboard operation
lsd copied to clipboard

Stop lsd on windows from showing every regular file as green

Open Un1q32 opened this issue 3 years ago • 6 comments

  • os: Windows 11
  • lsd --version: lsd 0.22.0
  • echo $TERM: N/A
  • echo $LS_COLORS: N/A

Windows NTFS doesnt have POSIX file permissions, so they need to be emulated. This results in all files being marked as executable, which is necessary but annoying, since every regular file is shown in green. Is there a way to make executable files white?

Un1q32 avatar Aug 07 '22 07:08 Un1q32

Can one not create a new theme and select unique colours based on the file extension? image Note that the NTUSER.DAT* files are supposed to be hidden

image image ll is an alias for lsd -l

danie-dejager avatar Aug 31 '22 12:08 danie-dejager

You can change the color of items by using LS_COLORS, but the problem here is that the executable flag overrides the colors set based on extension.

meain avatar Sep 01 '22 04:09 meain

You can change the color of items by using LS_COLORS, but the problem here is that the executable flag overrides the colors set based on extension.

Is lsd ignoring the hidden flag of files by default?

danie-dejager avatar Sep 01 '22 17:09 danie-dejager

What do you mean by hidden flag?

meain avatar Sep 05 '22 09:09 meain

In Windows you can set a file to be Hidden.

danie-dejager avatar Sep 05 '22 13:09 danie-dejager

Oh, I was not aware of it. I don't think we are handling that as of now.

meain avatar Sep 05 '22 14:09 meain

@meain Genuinely reconsider please. Ignoring hidden files/folders would make a world of difference for Windows or WSL users. 90% of apps/programs on Windows don't use '.' or '_' for hidden files/folders like they would on *Nix, and instead rely on Windows default hidden flag. I know it's a hassle, but such is life for supporting Windows.

If exa implements this before lsd, it'd be a big enough deal for me to switch despite needing to self-compile exa.

Terraphice avatar Oct 12 '22 10:10 Terraphice

I don't use Windows and don't have enough context to take a decision on this. How is it done in other programs like ripgrep and fd? Do they take into account hidden flag in Windows? @TeamTamoad since you are a Windows user, let me know if you have any thought around it.

meain avatar Oct 12 '22 11:10 meain

Actually, I'm a Linux user. I just happened to have a Windows laptop to test on some issue. I think implementing these kind of feature is not a bad thing because it makes the user happy 😃. I've looked into ripgrep and fd, they've implemented hidden files on Windows correctly (see this and this) However, the problem is that we need someone to implement this. Since I've had a full-time job 3 months ago, I have much less time to contribute to this project.

TeamTamoad avatar Oct 12 '22 18:10 TeamTamoad

Thanks @TeamTamoad for linking to rg and fd issues. I think it makes sense to have lsd respect hidden files in windows when not using -a or -A. That said, I thin this is different from the original issue which was about file permissions. I'll create a separate issue (https://github.com/Peltoche/lsd/issues/752) for respecting hidden flag in windows.

PS: No pressure on your to pick it up btw. Just thought I would get your thoughts on this as I have seen you comment on Windows related issues. :D.

meain avatar Oct 13 '22 06:10 meain

While we are on the topic, my understanding is that there is no such thing as "executable" flag on windows, or is there a flag we can query which lsd is not already doing? If there is no such thing as a executable, although we can override the color of executable using LS_COLORS, I don't might changing the it so that lsd does not treat every file as executable.

meain avatar Oct 13 '22 06:10 meain

windows does not have an executable flag, but we could make files with an executable extention like .exe, .bat, .cmd, .ps1, etc show as green.

Un1q32 avatar Oct 14 '22 00:10 Un1q32

I think in that case the quickest option would be to just use the option suggested by https://github.com/Peltoche/lsd/issues/712#issuecomment-1232868513 .

meain avatar Oct 14 '22 03:10 meain

Oh by the way, windows has 2 different kinds of hidden files. There's normal hidden files and operating system protected files. Those NTUSER.dat files are the second kind. The user almost never has to interact with OS protected files, I've never done so once in my 10 years or so of using Windows. I would suggest making a dedicated command line flag to show OS protected files, and normal hidden files can be shown with just -a or -A.

Un1q32 avatar Oct 14 '22 17:10 Un1q32

Oh by the way, windows has 2 different kinds of hidden files. There's normal hidden files and operating system protected files. Those NTUSER.dat files are the second kind. The user almost never has to interact with OS protected files, I've never done so once in my 10 years or so of using Windows. I would suggest making a dedicated command line flag to show OS protected files, and normal hidden files can be shown with just -a or -A.

You are right. I like your suggestion.

danie-dejager avatar Oct 17 '22 07:10 danie-dejager