栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

自定义Centos7 Gnome桌面 文件资源管理器侧边栏

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

自定义Centos7 Gnome桌面 文件资源管理器侧边栏

如何自定义Centos7默认资源管理器侧边栏

最近新安装了一个Centos7系统,打开文件资源管理器后发现侧边栏好多无用的书签,而且只能rename重命名不能remove删除,这让强迫症的我根本忍不下去,经过一番调查终于解决了这个问题,记录一下。

首先在网络上搜索到的方法如下:
编辑用户目录下的user-dirs.dirs 文档,命令如下:

vim ~/.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"

网络上的教程是删除你不想要的文件夹所对应的命令。例如如果我只想留下Desktop桌面和Download下载两个目录,则将其余的命令全部删除。修改后的内容和效果如下:

# 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"

可见这样修改以后的确可以修改侧边栏,但是经过我的实践,在reboot重新启动以后文件资源管理器的侧边栏还会变为默认状态,我们在回过头来仔细读一下文档头的内容:大概的意思是,这个文件是由xdg软件自动生成的,你修改的内容只能保存到xdg软件下一次运行之前。也就是说reboot重启以后xdg重新运行后这个文档就会被覆盖,你修改的内容也自然被覆盖掉了。

# 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的默认配置文档,命令如下:

vim /etc/xdg/user-dirs.defaults

用户在登陆时便会读取该文件中的内容来配置,所以将文档中的内容修改为我想要的文件夹即可。

# 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
PICTURES=Pictures
# Another alternative is:
#MUSIC=documents/Music
#PICTURES=documents/Pictures
#VIDEOS=documents/Videos

至此就是我完整解决文件资源管理器的侧边栏编辑问题的过程,希望对大家有所帮助。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/599924.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号