microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
107.07k stars 6.32k forks source link

Hide Dotfiles (File Explorer) #8054

Open turtlebasket opened 3 years ago

turtlebasket commented 3 years ago

đź“ťFeature Request: Basically what the title says.

I was thinking it would be nice if there were some way for File Explorer to automatically hide dotfiles. Surely I'm not the only one whose home directory looks like this:

image

I think adding something like this to the File Explorer configuration tab would be helpful:

image


If you'd like to see this feature implemented, add a đź‘Ť reaction to this post.

Aaron-Junker commented 3 years ago

For this Topic I found this: https://www.gobowen.com/node/308

Jay-o-Way commented 3 years ago
  1. These are folders, not files
  2. This is an awfully specific thing. I personally don't think it's worth the effort, because...
  3. You can manually hide these folders in their properties.
ghost commented 3 years ago

I wouldn't want to hide my dotfiles either.

ghost commented 3 years ago

But that's probably why this is an option. So it wouldn't matter if everyone likes the idea

crutkas commented 3 years ago

I can see this being useful. Simple flag to set for hidden.

image

enricogior commented 3 years ago

While settings the hidden flag kind of works, it's also problematic to cover edge cases, for example how is this supposed to work when browsing a shared location? It's not an option to set the dot-folders to hidden since it's no a local disk, and on the reverse side, how is supposed to work when the option is off and you navigate to a remote share that has the option on?

crutkas commented 3 years ago

Could be set for only local. To me this would be a proactive monitoring system for folders with the leading period.

turtlebasket commented 3 years ago

Hi, all! Glad to see this is getting some attention. I'd just like to clarify some things:

MikeMitterer commented 3 years ago

This is one of the things that holds me back from switching from Mac to Windows! dot-files are hidden files under Linux and under MacOS - please!!!! add this feature for Windows too. Now that WSL gains more popularity it is a no-go to show all those hidden Linux files in Windows Explorer

myhrmans commented 3 years ago

Now that WSL gains more popularity it is a no-go to show all those hidden Linux files in Windows Explorer This is very true. Accessing the file system for WSL in File Explorer makes it look like a mess if you have multiple dotfiles in many folders. Adding a option to hide these would be great.

ghost commented 3 years ago

If there isn't someone already working on this, I would like to take a stab at it. This appears to be the latest consensus so I will use it as a starting point:

Could be set for only local. To me this would be a proactive monitoring system for folders with the leading period.

Aaron-Junker commented 3 years ago

If there isn't someone already working on this, I would like to take a stab at it. This appears to be the latest consensus so I will use it as a starting point:

Could be set for only local. To me this would be a proactive monitoring system for folders with the leading period.

@octos4murai There isn't someone working on this right now. Thank you for your offer. This feature is a big one and because of that we need a specification on this which explains why this feature is useful, what the (non-)goals are, how you want to implement it and so on. You can look at the wiki specs page for inspiration and to look how our specs are built. You can find more information about that in the specs readme. If you think you're not able to write a spec, please just tell me. I'm sure I would find time to do it myself or help you, but it would be better if you could do it, because you know how you want to implement it.

For help on developing please contact @crutkas.

And if you start developing it or writing the spec please let me know so I can add the "in progress" label

ghost commented 3 years ago

@octos4murai There isn't someone working on this right now. Thank you for your offer. This feature is a big one and because of that we need a specification on this which explains why this feature is useful, what the (non-)goals are, how you want to implement it and so on. You can look at the wiki specs page for inspiration and to look how our specs are built. You can find more information about that in the specs readme. If you think you're not able to write a spec, please just tell me. I'm sure I would find time to do it myself or help you, but it would be better if you could do it, because you know how you want to implement it.

For help on developing please contact @crutkas.

And if you start developing it or writing the spec please let me know so I can add the "in progress" label

@Aaron-Junker Appreciate the guidance. I am new to the process of writing a spec but I can certainly consult the links you provided. When I am ready to start writing, I will let you know so you can add the appropriate label.

ghost commented 3 years ago

@Aaron-Junker it doesn't look like I am able to start on this anytime soon. I wanted to note this in case someone wants to jump in instead.

cdevers-es commented 2 years ago

This is a Windows feature I would like to see, please.

As others in this thread have pointed out, the decades-long convention on POSIX systems (UNIX, Linux, macOS…) is that file browsers hide “dotfiles” (a term that includes both files & directories, because “everything is a file”).

Consider for example that macOS clients (still) create resource forks when writing to a shared network volume. These days, when writing to a network filesystem (like a Samba server) that isn't configured to support multiple data streams, macOS will write the “data fork” as just the filename — example.doc — and the “resource” fork will have a ._ dot-underscore prefix: ._example.doc.

On Mac clients, Finder sees these two files and automatically stitches them together, so only the example.doc item is shown in file listings. But on Windows, File Explorer doesn't associate resource fork files with their data fork files, so both ._example.doc and example.doc are displayed next to each other.

Now consider a busy shared volume where many Mac and Windows clients are interacting, and there are lots and lots of files authored by the Mac users. On the Macs, everything looks fine, but the Windows users will see lots of annoying ._* files, possibly one for every “real” file on the volume.

If dotfiles were hidden, then this would be a lot less annoying for Windows users sharing access to such shared storage.

And that's why just doing this for local storage is probably not an optimal solution: someone on their own laptop or whatever is not likely to encounter this scenario very often, unless they’re carrying over old habits from Linux. But anyone using shared Samba/SMB/CIFS storage with Mac users is likely to hit this on a regular basis.

dlgombert commented 2 years ago

