thunar issueshttps://gitlab.xfce.org/xfce/thunar/-/issues2023-09-20T16:28:47Zhttps://gitlab.xfce.org/xfce/thunar/-/issues/1205Using extended attributes (xattr) to add some missing features to thunar2023-09-20T16:28:47ZArash RohaniUsing extended attributes (xattr) to add some missing features to thunarWith some tiny changes to thunar/thunar-file.c and accepting a few custom xattrs, we can add some cool (missing) features to thunar. I went with the prefix `user.xfce.` for these xattr names to avoid any potential future conflicts but th...With some tiny changes to thunar/thunar-file.c and accepting a few custom xattrs, we can add some cool (missing) features to thunar. I went with the prefix `user.xfce.` for these xattr names to avoid any potential future conflicts but the names are ultimately up to the developers. The good thing about using extended attributes is that you don't need to (and I'd argue *shouldn't*) add any new UI elements to thunar. These are mostly for people who know what they are doing and just need to override the default thunar file options. In some instances it can also remove the need for gvfs.
The things I could implement:
1. user.xfce.icon_name: setting icon names for normal files/folders (not just .desktop files)
2. user.xfce.emblems: setting any icon or picture as emblems without the need for gvfs
3. user.xfce.mimetype: overriding a file's mimetype
4. user.xfce.hide: hiding normal files (non-dot files) and showing the hidden files (dot-files)
5. user.xfce.thumbnail (and user.xfce.thumbnail.<normal|large|xlarge|xxlarge>): overriding file thumbnails
Here's the updated [thunar-file.c](/uploads/720ffc089f86a172f2bb3cda14ee4331/thunar-file.c) based on 775ab5b9. I have also pasted the git-diff here to show that it is absolutely minimal.
```diff
diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c
index 4a4d6899..b4949600 100644
--- a/thunar/thunar-file.c
+++ b/thunar/thunar-file.c
@@ -50,6 +50,8 @@
#include <unistd.h>
#endif
+#include <sys/xattr.h>
+
#include <gio/gio.h>
#include <libxfce4ui/libxfce4ui.h>
#include <libxfce4util/libxfce4util.h>
@@ -117,7 +119,8 @@ static gboolean thunar_file_load (ThunarFile
static gboolean thunar_file_is_readable (const ThunarFile *file);
static gboolean thunar_file_same_filesystem (const ThunarFile *file_a,
const ThunarFile *file_b);
-
+static gchar *thunar_file_get_xattr_value (const ThunarFile *file,
+ const char *attr_name);
static GRecMutex G_LOCK_NAME (file_cache_mutex);
@@ -2451,9 +2454,17 @@ thunar_file_get_content_type (ThunarFile *file)
GFileInfo *info = NULL;
GError *err = NULL;
const gchar *content_type = NULL;
+ gchar *xattr_value;
_thunar_return_val_if_fail (THUNAR_IS_FILE (file), NULL);
+ xattr_value = thunar_file_get_xattr_value (file, "user.xfce.mimetype");
+ if (xattr_value)
+ {
+ file->content_type = xattr_value;
+ return file->content_type;
+ }
+
if (G_UNLIKELY (file->content_type == NULL))
{
G_LOCK (file_content_type_mutex);
@@ -3177,11 +3188,31 @@ thunar_file_is_writable (const ThunarFile *file)
gboolean
thunar_file_is_hidden (const ThunarFile *file)
{
+ gchar *xattr_value;
+
_thunar_return_val_if_fail (THUNAR_IS_FILE (file), FALSE);
if (file->info == NULL)
return FALSE;
+ xattr_value = thunar_file_get_xattr_value (file, "user.xfce.hide");
+ if (xattr_value)
+ {
+ switch (xattr_value[0])
+ {
+ case '1':
+ g_free(xattr_value);
+ return TRUE;
+
+ case '0':
+ g_free(xattr_value);
+ return FALSE;
+
+ default:
+ g_free(xattr_value);
+ }
+ }
+
return g_file_info_get_attribute_boolean (file->info, G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN)
|| g_file_info_get_attribute_boolean (file->info, G_FILE_ATTRIBUTE_STANDARD_IS_BACKUP);
}
@@ -3643,8 +3674,9 @@ GList*
thunar_file_get_emblem_names (ThunarFile *file)
{
guint32 uid;
- gchar **emblem_names;
+ gchar **emblem_names = NULL;
GList *emblems = NULL;
+ gchar *xattr_value;
_thunar_return_val_if_fail (THUNAR_IS_FILE (file), NULL);
@@ -3652,8 +3684,16 @@ thunar_file_get_emblem_names (ThunarFile *file)
if (file->info == NULL)
return NULL;
+ xattr_value = thunar_file_get_xattr_value (file, "user.xfce.emblems");
+ if (xattr_value)
+ {
+ emblem_names = g_strsplit (xattr_value, " ", -1);
+ g_free(xattr_value);
+ }
+
/* determine the custom emblems */
- emblem_names = g_file_info_get_attribute_stringv (file->info, "metadata::emblems");
+ if (!emblem_names)
+ emblem_names = g_file_info_get_attribute_stringv (file->info, "metadata::emblems");
if (G_UNLIKELY (emblem_names != NULL))
{
for (; *emblem_names != NULL; ++emblem_names)
@@ -3827,8 +3867,45 @@ thunar_file_is_desktop (const ThunarFile *file)
const gchar *
thunar_file_get_thumbnail_path (ThunarFile *file, ThunarThumbnailSize thumbnail_size)
{
+ gchar *xattr_value = NULL;
+ char *xattr_name;
+
_thunar_return_val_if_fail (THUNAR_IS_FILE (file), NULL);
+ switch (thumbnail_size)
+ {
+ case THUNAR_THUMBNAIL_SIZE_NORMAL:
+ xattr_name = "user.xfce.thumbnail.normal";
+ break;
+
+ case THUNAR_THUMBNAIL_SIZE_LARGE:
+ xattr_name = "user.xfce.thumbnail.large";
+ break;
+
+ case THUNAR_THUMBNAIL_SIZE_X_LARGE:
+ xattr_name = "user.xfce.thumbnail.xlarge";
+ break;
+
+ case THUNAR_THUMBNAIL_SIZE_XX_LARGE:
+ xattr_name = "user.xfce.thumbnail.xxlarge";
+ break;
+
+ default:
+ xattr_name = NULL;
+ }
+
+ if (xattr_name)
+ xattr_value = thunar_file_get_xattr_value (file, xattr_name);
+
+ if (!xattr_value)
+ xattr_value = thunar_file_get_xattr_value (file, "user.xfce.thumbnail");
+
+ if (xattr_value)
+ {
+ file->thumbnail_path = xattr_value;
+ return file->thumbnail_path;
+ }
+
/* if the thumbstate is known to be not there, return null */
if (thunar_file_get_thumb_state (file) == THUNAR_FILE_THUMB_STATE_NONE)
return NULL;
@@ -4063,10 +4140,23 @@ thunar_file_get_icon_name (ThunarFile *file,
guint i;
const gchar *special_dir;
GFileInfo *fileinfo;
+ gchar *xattr_value;
_thunar_return_val_if_fail (THUNAR_IS_FILE (file), NULL);
_thunar_return_val_if_fail (GTK_IS_ICON_THEME (icon_theme), NULL);
+ xattr_value = thunar_file_get_xattr_value (file, "user.xfce.icon_name");
+ if (xattr_value)
+ {
+ if (gtk_icon_theme_has_icon(icon_theme, xattr_value))
+ {
+ g_free(file->icon_name);
+ file->icon_name = xattr_value;
+ return thunar_file_get_icon_name_for_state (file->icon_name, icon_state);
+ }
+ g_free(xattr_value);
+ }
+
/* return cached name */
if (G_LIKELY (file->icon_name != NULL))
return thunar_file_get_icon_name_for_state (file->icon_name, icon_state);
@@ -4579,6 +4669,38 @@ thunar_file_same_filesystem (const ThunarFile *file_a,
+static gchar *
+thunar_file_get_xattr_value(const ThunarFile *file,
+ const char *attr_name)
+{
+ /* PATH_MAX should be enough for most attribute values */
+ char read_value[PATH_MAX];
+ ssize_t value_size;
+ char *path;
+ gchar *attr_value = NULL;
+
+ _thunar_return_val_if_fail (THUNAR_IS_FILE (file), NULL);
+
+ if (!file->gfile || !attr_name || !attr_name[0])
+ return NULL;
+
+ path = g_file_get_path (file->gfile);
+ if (!path)
+ return NULL;
+
+ value_size = getxattr (path, attr_name, read_value, PATH_MAX);
+ if (value_size > 0)
+ {
+ read_value[value_size] = 0;
+ attr_value = g_strdup(read_value);
+ }
+
+ g_free(path);
+ return attr_value;
+}
+
+
+
/**
* thunar_file_cache_lookup:
* @file : a #GFile.
```https://gitlab.xfce.org/xfce/thunar/-/issues/634New variant for "show thumbnails": "remote if provided"?2021-08-19T20:15:35ZchrysnNew variant for "show thumbnails": "remote if provided"?Now that sh_thumbnails are supported, the preferences setting of "show thumbnails" (currently: "never", "local files only", "always") could gain a new option: "remote if provided" ("when effortless"? We'll need good wording too).
In tha...Now that sh_thumbnails are supported, the preferences setting of "show thumbnails" (currently: "never", "local files only", "always") could gain a new option: "remote if provided" ("when effortless"? We'll need good wording too).
In that setting, thumbnails will be show for remote files only if the remote provides them in form of sh_thumbnails already. This should also make a good candidate for a new default (currently: "local files only"), as it follows its intention: Do what can be done without creating extraneous amounts of network traffic. (The old "local only" option still makes sense, for if you're on metered bandwidth or a slow link, even transferring the thumbnails can be too much to. Personally, I'd be just as happy with Thunar using sh_thumbnails whenever available, but I imagine there are cases when that's not desirable).
Alternatively, it may make sense to split up the "Only show thumbnails for files smaller than" to local and remote files, and merely consider any existing .sh_thumbnail's size when one is available, such that a setting of "if smaller than 512KiB" would practically always catch on when shared thumbnails are provided, and not otherwise.
---
As for the current state, I can't test that properly: the `xfce-test` environment I've tested general sh_thumbnails with doesn't ship gvfs, and when I install gvfs and gvfs-backends to get to my davs:// test server, I don't get any thumbnails at all (whereas the current Debian sid version happily produces thumbnails). Anyway, as this'd need additional user choices, it can probably be discussed independent of currently observed behavior.https://gitlab.xfce.org/xfce/thunar/-/issues/411Menu entry to toggle thumbnails on specific directories2022-03-31T09:50:06ZAlexander SchwinnMenu entry to toggle thumbnails on specific directoriesFollowup of #78
Like Dolphin, which has a toggle in its view-menu for that.
Could be added in the "view" menu, above, or below the zoom-levels. Behavior, if per-directory-setting is disabled:
* checking it on a local drive, sets the ...Followup of #78
Like Dolphin, which has a toggle in its view-menu for that.
Could be added in the "view" menu, above, or below the zoom-levels. Behavior, if per-directory-setting is disabled:
* checking it on a local drive, sets the global one to "only local"
* checking it on a remote drive, sets the global one to "always"
* unchecking it on a local drive, sets the global one to "never"
* unchecking it on a remote drive, sets the global one to "only local"https://gitlab.xfce.org/xfce/thunar/-/issues/285Provide an option to sort file names starting with underline before all other...2020-10-14T21:04:32ZBugzilla MigrationProvide an option to sort file names starting with underline before all other file names## Submitted by Ada..@..gmx.de
Assigned to **Xfce Bug Triage**
**[Link to original bug (#16524)](https://bugzilla.xfce.org/show_bug.cgi?id=16524)**
## Description
Currently file names starting with an underline are sorted as if th...## Submitted by Ada..@..gmx.de
Assigned to **Xfce Bug Triage**
**[Link to original bug (#16524)](https://bugzilla.xfce.org/show_bug.cgi?id=16524)**
## Description
Currently file names starting with an underline are sorted as if the underline would not be there.
However it is customary to let file names begin with an underline character to let them be shown at the top of a directory sorted by names.https://gitlab.xfce.org/xfce/thunar/-/issues/228Path shown in Thunar after using a link shows how I got there rather than the...2023-11-05T12:04:31ZBugzilla MigrationPath shown in Thunar after using a link shows how I got there rather than the Location of the File## Submitted by Ada..@..gmx.de
Assigned to **Xfce Bug Triage**
**[Link to original bug (#15016)](https://bugzilla.xfce.org/show_bug.cgi?id=15016)**
## Description
This question pertains to Xubuntu 16.04.3 LTS with current kernel 4...## Submitted by Ada..@..gmx.de
Assigned to **Xfce Bug Triage**
**[Link to original bug (#15016)](https://bugzilla.xfce.org/show_bug.cgi?id=15016)**
## Description
This question pertains to Xubuntu 16.04.3 LTS with current kernel 4.4.0-116-generic x86_64. Thunar has Version 1.6.11 (the one packaged to Xubuntu 16.04).
I have made a link to the frequently used public account of another user.
I put this link on my desktop (in a German Xubuntu: Senden an Desktop).
When I use this link, a new Thunar window opens and shows the way from my desktop to that place: The path shown tells about the way how I got there. I would prefer if it would show _the description from the root in the file system to my file (the UNC path)_, rather than the way how I got there using my desktop link.
If use Ctl-C after this on a file, it depends on the way how I use the clipboard then. If I paste it to a mousepad-window or Shift-paste it to a LibreOffice document, the path to the file gets pasted, but with that strange deviation via my desktop link, i.e. the pasted path contains the way how I got there rather than the shortest way to it!
*How can I let Thunar fetch me the UNC path to my pointed-to file?*https://gitlab.xfce.org/xfce/thunar/-/issues/186Confusing File Owner Name in Thunar2020-11-22T20:41:32ZBugzilla MigrationConfusing File Owner Name in Thunar## Submitted by basilicum
Assigned to **Xfce Bug Triage**
**[Link to original bug (#14117)](https://bugzilla.xfce.org/show_bug.cgi?id=14117)**
## Description
Description of problem:
Passwd contains the fields:
Username: It ...## Submitted by basilicum
Assigned to **Xfce Bug Triage**
**[Link to original bug (#14117)](https://bugzilla.xfce.org/show_bug.cgi?id=14117)**
## Description
Description of problem:
Passwd contains the fields:
Username: It is used when user logs in. It should be between 1 and 32
characters in length.
User ID Info: The comment field. It allow you to add extra information
about the users such as user’s full name, phone number etc. This field use by
finger command.
It appears that Thunar shows in the column owner the "User ID Info" followed by
the Username in paranthesis. This can be very usefull for a lot of scenario's.
However, I would greatly prefer that Thumar just shows the Username. The reason
is that all command line utilities, like ls, show the Username by default. I'm
quite sure that a lot of linux users will appreciate this conformity.
Therefor, I suggest to make a configuration option by which the linux standard
can be enforced, i.e. showing passwd Username.
Version-Release number of selected component (if applicable):
Thunar-1.6.13-1.fc27.x86_64
How reproducible:
Always, just configure column to show owner.
Steps to Reproduce:
1.
2.
3.
Actual results:
Expected results:
Additional info:
also listed as bugzilla 1528759https://gitlab.xfce.org/xfce/thunar/-/issues/152Add preference to resolve all symlinks in the path2023-02-09T22:08:57ZBugzilla MigrationAdd preference to resolve all symlinks in the path## Submitted by lar..@..llo.at
Assigned to **Xfce Bug Triage**
**[Link to original bug (#13246)](https://bugzilla.xfce.org/show_bug.cgi?id=13246)**
## Description
When you open a directory symlink using Thunar the path in the loca...## Submitted by lar..@..llo.at
Assigned to **Xfce Bug Triage**
**[Link to original bug (#13246)](https://bugzilla.xfce.org/show_bug.cgi?id=13246)**
## Description
When you open a directory symlink using Thunar the path in the location input isn't resolved to the actual path and you can't go up to the actual parent directory. Please add a preference to always resolve all symlinks in the path.https://gitlab.xfce.org/xfce/thunar/-/issues/31Default setting for showing hidden files2020-10-18T09:01:31ZBugzilla MigrationDefault setting for showing hidden files## Submitted by Kevin Cox
Assigned to **Jannis Pohlmann**
**[Link to original bug (#7650)](https://bugzilla.xfce.org/show_bug.cgi?id=7650)**
## Description
Currently, Thunar restores the last setting for hidden files. I think it ...## Submitted by Kevin Cox
Assigned to **Jannis Pohlmann**
**[Link to original bug (#7650)](https://bugzilla.xfce.org/show_bug.cgi?id=7650)**
## Description
Currently, Thunar restores the last setting for hidden files. I think it is more intuitive that the user can pick a default setting and have that be used in every new window.
I believe that most people usually want to or don't want to see hidden files. I don't think it goes in streaks.https://gitlab.xfce.org/xfce/thunar/-/issues/25thunar settings dialog not pluggable2023-08-05T08:19:39ZBugzilla Migrationthunar settings dialog not pluggable## Submitted by Yves-Alexis Perez
Assigned to **Jannis Pohlmann**
**[Link to original bug (#7332)](https://bugzilla.xfce.org/show_bug.cgi?id=7332)**
## Description
Running the thunar settings dialog from xfce4-settings-manager lea...## Submitted by Yves-Alexis Perez
Assigned to **Jannis Pohlmann**
**[Link to original bug (#7332)](https://bugzilla.xfce.org/show_bug.cgi?id=7332)**
## Description
Running the thunar settings dialog from xfce4-settings-manager leads to a new popup instead of an embedded one.
Version: 1.6.12