Strange Caja Behavior
In the house network the Caja file manager started launching with files in detailed list view sorted by modification date rather than by name. A single click in the Name column header fixed the issue for the session. The behavior was ignored for several days until accepting that something was broken and finding time to investigate.
Problems like this don’t happen without reason.
Adding to the curiosity is Caja did not exhibit this behavior with two user accounts in the house network.
Finding the root cause required several sittings. Comparing files from the unaffected user accounts did not help. A decent backup strategy helped. Eventually the cause was identified through a modified
The difference seemed to be changing
XDG_DOWNLOAD_DIR="$HOME/". This was deceiving. The root cause was actually deleting the
$HOME/Downloads directory. In the house network there is a common public downloads directory that is identified in the
gtk-bookmarks file. The
XDG_DOWNLOAD_DIR location can be changed with each user account, but the common directory is where many downloads are stored.
The behavior was repeatable — log out of the X session, delete
$HOME/Downloads, log in, and the Caja default sort order changed. Restore the directory and the default sort order was by name.
Browsing the Caja code seems to indicate Caja is designed with a presumption that
$HOME/Downloads exists, as well as
$HOME/Downloads does not exist and is not defined then the default sort order changes. The code reveals that
xdg-user-dirs-update is called with the
set parameter when certain XDG user directories do not exist and are not defined. While
$HOME/.config/user-dirs.dir was not directly responsible for the sort behavior, the file always got modified on first launch of Caja. The file would be modified with
XDG_DOWNLOAD_DIR="$HOME/" when no such entry existed.
The cure is having a
$HOME/Downloads directory even if unused and not needed or explicitly defining
When the sort order is changed manually, this information is retained in a binary file at
While ensuring that
$HOME/.local/share/Trash exists makes sense, forcing
$HOME/Downloads to exist does not. XDG is a standard, but software should not be designed to presume that additional default XDG user directories must exist.
The fundamental mystery is although presumptions often are necessary in code, why default to sorting by modified date rather than name?
The question probably is academic. GTK software soon will be fading away in the house network.