aijuntao
deepin
2020-09-25 06:59 - #!/bin/bash
- # 壁纸目录
- dir=/etc/skel/Pictures/Wallpapers
- # 壁纸文件个数
- count=`ls $dir | wc -w`
- echo $count
- # 生成小于壁纸个数的随机数
- ssj=$((RANDOM % $count))
- echo $ssj
- idx=-1
- # 遍历壁纸目录,设置第 随机数 个文件作为壁纸
- for i in $dir/*; do
- let idx++
- if [ $idx -eq $ssj ]
- then
- dbus-send --dest=com.deepin.daemon.Appearance /com/deepin/daemon/Appearance --print-reply com.deepin.daemon.Appearance.SetMonitorBackground string:"eDP-1" string:"file://${i}"
- exit
- fi
- done
Reply Like 0 Favorite View the author


中文 