desktop
desktop copied to clipboard
Shell integration for Thunar (XFCE)
Hi everyone,
similar to desktop integration plugins [1] for other DEs on Linux, like Gnome and KDE, I'd like to request a similar plugin for the XFCE Desktop and its file manager Thunar.
So, having
- icon overlays showing the sync status,
- context menu entries with sharing options and
- a dedicated bookmark in the side pane
within Thunar would be awesome, enhancing Nextcloud's usability for XFCE users.
There's already been some work from an independent developer [2] and the feature has been requested from XFCE upstream [3]. Yet I thought it might be worth a try asking you guys directly. :slightly_smiling_face:
However your decision, thanks a lot for your work! /Bernhard
[1] https://github.com/nextcloud/desktop/tree/master/shell_integration [2] https://github.com/frederikmoellers/thunar-nextcloud-plugin [3] https://gitlab.xfce.org/xfce/thunar/-/issues/499
I just found this issue and was thinking of a more generic away to solve it without requiring communication with the desktop client. Currently the thunar plugin connect to nextcloud via a socket to get the status of files, which is error prone and probably relatively intense with respect to resource usage.
What about storing this state in extended file attributes? That way the client can just write the information in a standard way and the integration(s) for each file manager just need to read them.
Sure, it would be possible to have nextcloud specific info in the file xattr
(or in the gvfs
file metadata) ... though not sure from where thunar should obtain that info in the first place.
It seems like there is a libnextcloudsync
available in distro repos ... I suppose it provides an API for that ?
There seems to be an integration for e.g. caja, though not sure where the sources for it are located ... I suppose thunar could just do the same.
Edit: Ok, found the nautilus/caja integration, seems to as well use socket connect via some python script: https://github.com/nextcloud/desktop/blob/5e9c7dbb57c96663f81d42dd09ead16bbc5163c2/shell_integration/nautilus/syncstate.py#L95
As well all other clients below desktop/shell_integration
seem to use sockets to communicate with nextcloud-desktop
though not sure from where thunar should obtain that info in the first place.
The idea would be that nextcloud makes a specification for extended attributes that they use. Then a Thunar plugin (or any other file manager plugin) would read the extended file attributes.
For example the thunar-media-tags-plugin
reads the file using taglib
. (This is for audio tags which live inside file content, so that's different)
If you look at the source code for the audio tags page from that plugin: https://gitlab.xfce.org/thunar-plugins/thunar-media-tags-plugin/-/blob/master/thunar-plugin/audio-tags-page.c?ref_type=heads#L86
You'll see that it essentially uses a reference to the file of type ThunarxFileInfo
. https://developer.xfce.org/thunarx/ThunarxFileInfo.html
The function thunarx_file_info_get_file_info
returns a GFileInfo
.
I'm not fluent in C but am confident based on this research that it should be possible and relatively easy as well.
A problem with that approach might be to notice changes on files using X-Attributes. Afaik e.g. the Gio FileMonitor does not trigger thunar when file metadata is changed.
E.g. you can set an emblem via CLI: gio set my_file metadata::emblems --type=stringv emblem-debian emblem-default
, though thunar will only reload the file and as such show the new emblem if you press F5 (refresh).
As well, I dont know if meanwhile all filesystems/OSes do support xattr.
Imo a more straight approach would be to communicate via some library, e.g. libnextcloudsync
if that offers an API to do so.
However, socket communication seems to work fine so far ... so as long as there is no concrete problem with it, I don't see a strong need to move to something else.