欢迎光临
我们一直在努力

Shiftwallpaper.sh 每隔数秒更换墙纸的脚本

容器云强势上线!快速搭建集群,上万Linux镜像随意使用

Linux下的一个脚本:Shiftwallpaper.sh ,功能是:每隔数秒更换墙纸的脚本,时间(默认120秒)你可以自己在下边的代码中设置。

Copy to ClipboardLiehuo.Net Codes引用的内容:[www.veryhuo.com]
#!/usr/bin/env bash
# shiftwallpaper.sh
# A very simple bash script to shift wallpaper every n seconds.
# Turns your desktop in a kind of digital frame 🙂
# Tested in and for Fluxbox [TM].
# Public Domain Code. No Warranty at all.
# ksaver, July 2011.

# Modify this line to you own wallpapers directory.
WALLPAPER_DIR=”$HOME/MyPictures/Wallpaper”

# Set interval in seconds to shift wallpaper.
WAIT=120

function load_wallpapers()
{
# Load the wallpaper list into an array
# loads new wallpapers added to directory in runtime.
n=0
for wallpaper in “$1/*”; do
wallpaper_list[n]=$wallpaper
let n=$n+1
done
}

function rotate_wallpapers()
{
# Rotate wallpaper every n seconds.
for wallpaper in ${wallpaper_list[@]}; do
/usr/bin/env fbsetbg -F $wallpaper
sleep $1
done
}

## main()
while [ True ]; do
load_wallpapers $WALLPAPER_DIR
rotate_wallpapers $WAIT
done

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » Shiftwallpaper.sh 每隔数秒更换墙纸的脚本
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址