whitequark / rust-xdg

A library that makes it easy to follow the X Desktop Group specifications
https://wiki.freedesktop.org/www/Specifications/
Apache License 2.0
154 stars 30 forks source link

Wishlist: support other dirs (xdg-user-dirs, trash, etc) #1

Open o11c opened 8 years ago

o11c commented 8 years ago

One of the things I never got around to adding support for was xdg-user-dirs - things like ~/Documents, ~/Music, etc.

This is more complicated because it involves reading the config from files instead of just the environment, and translating according to the current locale. Also xdg-user-dirs is not a spec, just a set of tools.

Trash is a spec though.

whitequark commented 8 years ago

There is no $(XDG_CONFIG_HOME)/user-dirs.dirs on my system, so it seems modern DEs don't care for running that tool.

o11c commented 8 years ago

~/.config/user-dirs.dirs exists for me, do you have /etc/xdg/user-dirs.{conf,defaults} at least?

whitequark commented 8 years ago

Nope.

whitequark commented 8 years ago

Do you have any further suggestions on this topic?

o11c commented 8 years ago

I have no clue, I'm honestly surprised that any desktop system does not have it.

whitequark commented 8 years ago

Ah, there's this... https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=599391

tbu- commented 8 years ago

I have this file (~/.config/user-dirs.dirs):

# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
# 
XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_VIDEOS_DIR="$HOME/Videos"
whitequark commented 8 years ago

Sure. What I'm saying is that KDE, at least on my system, doesn't write that file, and in fact doesn't even depend on whatever package xdg-user-dirs-update is in.

I have no objections to inclusion of a parser for this in the xdg crate, I just express my doubt about the usefulness of it.

whitequark commented 8 years ago

Although the fact that there's no specification is also troublesome... @o11c mentioned something about locale, where do I even get that information?

tbu- commented 8 years ago

I don't know, I don't need this feature, just wanted to provide information. Locale might come from this file:

$ hexdump -C ~/.config/user-dirs.locale
00000000  43                                                |C|
00000001
m00nwtchr commented 2 years ago

I started working on implementing xdg-user-dirs, and I plan on implementing the Trash spec and possibly others as well.