当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 2 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : [问题]如何为LCD显示器设置关闭显示屏快捷键?
帖子发表于 : 2007-07-21 9:20 
头像

注册: 2007-05-15 10:30
帖子: 106
地址: Ubuntu
送出感谢: 0 次
接收感谢: 0 次
刚才在论坛中看了“goodluck1982的[问题-已解决] 笔记本无法调解亮度!”帖子,突然灵光一闪,能不能用定义屏幕变亮变暗快捷键的方式给自己的机器定义 关闭显示器 的快捷键,以保护娇贵的LCD。
以前在win下,使用的是一款叫做closeLCD的软件,不知道能不能成功,希望大家广提线索!


_________________
:::爱上ubuntu 享受写意人生:::
Free 自由免费
Cool 绚丽的3D桌面特效,全面的系统用户定制
Perfect 10 完善的系统更新,软件管理机制
Amazing 完美的中文支持


页首
 用户资料  
 
2 楼 
 文章标题 :
帖子发表于 : 2007-07-28 9:48 
头像

注册: 2007-05-15 10:30
帖子: 106
地址: Ubuntu
送出感谢: 0 次
接收感谢: 0 次
通过casio1374633的帖子,有了一些眉目:
http://forum.ubuntu.org.cn/ptopic53634. ... 1d04709337

但是能力有限,看不懂代码,如果有高手能看的懂,请指点一二,我想实现Fn+F9或Alt+F9来实现关屏的功能。

以下一些文件同实现该功能有相关性:

/etc/acpi/screenblank.sh

代码:
#!/bin/bash

. /etc/default/acpi-support
. /usr/share/acpi-support/power-funcs

for x in /tmp/.X11-unix/*; do
    displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
    getXuser;
    if [ x"$XAUTHORITY" != x"" ]; then
        export DISPLAY=":$displaynum"
   . /usr/share/acpi-support/screenblank
    fi
done


. /etc/default/acpi-support


代码:
# Comment the next line to disable ACPI suspend to RAM
ACPI_SLEEP=true

# Comment the next line to disable suspend to disk
ACPI_HIBERNATE=true

# Change the following to "standby" to use ACPI S1 sleep, rather than S3.
# This will save less power, but may work on more machines
ACPI_SLEEP_MODE=mem

# Add modules to this list to have them removed before suspend and reloaded
# on resume. An example would be MODULES="em8300 yenta_socket"
#
# Note that network cards and USB controllers will automatically be unloaded
# unless they're listed in MODULES_WHITELIST
MODULES=""

# Add modules to this list to leave them in the kernel over suspend/resume
MODULES_WHITELIST=""

# Should we save and restore state using the VESA BIOS Extensions?
SAVE_VBE_STATE=true

# The file that we use to save the vbestate
VBESTATE=/var/lib/acpi-support/vbestate

# Should we attempt to warm-boot the video hardware on resume?
POST_VIDEO=true

# Save and restore video state?
# SAVE_VIDEO_PCI_STATE=true

# Should we switch the screen off with DPMS on suspend?
USE_DPMS=true

# Use Radeontool to switch the screen off? Seems to be needed on some machines
# RADEON_LIGHT=true

# Uncomment the next line to switch away from X and back again after resume.
# This is needed for some hardware, but should be unnecessary on most.
# DOUBLE_CONSOLE_SWITCH=true

# Set the following to "platform" if you want to use ACPI to shut down
# your machine on hibernation
HIBERNATE_MODE=shutdown

# Comment this out to disable screen locking on resume
LOCK_SCREEN=true

# Uncomment this line to have DMA disabled before suspend and reenabled
# afterwards
# DISABLE_DMA=true

# Uncomment this line to attempt to reset the drive on resume. This seems
# to be needed for some Sonys
# RESET_DRIVE=true

# Add services to this list to stop them before suspend and restart them in
# the resume process.
STOP_SERVICES="mysql "

# Restart Infra Red services on resume - off by default as it crashes some
# machines
RESTART_IRDA=false

# Switch to laptop-mode on battery power - off by default as it causes odd
# hangs on some machines
ENABLE_LAPTOP_MODE=false


. /usr/share/acpi-support/power-funcs

代码:
# a micro library of helper functions for the power scripts

umask 022;

PATH="$PATH:/usr/bin/X11"
POWERSTATE="/var/lib/acpi-support/powerstate"

getXuser() {
        user=`finger| grep -m1 ":$displaynum " | awk '{print $1}'`
   if [ x"$user" = x"" ]; then
      user=`finger| grep -m1 ":$displaynum" | awk '{print $1}'`
   fi
   if [ x"$user" != x"" ]; then
           userhome=`getent passwd $user | cut -d: -f6`
           export XAUTHORITY=$userhome/.Xauthority
   else
      export XAUTHORITY=""
   fi
}

getXconsole() {
   console=`fgconsole`;
   displaynum=`ps ax | grep -e 'X .* vt'$console | grep -v grep | sed -re 's!.*/X .*:([0-9]+).*!\1!'`
   if [ x"$displaynum" != x"" ]; then
      export DISPLAY=":$displaynum"   
      getXuser
   fi
}

getState() {
        /usr/bin/on_ac_power;
        if [ "$?" -eq 0 ]; then
                STATE="AC";
        elif [ "$?" -eq 1 ]; then
                STATE="BATTERY";
        fi
}
       
#check our state has actually changed
checkStateChanged() {
# do we have our state stashed?
        if [ -f "$POWERSTATE" ]; then
                OLDSTATE=$(<$POWERSTATE)
                if [ "$STATE" = "$OLDSTATE" ]; then
                       exit 0
                else
#stash the new state
                        echo "$STATE" > $POWERSTATE
                fi
        else
#we need to stash the new state
                echo "$STATE" > $POWERSTATE
        fi
}

LAPTOP_MODE='/usr/sbin/laptop_mode'
HDPARM='/sbin/hdparm -q'

LIDSTATE='/var/lib/acpi-support/lidstate'


_________________
:::爱上ubuntu 享受写意人生:::
Free 自由免费
Cool 绚丽的3D桌面特效,全面的系统用户定制
Perfect 10 完善的系统更新,软件管理机制
Amazing 完美的中文支持


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 2 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 5 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译