1 Star 0 Fork 265

df270464/python-learn

forked from mktime/python-learn 
Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
screen.sh 1.04 KB
Copy Edit Raw Blame History
mktime authored 2015-11-04 19:37 +08:00 . fix bugs
#!/bin/bash
# date: 2015-11-04 11:03:59
# blog: http://mktime.org
# desc: a simple script to change latop screen's backlight
# usage: ./screen.sh +/-
# I use this script with awesome window manager, just add below two lines into rc.lua
# awful.key({ altkey }, "F5", function() os.execute("/home/demo/bin/screen.sh -") end)
# awful.key({ altkey }, "F6", function() os.execute("/home/demo/bin/screen.sh +") end)
sudo chown $USER:$USER /sys/class/backlight/intel_backlight/brightness
cur_value=`cat /sys/class/backlight/intel_backlight/brightness`
max_value=`cat /sys/class/backlight/intel_backlight/max_brightness`
base=400
if [ "$#" != "1" ]
then
echo "usage: ./screen.sh +/-" && exit 2
fi
if [ "$1" = "+" ]
then
cur_value=`expr $cur_value + $base`
elif [ "$1" = "-" ]
then
cur_value=`expr $cur_value - $base`
else
echo "format error" && exit 3
fi
if [ $cur_value -ge $max_value ]
then
echo "too large" && exit 4
fi
if [ $cur_value -le 0 ]
then
echo "too small" && exit 5
fi
echo $cur_value > /sys/class/backlight/intel_backlight/brightness
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/df270464/python-learn.git
git@gitee.com:df270464/python-learn.git
df270464
python-learn
python-learn
master

Search