[问题]如何为LCD显示器设置关闭显示屏快捷键?

声卡/显卡/打印机/USB设备等硬件问题(网卡问题请发上面的网卡板块)
回复
头像
soarlin
帖子: 106
注册时间: 2007-05-15 10:30
来自: Ubuntu
送出感谢: 0
接收感谢: 0
联系:

[问题]如何为LCD显示器设置关闭显示屏快捷键?

#1

帖子 soarlin » 2007-07-21 9:20

刚才在论坛中看了“goodluck1982的[问题-已解决] 笔记本无法调解亮度!”帖子,突然灵光一闪,能不能用定义屏幕变亮变暗快捷键的方式给自己的机器定义 关闭显示器 的快捷键,以保护娇贵的LCD。
以前在win下,使用的是一款叫做closeLCD的软件,不知道能不能成功,希望大家广提线索!
:::爱上ubuntu 享受写意人生:::
Free 自由免费
Cool 绚丽的3D桌面特效,全面的系统用户定制
Perfect 10 完善的系统更新,软件管理机制
Amazing 完美的中文支持
头像
soarlin
帖子: 106
注册时间: 2007-05-15 10:30
来自: Ubuntu
送出感谢: 0
接收感谢: 0
联系:

#2

帖子 soarlin » 2007-07-28 9:48

通过casio1374633的帖子,有了一些眉目:
ptopic53634.html&sid=d1affbc975df3b38ee97ab1d04709337

但是能力有限,看不懂代码,如果有高手能看的懂,请指点一二,我想实现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 完美的中文支持
回复

回到 “常用硬件支持”