linux shell(ubuntu18.04.4 LTS) autostart to change the wallpaper

ubuntu18.04.4如何设置开机自动启动屏幕墙纸更换,步骤如下:

首先用python3 编写一个.sh 程序文件,程序文件的路径设为/xxx/change_wallpaper.sh

#!/bin/bash

export DISPLAY=:0
export XAUTHORITY=/home/username/.Xauthority   # change username with your user name
export XDG_RUNTIME_DIR=/run/user/1000

dir=xxx # your wallpaper directory
pcmanfm -w "$(find $dir -type f | shuf -n1)" # random select a picture and set it as desktop wallpaper

 

然后在终端输入命令行,按照自己的设置方式,比如开机自启动后每隔30分钟更换屏幕墙纸.

crontab -e # NOTE:There is a blank space after the "crontab"

在最后一行添加

*/30 * * * * /xxx/change_wallpaper.sh

reboot测试.

 

linux shell(ubuntu18.04.4 LTS) autostart to change the wallpaper

上一篇:PostGreSQL--内存上下文(内存池)


下一篇:Mysql之执行计划