I got here because I was looking for a solution to this problem. I don't mind manually hiding them, but I am concerned about the viability of that - or any solution that uses the same attribute based api. Why this is, is because I have tried this before, and it resulted in some programs not working. If memory serves, I think some node.js processes couldn't find the files in question. If this has been fixed, then great, but it seems an important thing to know for sure before pursuing this seriously. That said - I very much hate the clutter that is my home folder on Windows, and would love to see this implemented.

Clonkex commented 2 years ago

Out of curiosity and without knowing anything about how PowerToys operates, is there a feasible way to make Explorer hide dotfiles without marking the files as hidden? I would assume that would require injecting changes into Explorer or similar.

crutkas commented 2 years ago

We'd change a file / folder attribute to hidden. It wouldn't inject anything into FE but we'd have chances are a file system watcher that just detects folder rename / creation with a dot and if it isn't marked hidden, we'd mark it hidden. As Enrico has referenced, we do have to be careful on network shares as we wouldn't want to mark something hidden that isn't on the local file system.

GitMensch commented 2 years ago

Whoa, when this is about actually changing the attributes: please don't do that. If you do add a warning notice and a "do you really want us to adjust a bunch of your file attributes - this is a one-way thing and can't be automatically reverted so you'd have to track all those files yourself if you want to go back" question message...

Better move that to the Windows Team and let them add an explorer.exe integrated option for a new Windows 11 feature update. Seems to be a valid reason for some to switch from old Windows to Windows 11, if implemented (and on that level it can't be that hard, can it)?

Clonkex commented 2 years ago

@GitMensch While I think adding the hidden flag to dotfiles is... insignificant (meh, it's just the hidden flag and dotfiles are meant to be hidden anyway 99% of the time)... I do agree on principle that permanently modifying the data isn't an ideal solution. Much better to have Explorer simply treat dotfiles as hidden regardless of the hidden attribute.

crutkas commented 2 years ago

Powertoys is open source and uses only public APIs. Best way I know is to use a file/folder attribute.

Anyone aware of alternatives?

GitMensch commented 2 years ago

The alternative is to move this to closed-source explorer.exe, everything else cries for troubles.

Aaron-Junker commented 2 years ago

Powertoys is open source and uses only public APIs. Best way I know is to use a file/folder attribute.

Anyone aware of alternatives?

Well technically you could replace the whole shell of explorer, but this seems more then out of scope.

crutkas commented 2 years ago

Powertoys experiments and incubates ideas. The attribute concept could be how we’d test it.

There maybe some regkey that is documented I may not be aware of

GitMensch commented 2 years ago

Powertoys experiments and incubates ideas.

That's one of the things I like about it. That's also the case for the user - the toy can be enabled, and if there is an issue just be disabled later.

But the attribute concept would do a permanent change to the file system that can only be undone manually - so the experiment comes with a cost that none of the experiments so far had: permanent change. And we also found out that this experiment could only work partially - not with network folders, not with read-only filesystems, not with files the user has no write access to, ... it "may" create issues for external programs (there was an example of node above, but that can also happen to other programs and scripts) and... cannot be undone by toggling back.

Summary: the feature is very reasonable, but it should not be done outside of explorer.exe (or a "replacing shell with a lot of efforts") as this is about "looking", not about "changing attributes". In my opinion it is a feature the "explorer.exe" team should handle.

I've stretched that point enough, so I'm out of this specific issue.

Victor333Huesca commented 2 years ago

The way I would implement such a feature would be:

  1. In the PowerToys menu, have a list of paths the user wants to be impacted (e.g. the user home directory).
  2. Each time a path is added to the list, run a recursive script that updates the flag.
  3. Setup a filesystem watcher to watch for all selected directories and directly update the flag on dotfile creation, rename and move.

Doing so avoids the trouble of having the whole filesystem to watch with possibly network directories. I believe most users who want this feature are interested in it to hide dotfile from their projects directories, not those from the system. A warning or/and confirmation could be displayed when adding a new path base on a list of criteria (the path is on a network drive, it contains more than N files which could result in poor performances, etc).

To me, this looks like a good tradeoff between the irreversibility of updating the hidden flag and not messing up the whole filesystem.

rogerkaplan commented 2 years ago

Just stumbled on this thread while looking for a solution to exactly this problem. I'd like to point out the problem with tagging the files with the Hidden attribute. This only works if the system-wide setting "Don't show hidden files, system files..." is set. But I'd argue most people who have dotfiles are technical and want to see system files etc. Since this is a small group compared to the bulk of windows users, and every GUI decision within broader Windows that impacts complexity needs to be carefully considered, this feature is probably best installed as an addon by... power users.

Clonkex commented 2 years ago

This only works if the system-wide setting "Don't show hidden files, system files..." is set. But I'd argue most people who have dotfiles are technical and want to see system files etc.

Personally even as a developer I don't know why I would ever have hidden or system files visible. Hidden files are hidden for a reason; having them visible just create a whole lot of clutter, and on the few occasions I want to find a hidden file there's a quick toggle for that setting in the ribbon menu. As for protected OS files, the times I want those files visible are exceedingly rare (usually when I have to fix some registry issue and need to manually load the hives, which basically never happens these days). I just don't feel the need to be able to see every part of my system just because I'm "technical". That would be like driving with no bonnet on your car and a diagnostic computer next to you just because you're a mechanic.

joshumax commented 1 year ago

I'm not sure if this is helpful, but instead of a filesystem watcher to hide dotfiles I use Windows system call API injection in order to hide my dotfiles from processes like Windows Explorer - see https://github.com/joshumax/WinHideEx. It avoids the extra IO usage that a filesystem watcher creates, especially when recursively crawling through network shares. Although realistically, Microsoft should just create a filter driver that PowerToys can communicate with to mark dotfiles with the "hidden" attribute. I thought about going that route too but driver signing costs more money than I'm comfortable spending on my weekend project.

m-krastev commented 1 year ago

Bump.