DEV Community

svhl
svhl

Posted on

Dolphin switches from .directory to extended attributes

When I upgraded from Debian 12 to 13, KDE transitioned from Plasma 5 to 6. I noticed something in Dolphin, KDE's file manager — there were no longer .directory files.

Previously, when you set "Remember display style for each folder" in Dolphin and change the display style for a particular folder, a .directory file will be created in that folder. This file stores the view mode (icons, compact or details), and other attributes such as whether to show hidden files.

Since this is on a per-folder basis, a .directory file will be created for each folder you change the display style for. While this approach works, it's not an ideal solution as it pollutes your file system with unnecessary files. This is similar to how macOS creates .DS_Store files.

I guess one solution would be keep track of this information in a database instead. An issue with this is that when a user deletes a folder outside of Dolphin, the corresponding attributes entry in the database should also be removed. Otherwise, these invalid entries will take up unnecessary space over time. This requires too much overhead, so it's not feasible.

The solution

A better method would be to embed these attributes within the folder so that it's not visible to the user. Using a tool like getfattr, we can view these extended file attributes.

First, install it with

$ sudo apt install fattr
Enter fullscreen mode Exit fullscreen mode

Then, change the display style in a folder and run the below command. You'll notice that KDE has created an extended attribute.

$ getfattr ./
# file: . user.kde.fm.viewproperties#1
Enter fullscreen mode Exit fullscreen mode

To view the value of this attribute, run the below command

$ getfattr -d ./
# file: . user.kde.fm.viewproperties#1="[Dolphin]\012Timestamp=2025,10,24,11,06,34.929\012Version=4\012ViewMode=2\012"
Enter fullscreen mode Exit fullscreen mode

In my case, ViewMode will be set to 2, since I changed the display style to compact view mode. Details view mode will show 1 and icons view mode will show 3 instead.

Now, I'll set to show hidden files and run the command again. Notice how HiddenFilesShown is set to true.

$ getfattr -d ./
# file: . user.kde.fm.viewproperties#1="[Dolphin]\012Timestamp=2025,10,24,11,06,45.362\012Version=4\012ViewMode=2\012\012[Settings]\012HiddenFilesShown=true\012"
Enter fullscreen mode Exit fullscreen mode

However, custom folder icons are still stored in .directory files, but that might be changed soon. Nevertheless, this is a very welcome change in Plasma 6. I hope other file managers like Nautilus also implement such solutions (if GNOME gets around to implementing per-folder display styles first 🫠).

Top comments (0)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.