ubuntu命令 图片 壁纸_[教程]Ubuntu下完整配置自动壁纸切换

来源:http://www.linuxidc.com/Linux/2016-09/135350.html

更原始的来源就不去找了,如果有找到的同学可以回复我我到时改过来www

来源的教程是有效的,但是打脚本的过程有点麻烦并且本身有点小错误(不知道是我看错了还是怎样),这里整理一下发上来

第一步:将壁纸拖入/usr/share/backgrounds/文件夹内

你可以选择删除原先自带的系统壁纸,并将其换为自己的壁纸。

想方便配置的话,在终端中使用命令:

sudo nautilus

来打开管理员权限下的文件管理器,将自己盘里的壁纸拖到这个文件夹里面~

第二步:用bash脚本生成mywallpapers.xml

可以使用vim,emacs,gedit等编辑器进行配置。

你需要将如下代码命名为script.sh并存入任意一个位置。

files=`ls -u /usr/share/backgrounds | grep -v contest`

last_file='empty'

echo ''

echo ''

echo '2017'

echo '9'

echo '11'

echo '00'

echo '00'

echo '00'

echo ''

for current_file in$filesdo

if [ "$last_file" = "empty" ]; thenlast_file=$current_file

first_file=$last_fileecho ''

echo '600.0'

echo "/usr/share/backgrounds/$last_file"

echo ''

else

echo ''

echo '3.0'

echo "/usr/share/backgrounds/$last_file"

echo "/usr/share/backgrounds/$current_file"

echo ''

echo ''

echo '600.0'

echo "/usr/share/backgrounds/$current_file"

echo ''last_file=$current_filefi

done

echo ''

echo '3.0'

echo "/usr/share/backgrounds/$last_file"

echo "/usr/share/backgrounds/$first_file"

echo ''

echo ''

两个transition里的duration是指过渡时所用的时间,两个static里的duration则是指每张壁纸的播放时间,以秒为单位。上方的过渡时间默认为3秒,播放时间为10分钟,可以根据自己喜好更改。

接着使用如下命令生成xml文件:

sh script.sh > mywallpapers.xml

将生成好的文件移动到/usr/share/backgrounds/contest/目录中。

sudo mv mywallpapers.xml /usr/share/backgrounds/contest

第三步:编辑/usr/share/gnome-background-properties/xenial-wallpapers.xml

不同版本下文件名可能会有不同,所以(一般)请选择文件夹下文件名不带ubuntu的那个。这里是16.04版本下的情况。

使用编辑器打开该文件(记得加上sudo),这里以gedit为例,你也可以使用vim或emacs:

sudo gedit /usr/share/gnome-background-properties/xenial-wallpapers.xml

对该文件进行如下的编辑:

Ubuntu 16.04 Community Wallpapers

/usr/share/backgrounds/contest/xenial.xml

zoom

//从这里开始插入

My Wallpapers

/usr/share/backgrounds/contest/mywallpapers.xml

zoom

//到这里结束

...

//下面不要动

保存,退出。

第四步:更改桌面壁纸。

回到桌面,右键,选择更改桌面背景:

在右侧的选项栏中,选择“壁纸”一栏,你会发现这一栏下面有两种壁纸——

当然是选择名为My Wallpapers的那个。

大功告成。

实现的原理和细节可以参考一开始的来源。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值