Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1738807
  • 博文数量: 410
  • 博客积分: 9563
  • 博客等级: 中将
  • 技术积分: 4517
  • 用 户 组: 普通用户
  • 注册时间: 2010-07-03 19:59
个人简介

文章分类

全部博文(410)

文章存档

2017年(6)

2016年(1)

2015年(3)

2014年(4)

2013年(32)

2012年(45)

2011年(179)

2010年(140)

分类: LINUX

2011-03-12 11:22:32

首先写一段shell脚本,用于检查gmail的邮箱
  1. #!/bin/bash
  2. #===============================================================================
  3. #
  4. # FILE: gmail.sh
  5. #
  6. # USAGE: ./gmail.sh
  7. #
  8. # DESCRIPTION: 检查gmail,输出到xmobar
  9. # a script that show how many new mails you got
  10. # to use it in xmobar add this
  11. # Run Com "sh" ["/path/to/mail.sh"] "mail" 300
  12. #
  13. # AUTHOR: BaiLiang , bailiangcn@gmail.com
  14. # COMPANY: DQYTV
  15. # VERSION: 1.0
  16. # CREATED: 2011-03-12 09:31:27
  17. # Last Change: 2011年03月13日 21时49分35秒
  18. # REVISION: ---
  19. #===============================================================================

  20. gmail_login=""
  21. gmail_password=""


  22. dane="$(wget --secure-protocol=auto --timeout=10 -t 3 -q -O - \
  23.        --user=${gmail_login} --password=${gmail_password} \
  24.     --no-check-certificate \
  25.    | grep 'fullcount' \
  26.    | sed -e 's/.*//;s/<\/fullcount>.*//' 2>/dev/null)"

  27. if [ -z "${dane}" ]; then
  28.     echo "";
  29. else
  30.     if [ "${dane}" -gt "0" ]; then
  31.         echo " ${dane}封新邮件 ";
  32.     else
  33.         echo "0";
  34.     fi
  35. fi


再在~/.xmobarrc中增加一句
  1. Config { font = "xft:WenQuanYi Zen Hei-10"
  2.     , bgColor = "black"
  3.     , fgColor = "grey"
  4.     , position = TopW L 100
  5.     , lowerOnStart = True
  6.     , commands = [
  7.               Run Network "eth0" ["-L","0","-H","32","--normal","green","--high","red"] 10
  8.             , Run Cpu ["-L","3","-H","50","--normal","green","--high","red"] 10
  9.             , Run Memory ["-t","Mem: %"] 10
  10.             , Run Com "sh" ["/home/bl/bin/gmail.sh"] "mail" 300
  11.             , Run Swap [] 10
  12.             , Run Date "%Y年%m月%d日 %H:%M:%S" "date" 10
  13.             , Run StdinReader
  14.         ]
  15.     , sepChar = "%"
  16.     , alignSep = "}{"
  17.     , template = "%StdinReader% }{ %cpu% %memory% %swap% %eth0% %mail% %date%            "
  18. }



阅读(1781) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~