user-dirs.dirs and Chromium uppercase Downloads directory

Running Wayfire on Wayland i noticed Chromium wouldn't let me select a downloads directory in the settings,
the file picker opens and i can select a directory but the select button in the file picker didn't work

edit: the reason i couldn't select the directory with the file picker is because i didnt have
xdg-desktop-portal-wlr installed, which is the xdg-desktop-portal backend for wlroots

Wayfire is a wlroots based Wayland compositor and thats why i was having an issue with the file picker

sh:
# pkg install xdg-desktop-portal-wlr-0.7.0_1:

So Chromium would automatically create an uppercase Downloads directory in my home,
even though i had a lowercase downloads directory

If i selected my desktop directory which is lowercase using the file picker in the settings
then Chromium would create an uppercase Desktop directory as well

Then i realised that the issue is Chromium is using the XDG specification for the directory names in your home
which default to uppercase names

If you have ever installed Gnome you will know it creates several directory in your home that are all uppercased
Desktop, Documents, Downloads, Pictures, Videos, Public and Templates

And if you delete any of the directories like Public and Templates and reboot they will be automatically be recreated

The solution to these problems is to create a file called ~/.config/user-dirs.dirs
which can be used to turn off the automatically created directories in Gnome and other Desktop Enviornments,
and specify the names and paths of the desktop, downloads, documents, pictures and videos directories

create the ~/.config/user-dirs.dirs file and add the following code

Code:
enabled=False
XDG_DESKTOP_DIR="$HOME/desktop"
XDG_DOCUMENTS_DIR="$HOME/documents"
XDG_DOWNLOAD_DIR="$HOME/downloads"
XDG_MUSIC_DIR="$HOME/music"
XDG_PICTURES_DIR="$HOME/pictures"
XDG_VIDEOS_DIR="$HOME/video"

enabled=False turns off creating the default XDG names and directories in uppercase,
then you can specify the XGD directories you want and the file path

after creating the ~/.config/user-dirs.dirs file with above setting if you then open Chromium
you will see that the downloads directory is set to lowercase downloads and not uppercase Downloads

in the above example all directory names are lowercase,
so make sure to change anything in the above code to match your directory layout

this was bugging me for a couple of days so i thought id share the fix in case anyone else was having the same issue
 
Back
Top