如何自定义Centos7默认资源管理器侧边栏
最近新安装了一个Centos7系统,打开文件资源管理器后发现侧边栏好多无用的书签,而且只能rename重命名不能remove删除,这让强迫症的我根本忍不下去。
经过一番调研,终于找到了修改侧边栏快捷访问列表的方法。
1、首先修改用户目录下的配置文件
vim ~/.config/user-dirs.dirs
2、按照个人喜好将不想要的文件夹所对应的命令注释掉,再保存退出
文件内容如下,
我这里注释掉了除Download和Desktop外的其他文件夹
# 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"
source一下立即生效,再打开文件资源管理器,原本侧边栏中不可编辑的书签就变成了普通文件夹书签,可以remove掉了。
source ~/.config/user-dirs.dirs
如图所示,source之后刚刚注释掉的文件夹可以remove掉了
目前已经可以实现自定义侧边栏,但是在计算机重新启动之后,侧边栏还会恢复到默认状态,那么我们就必须修改系统的默认设置。
仔细读一下刚刚配置文档的表头:
# 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默认配置文件中的内容来生成xdg文档以配置侧边栏。
我们只要将文档中的内容修改为自己想要的文件夹就行了。
3、我们从源头入手,让xdg初始化时便不创建我不想要的文件夹。
打开xdg的默认配置文档,命令如下:(需要su权限)
vim /etc/xdg/user-dirs.defaults
例如我个人习惯仅使用DESKTOP和DOWNLOAD,则只保留这两项。
# Default settings for user directories
#
# The values are relative pathnames from the home directory and
# will be translated on a per-path-element basis into the users locale
DESKTOP=Desktop
DOWNLOAD=Downloads
# Another alternative is:
#MUSIC=Documents/Music
#PICTURES=Documents/Pictures
#VIDEOS=Documents/Videos
以上过程均为删除,同理也可以按照自己的需求在侧边栏中添加不能remove的其他文件夹
参照原文件格式照葫芦画瓢就行
保存后重启,侧边栏就可以变成自己想要的样子了。
点个赞支持一下吧亲!