lsd icon indicating copy to clipboard operation
lsd copied to clipboard

[Feature Suggestion] Respect .hidden file

Open j-maynard opened this issue 4 years ago • 5 comments

Many file managers such as Dolphin, Thunar, Nautilus and others support hiding files and holders using a .hidden text file. It would be nice if LSD was able to also support this behaviour. So a user creates a .hidden file with the names of files or directories in it (one per line). When a user runs LSD in that directory it picks up the .hidden file and then doesn't display any files which match.

This behaviour can be easily over ridden with the -a option which will still show all files irrespective of whats in the .hidden file. I know lots of people are using this hide things like the snap directory on those Linux desktops which run them.

j-maynard avatar Apr 07 '20 17:04 j-maynard

I am not sure if this is something that a lot of people would be using. There was a proposal to add a feature to add gitignore, which I believe more people would be using.

https://github.com/Peltoche/lsd/issues/218

meain avatar Apr 11 '20 14:04 meain

.gitignore could work but as .hidden files are already used by the majority of GUI file browsers on Linux I think this feature is used more than people my realise as not everyone who uses Linux necessarily uses or understands git. Thankfully their file formats are identical so once we can parse the file we just have to check if either of the two files are present.

j-maynard avatar Apr 20 '20 09:04 j-maynard

I would really appreciate if such a feature was added. I constantly use an external drive that is shared with a couple of Windows machines that constantly create System Volume Information/ and $RECYCLE.BIN/ directories that just really annoy me. In such situations I usually just create a .hidden file and put such files inside. That does actually work in Dolphin but sadly not in lsd

SergeyKasmy avatar May 26 '20 21:05 SergeyKasmy

Related (and I can open another issue if necessary), lsd should respect chflags hidden on macOS:

$ /bin/ls -lO
total 8
drwx------    3 dsully  staff  -        96 Jul  1  2019 Applications
drwxrwxr-x@   4 dsully  staff  hidden  128 Jul 18 09:17 Creative Cloud Files
drwx------@  14 dsully  staff  -       448 Jul 18 09:12 Desktop
drwx------@  12 dsully  staff  -       384 Jul 20 15:38 Documents
drwx------@  25 dsully  staff  -       800 Jul 21 10:28 Downloads
drwx------@  83 dsully  staff  hidden 2656 Jul  2 07:47 Library
drwxr-xr-x@   3 dsully  staff  hidden   96 Jul  3 09:19 Mounts

dsully avatar Jul 21 '20 17:07 dsully

@SleeplessSloth .. you could use --ignore-glob as the windows folders are a global issue:

lsd --ignore-glob 'System Volume Information' --ignore-glob '*RECYCLE.BIN'

Create alias. Should work as a workaround ..

sklages avatar Aug 13 '20 19:08 sklages