Open lartpang opened 5 years ago
重装系统后发现系统使用的是home作为桌面文件夹,这也太危险了,这可不是软连接,删掉了可真删掉了!所以查询如何处理。
home
一个桌面环境的配置文件被改动了。
Short answer:
Edit ~/.config/user-dirs.dirs
打开这个文件时可以看到,这里实际上被修改到了$HOME,你改到你想要的文件夹就可以了
$HOME
Long answer:
How to disable/relocate the User Directories (Desktop, Pictures, Documents etc) ?
On a freedesktop compliant DE this is done via the XDG user directories configuration file, namely $(XDG_CONFIG_HOME)/user-dirs.dirs:
$(XDG_CONFIG_HOME)/user-dirs.dirs
$(XDG_CONFIG_HOME)/user-dirs.dirs specifies the current set of directories for the user.
If not set or empty, XDG_CONFIG_HOME defaults to ~/.config so, for most users, the file in question is ~/.config/user-dirs.dirs.
XDG_CONFIG_HOME
~/.config
~/.config/user-dirs.dirs
Applications read this file to find those directories. The file consists of key=value pairs, one per line.
key=value
The default locations are:
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_PUBLICSHARE_DIR="$HOME/Public" XDG_TEMPLATES_DIR="$HOME/.Templates" XDG_VIDEOS_DIR="$HOME/Videos"
To relocate a certain directory edit the config file and replace the current value with the location of your choice, e.g.
XDG_DOCUMENTS_DIR="/run/media/mybackupdrive/documents"
To disable a certain directory point it to the home directory:
XDG_DESKTOP_DIR="$HOME"
For those who prefer a CLI tool, XDG provides xdg-user-dirs:
xdg-user-dirs
Relocate VIDEOS:
xdg-user-dirs-update --set VIDEOS /media/bkdrive/myvideos
Query current location for VIDEOS:
xdg-user-dir VIDEOS /media/bkdrive/myvideos
Note:
After configuring user-dirs.dirs, if some User Dirs are on drives that are not accessible at startup you might want to disable /etc/xdg/user-dirs.conf (if present on your system), i.e. edit the enabled line to read:
user-dirs.dirs
/etc/xdg/user-dirs.conf
enabled
enabled=False
see this discussion for more details.
如何设置Gnome使用自定义文件夹作为桌面文件夹
问题介绍
重装系统后发现系统使用的是
home
作为桌面文件夹,这也太危险了,这可不是软连接,删掉了可真删掉了!所以查询如何处理。造成原因
一个桌面环境的配置文件被改动了。
解决方案
Short answer:
Long answer:
How to disable/relocate the User Directories (Desktop, Pictures, Documents etc) ?
On a freedesktop compliant DE this is done via the XDG user directories configuration file, namely
$(XDG_CONFIG_HOME)/user-dirs.dirs
:If not set or empty,
XDG_CONFIG_HOME
defaults to~/.config
so, for most users, the file in question is~/.config/user-dirs.dirs
.Applications read this file to find those directories. The file consists of
key=value
pairs, one per line.The default locations are:
To relocate a certain directory edit the config file and replace the current value with the location of your choice, e.g.
To disable a certain directory point it to the home directory:
For those who prefer a CLI tool, XDG provides
xdg-user-dirs
:Relocate VIDEOS:
Query current location for VIDEOS:
Note:
After configuring
user-dirs.dirs
, if some User Dirs are on drives that are not accessible at startup you might want to disable/etc/xdg/user-dirs.conf
(if present on your system), i.e. edit theenabled
line to read:see this discussion for more details.
参考链接