专注各种脚本编程
Baidu
加入收藏夹
本站内容有下面分类知识,欢迎您的到来^_^
shell相关:指令篇 基础篇 脚本欣赏 编程实例 shell问问 shell视频教程 技巧篇 水平测试 E文资料 vi编辑器 高级Bash脚本编程指南
其他:mysql perl c语言 oracle
当前位置:| 主页>shell脚本欣赏>

使xscreensaver(屏幕保护程序)暂时失去功能的shell脚本

百度收藏 QQ搜藏

    XScreenSaver是在X-windows下一个标准的屏幕保护和锁定软件,具有高可配置性,内含超过100个显示模式。但是当我们在X-windows下运行游戏时,不想让XScreenSaver老是跳出来干扰,于是写了这个shell脚本。
   它可以在运行一个特定的命令时暂时使xscreensaver失去功能,即在此期间用kill命令杀死xscreensaver的进程,直到相关命令停止运行。

该shell脚本(run-without-xscreensaver.sh)的代码如下:

#!/bin/sh
# http://hektor.umcs.lublin.pl/~mikosmul/computing/shell-scripts/run-without-xscreensaver
# Written by Michal Kosmulski <mkosmul _at_ users _dot_ sourceforge _dot_ net>
# This script is hereby put in the public domain.
#
# Run the program specified on the command line, disabling xscreensaver for the
# time that program is running (useful for games)
if [ $# -lt 1 ]; then
 echo "Usage: $0 command [command-parameters]"
 exit
fi
( while true; do xscreensaver-command -deactivate &>/dev/null; sleep 30; done ) &
pid="$!"
eval "$@"
kill "$pid"

上一篇:加密文本成二进制内容的shell脚本 下一篇:解码二进制字符串成ASCII文本的shell脚本

power by soyo123 2007-2008