While Thunar is fine at hiding files which begin with a full stop, it does not parse the .hidden file in folders and hide any files and folders listed within. This is supported by Konqueror, Nautilus, and is a handy feature. One example of use is here: https://blueprints.launchpad.net/ubuntu/+spec/hide-filesystem-structure/ This bug has also been filed on Ubuntu's launchpad here: https://bugs.launchpad.net/ubuntu/+source/thunar/+bug/110521
(In reply to comment #0) > While Thunar is fine at hiding files which begin with a full stop, it does not > parse the .hidden file in folders and hide any files and folders listed within. > > This is supported by Konqueror, Nautilus, and is a handy feature. One example > of use is here: > https://blueprints.launchpad.net/ubuntu/+spec/hide-filesystem-structure/ > > > This bug has also been filed on Ubuntu's launchpad here: > https://bugs.launchpad.net/ubuntu/+source/thunar/+bug/110521 > did u try this? start thunar and then press ctrl + h and then go into ur home directory it should show all the hidden files
I'm not sure you understand the bug report. The problem is not that Thunar is not showing files, the problem is that it is not hiding them. There are two ways to tell the major file managers (Nautilus, Konqueror, Dolphin) to hide files - prefix their filename with a fullstop, ie, '.foo.sh', or leave the filename as is 'foo.sh' and add that to a list contained in the file '.hidden' The first method works with Thunar, the second does not.
Created attachment 1774 initial draft of patch to solve this I started to work on this, and here is the patch I came up to. Comments are welcome, I doubt this is perfect.
The patch itself is sorta ok (see below for those notes), but it's pretty awful from a performance standpoint. When Thunar opens a directory, it'll have to open the .hidden file for each and every file in the dir, read it in, parse it, and decide. Even if there's no .hidden file, you incur an extra stat() call for each and every file in a directory when enumerating the files in it. Better would be to cache the contents of .hidden the first time it's opened (perhaps in a GHashTable or GTree for fast lookups, though a GSList might be ok since in a real-world scenario, I wouldn't expect there to be more than a few files listed in .hidden), and kill the cache when the user leaves the directory (or maybe X seconds after the user leaves, in case they come back soon). If there isn't a .hidden file, should cache that fact and not stat() for every file in the dir. Also might want to consider on-the-fly updating. Thunar already monitors the currently-opened directory for changes so it can update the listing in real time. If .hidden changes, should invalidate the cache, reread it, and hide any files in the directory that now match. This is of course much more complex than your patch... personally I wouldn't be happy with it as-is; I imagine Benny's standards are higher than mine :-/ . About the patch itself: 1. Don't declare variables ('hidden_file' in your case) in the middle of functions. gcc 3+ handles this fine, but other compilers may not. 2. Is there a particular reason you're duping the strings for 'basename' and 'parent'? You don't need to keep them around past function invocation, and you don't modify them. 3. You leak 'basename' -- you g_strdup() a string at the top and store it in 'basename', and then g_strconcat() another string inside the if() block and store it in 'basename' without ever g_free()ing the original. Note that g_strconcat() also allocs memory. 4. g_file_get_contents() wastes memory, and, depending on the size of .hidden, is slower than just fopen()ing the file, and using fgets() to get each line. If you find the file in the list, you don't have to read out the entire file. You can also use a buffer on the stack with fgets() to avoid another alloc/free.
Hello guys! I hope this feature will be soon implemented as it is really nice to be able to hide stuff like $RECYCLE.BIN, System Volume Information and some other folders of which the name can't be changed to begin with a dot. Thanks so much for your work on XFCE, Thunar and co. Best regards! snapy666
Created attachment 4645 Function to test if file is contained in .hidden
I've attempted to write an improved version of Jérôme Guelfucci's function (#3) for reading the .hidden file while imcorporating Brian J. Tarricone's critiques (#4). (Function to test if file is contained in .hidden) Unfortunately, I couldn't figure out how to compile thunar so I couldn't test this function. I hope this is useful in moving this bug towards resolution. Basically, the last visited directory and a hash table of the .hidden file in that directory are stored in static variables. When a new file is checked, its directory (parent) is compared with the directory stored in the static variable. If they match, the current hash table is used. If they don't match, the hash table is destroyed and the .hidden file in the current directory--if it exists--is read into a new hash table. The hash table is then searched for the input file. It has two limitations: (1) It does not refresh if the .hidden file is changed in the current directory. (2) The maximum length file name is 254 characters (specified by max_line_length in line 52). This is required by fgets when reading the .hidden file.
If this is really a spec, GIO (!) can implement this. GtkFileChooser also doesn't implement this, so I can hardly care.