Thunar does not respect .hidden files

Bug #110521 reported by Daniel Miles
42
This bug affects 8 people
Affects Status Importance Assigned to Milestone
Thunar File Manager
Won't Fix
Wishlist
thunar (Ubuntu)
Won't Fix
Wishlist
Unassigned

Bug Description

Binary package hint: thunar

In Thunar Feisty, it does not respect .hidden files created to hide files and folder that do no begin with a .

Konqueror, Dolphin and Nautilus all support this.

This will mean that the blueprint at https://blueprints.beta.launchpad.net/ubuntu/+spec/hide-filesystem-structure/ becomes irrelevant for Xubuntu. It is also losing quite a nice feature for cleaning up directory views.

This has been tested only with feisty's thunar from the repo's - Thunar 0.8.0

Revision history for this message
In , Daniel Miles (themono) wrote :

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

Changed in thunar:
status: Unknown → Confirmed
Changed in thunar:
importance: Undecided → Low
status: Unconfirmed → Confirmed
Revision history for this message
In , Mdskpr (mdskpr) wrote :

(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

Revision history for this message
In , Daniel Miles (themono) wrote :

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.

Revision history for this message
Jérôme Guelfucci (jerome-guelfucci-deactivatedaccount) wrote :

Thank you for your bug report. I'm marking this as triaged.

Changed in thunar:
status: Confirmed → Triaged
Revision history for this message
tlvince (tlvince) wrote :

Unfortunately, this still hasn't been implemented in Hardy. Is there any chance of this happening soon? It is quite a useful feature

Revision history for this message
Todd (dreadmeat) wrote :

xubuntu 8.04.1, Thunar 0.9.0, Xfce 4.4.2

i'd like to see this feature/function added too.

Revision history for this message
In , Jeromeg (jeromeg) wrote :

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.

Revision history for this message
In , Brian Tarricone (kelnos) wrote :

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.

Revision history for this message
pinzia (pinzia) wrote :

news? xfce 4.4.6 implements this feature?
konqueror 4.2 don't support .hidden file

Revision history for this message
Charlie Kravetz (cjkgeek) wrote :

Xfce 4.6 is out. Does it support this? It is available in both Jaunty 9.04 and Karmic 9.10. Can you try that version and comment back here?

Revision history for this message
pinzia (pinzia) wrote :

same problem, nothing has changed

uname: Linux PENDOLA 2.6.28-11-generic
thunar -v: Thunar 1.0.0 (Xfce 4.6.0)
lsb -a:
Distributor ID: Ubuntu
Description: Ubuntu 9.04
Release: 9.04
Codename: jaunty

Revision history for this message
pinzia (pinzia) wrote :
Revision history for this message
Simon Booth (sgb-ubuntu) wrote :

also present in Karmic.

Changed in thunar (Ubuntu):
importance: Low → Wishlist
Revision history for this message
Jay A. Babcock (newyorkcityjay) wrote :

Also present in Natty

Revision history for this message
In , Sdfjsfjaei-softwareload (sdfjsfjaei-softwareload) wrote :

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

Revision history for this message
jacques.labbe (labbe-jacques) wrote :

Xubuntu 12.04, Thunar 1.2.3 (Xfce 4.8)
still the same.

Revision history for this message
Ravi Kumar (kumarravi-kumar267) wrote :

When it will be fixed?? XFCE 4.10 Xubuntu 12.04..

Revision history for this message
In , Mark Harrison (mark-z-harrison) wrote :

Created attachment 4645
Function to test if file is contained in .hidden

Revision history for this message
In , Mark Harrison (mark-z-harrison) wrote :

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.

Revision history for this message
In , 8-nick (8-nick) wrote :

If this is really a spec, GIO (!) can implement this. GtkFileChooser also doesn't implement this, so I can hardly care.

Revision history for this message
Lionel Le Folgoc (mrpouit) wrote :

Marked as won't fix upstream if it's really a spec, this should be implemented in GIO.

Changed in thunar (Ubuntu):
status: Triaged → Won't Fix
Changed in thunar:
importance: Unknown → Wishlist
status: Confirmed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.