免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2086 | 回复: 0
打印 上一主题 下一主题

ubuntu自动切换桌面 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-04-20 14:27 |只看该作者 |倒序浏览
ubuntu10.04及以上:当前目录下存储的为背景图片,运行该脚本,产生一个background.xml文件,桌面-》右键-》更改桌面背景-》添加(选择全部文件)-》选择background.xml
写得有点乱,xml格式是按照/usr/share/background/cosmos/background-1.xml来的
  1. #!/bin/bash
  2. #Name:                slide
  3. #Usage:                create a slide for ubuntu background,pictures used by slide
  4. #                        are from current directory
  5. #Author:        xiangxw(xiangxw5689@126.com)

  6. #prepare#{{{
  7. NDEBUG=0        #for debug

  8. if test -e ${PWD##*/}.xml; then
  9.         echo "waring:file ${PWD##*/}.xml will be replaced!"
  10. fi
  11. fileName=$PWD/${PWD##*/}.xml        #use the directory name as the file name
  12. if [ $NDEBUG -eq 0 ]; then
  13.         echo file name:$fileName
  14. fi
  15. #}}}
  16. #head of xml file#{{{
  17. echo -e "<background>\n"\
  18.                         "\t<starttime>\n"\
  19.                                 "\t\t<year>2009</year>\n"\
  20.                                 "\t\t<month>08</month>\n"\
  21.                                 "\t\t<day>04</day>\n"\
  22.                                 "\t\t<hour>00</hour>\n"\
  23.                                 "\t\t<minute>00</minute>\n"\
  24.                                 "\t\t<second>00</second>\n"\
  25.                         "\t</starttime>\n"\
  26.                         "<!-- This animation will start at midnight. -->"\
  27. >"$fileName"
  28. #}}}
  29. #main part of xml file#{{{
  30. ls -1 | awk 'BEGIN{pwd="'"$PWD"'"}/.*\.jpg$/ || /.*\.png$/ {\
  31.         printf "\
  32.                 \t\t<to>%s/%s</to>\n\
  33.                 \t</transition>\n\
  34.                 \t<static>\n\
  35.                         \t\t<duration>1795.0</duration>\n\
  36.                         \t\t<file>%s/%s</file>\n\
  37.                 \t</static>\n\
  38.                 \t<transition>\n\
  39.                 \t\t<duration>5.0</duration>\n\
  40.                 \t\t<from>%s/%s</from>\n\
  41.         ",pwd,$0,pwd,$0,pwd,$0\
  42.         }'>.temp_file_
  43. sed -n '3,$ p' .temp_file_>>"$fileName"
  44. sed -n '1,2 p' .temp_file_>>"$fileName"
  45. rm .temp_file_
  46. echo "</background>">>"$fileName"
  47. #}}}
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP