哪些命令会改变屏幕的亮度?


13

我正在尝试重新绑定一些功能键,因为我从未将它们用于多媒体目的,但是我不确定要增加/降低亮度需要使用什么命令,我在说尝试创建自己的自定义快捷方式后,以下命令的要求:

在此处输入图片说明

是否有标准端子command可降低亮度(并增加亮度)?理想情况下是设定的百分比(例如10%),或者是我需要从硬件中找出的设定值减小量。

作为额外的信息,我已经可以通过分别按Fn+ F7Fn+ F8来减小和增大来控制亮度,但是我希望能够简单地按F7F8更简单。如果它有任何更改,我还将Ubuntu 12.04与Unity一起使用。

根据以下iSeth的要求,输出xmodmap -pke | less((键码66-77是功能按钮),很抱歉,终端输出的墙很长):

keycode   8 =
keycode   9 = Escape NoSymbol Escape
keycode  10 = 1 exclam 1 exclam onesuperior exclamdown onesuperior
keycode  11 = 2 quotedbl 2 quotedbl twosuperior oneeighth twosuperior
keycode  12 = 3 sterling 3 sterling threesuperior sterling threesuperior
keycode  13 = 4 dollar 4 dollar EuroSign onequarter EuroSign
keycode  14 = 5 percent 5 percent onehalf threeeighths onehalf
keycode  15 = 6 asciicircum 6 asciicircum threequarters fiveeighths threequarters
keycode  16 = 7 ampersand 7 ampersand braceleft seveneighths braceleft
keycode  17 = 8 asterisk 8 asterisk bracketleft trademark bracketleft
keycode  18 = 9 parenleft 9 parenleft bracketright plusminus bracketright
keycode  19 = 0 parenright 0 parenright braceright degree braceright
keycode  20 = minus underscore minus underscore backslash questiondown backslash
keycode  21 = equal plus equal plus dead_cedilla dead_ogonek dead_cedilla
keycode  22 = BackSpace BackSpace BackSpace BackSpace
keycode  23 = Tab ISO_Left_Tab Tab ISO_Left_Tab
keycode  24 = q Q q Q at Greek_OMEGA at
keycode  25 = w W w W lstroke Lstroke lstroke
keycode  26 = e E e E e E e
keycode  27 = r R r R paragraph registered paragraph
keycode  28 = t T t T tslash Tslash tslash
keycode  29 = y Y y Y leftarrow yen leftarrow
keycode  30 = u U u U downarrow uparrow downarrow
keycode  31 = i I i I rightarrow idotless rightarrow
keycode  32 = o O o O oslash Oslash oslash
keycode  33 = p P p P thorn THORN thorn
keycode  34 = bracketleft braceleft bracketleft braceleft dead_diaeresis dead_abovering dead_diaeresis
keycode  35 = bracketright braceright bracketright braceright dead_tilde dead_macron dead_tilde
keycode  36 = Return NoSymbol Return
keycode  37 = Control_L NoSymbol Control_L
keycode  38 = a A a A ae AE ae
keycode  39 = s S s S ssharp section ssharp
keycode  40 = d D d D eth ETH eth
keycode  41 = f F f F dstroke ordfeminine dstroke
keycode  42 = g G g G eng ENG eng
keycode  43 = h H h H hstroke Hstroke hstroke
keycode  44 = j J j J dead_hook dead_horn dead_hook
keycode  45 = k K k K kra ampersand kra
keycode  46 = l L l L lstroke Lstroke lstroke
keycode  47 = semicolon colon semicolon colon dead_acute dead_doubleacute dead_acute
keycode  48 = apostrophe at apostrophe at dead_circumflex dead_caron dead_circumflex
keycode  49 = grave notsign grave notsign bar bar bar
keycode  50 = Shift_L NoSymbol Shift_L
keycode  51 = numbersign asciitilde numbersign asciitilde dead_grave dead_brevedead_grave
keycode  52 = z Z z Z guillemotleft less guillemotleft
keycode  53 = x X x X guillemotright greater guillemotright
keycode  54 = c C c C cent copyright cent
keycode  55 = v V v V leftdoublequotemark leftsinglequotemark leftdoublequotemark
keycode  56 = b B b B rightdoublequotemark rightsinglequotemark rightdoublequotemark
keycode  57 = n N n N n N n
keycode  58 = m M m M mu masculine mu
keycode  59 = comma less comma less horizconnector multiply horizconnector
keycode  60 = period greater period greater periodcentered division periodcentered
keycode  61 = slash question slash question dead_belowdot dead_abovedot dead_belowdot
keycode  62 = Shift_R NoSymbol Shift_R
keycode  63 = KP_Multiply KP_Multiply KP_Multiply KP_Multiply KP_Multiply KP_Multiply XF86ClearGrab
keycode  64 = Alt_L Meta_L Alt_L Meta_L
keycode  65 = space NoSymbol space
keycode  66 = Caps_Lock NoSymbol Caps_Lock
keycode  67 = F1 F1 F1 F1 F1 F1 XF86Switch_VT_1
keycode  68 = F2 F2 F2 F2 F2 F2 XF86Switch_VT_2
keycode  69 = F3 F3 F3 F3 F3 F3 XF86Switch_VT_3
keycode  70 = F4 F4 F4 F4 F4 F4 XF86Switch_VT_4
keycode  71 = F5 F5 F5 F5 F5 F5 XF86Switch_VT_5
keycode  72 = F6 F6 F6 F6 F6 F6 XF86Switch_VT_6
keycode  73 = F7 F7 F7 F7 F7 F7 XF86Switch_VT_7
keycode  74 = F8 F8 F8 F8 F8 F8 XF86Switch_VT_8
keycode  75 = F9 F9 F9 F9 F9 F9 XF86Switch_VT_9
keycode  76 = F10 F10 F10 F10 F10 F10 XF86Switch_VT_10
keycode  77 = Num_Lock NoSymbol Num_Lock
keycode  78 = Scroll_Lock NoSymbol Scroll_Lock
keycode  79 = KP_Home KP_7 KP_Home KP_7
keycode  80 = KP_Up KP_8 KP_Up KP_8
keycode  81 = KP_Prior KP_9 KP_Prior KP_9
keycode  82 = KP_Subtract KP_Subtract KP_Subtract KP_Subtract KP_Subtract KP_Subtract XF86Prev_VMode
keycode  83 = KP_Left KP_4 KP_Left KP_4
keycode  84 = KP_Begin KP_5 KP_Begin KP_5
keycode  85 = KP_Right KP_6 KP_Right KP_6
keycode  86 = KP_Add KP_Add KP_Add KP_Add KP_Add KP_Add XF86Next_VMode
keycode  87 = KP_End KP_1 KP_End KP_1
keycode  88 = KP_Down KP_2 KP_Down KP_2
keycode  89 = KP_Next KP_3 KP_Next KP_3
keycode  90 = KP_Insert KP_0 KP_Insert KP_0
keycode  91 = KP_Delete KP_Decimal KP_Delete KP_Decimal
keycode  92 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift
keycode  93 =
keycode  94 = backslash bar backslash bar bar brokenbar bar
keycode  95 = F11 F11 F11 F11 F11 F11 XF86Switch_VT_11
keycode  96 = F12 F12 F12 F12 F12 F12 XF86Switch_VT_12
keycode  97 =
keycode  98 = Katakana NoSymbol Katakana
keycode  99 = Hiragana NoSymbol Hiragana
keycode 100 = Henkan_Mode NoSymbol Henkan_Mode
keycode 101 = Hiragana_Katakana NoSymbol Hiragana_Katakana
keycode 102 = Muhenkan NoSymbol Muhenkan
keycode 103 =
keycode 104 = KP_Enter NoSymbol KP_Enter
keycode 105 = Control_R NoSymbol Control_R
keycode 106 = KP_Divide KP_Divide KP_Divide KP_Divide KP_Divide KP_Divide XF86Ungrab
keycode 107 = Print Sys_Req Print Sys_Req
keycode 108 = ISO_Level3_Shift Multi_key ISO_Level3_Shift Multi_key
keycode 109 = Linefeed NoSymbol Linefeed
keycode 110 = Home NoSymbol Home
keycode 111 = Up NoSymbol Up
keycode 112 = Prior NoSymbol Prior
keycode 113 = Left NoSymbol Left
keycode 114 = Right NoSymbol Right
keycode 115 = End NoSymbol End
keycode 116 = Down NoSymbol Down
keycode 117 = Next NoSymbol Next
keycode 118 = Insert NoSymbol Insert
keycode 119 = Delete NoSymbol Delete
keycode 120 =
keycode 121 = XF86AudioMute NoSymbol XF86AudioMute
keycode 122 = XF86AudioLowerVolume NoSymbol XF86AudioLowerVolume
keycode 123 = XF86AudioRaiseVolume NoSymbol XF86AudioRaiseVolume
keycode 124 = XF86PowerOff NoSymbol XF86PowerOff
keycode 125 = KP_Equal NoSymbol KP_Equal
keycode 126 = plusminus NoSymbol plusminus
keycode 127 = Pause Break Pause Break
keycode 128 = XF86LaunchA NoSymbol XF86LaunchA
keycode 129 = KP_Decimal KP_Decimal KP_Decimal KP_Decimal
keycode 130 = Hangul NoSymbol Hangul
keycode 131 = Hangul_Hanja NoSymbol Hangul_Hanja
keycode 132 =
keycode 133 = Super_L NoSymbol Super_L
keycode 134 = Super_R NoSymbol Super_R
keycode 135 = Menu NoSymbol Menu
keycode 136 = Cancel NoSymbol Cancel
keycode 137 = Redo NoSymbol Redo
keycode 138 = SunProps NoSymbol SunProps
keycode 139 = Undo NoSymbol Undo
keycode 140 = SunFront NoSymbol SunFront
keycode 141 = XF86Copy NoSymbol XF86Copy
keycode 142 = SunOpen NoSymbol SunOpen
keycode 143 = XF86Paste NoSymbol XF86Paste
keycode 144 = Find NoSymbol Find
keycode 145 = XF86Cut NoSymbol XF86Cut
keycode 146 = Help NoSymbol Help
keycode 147 = XF86MenuKB NoSymbol XF86MenuKB
keycode 148 = XF86Calculator NoSymbol XF86Calculator
keycode 149 =
keycode 150 = XF86Sleep NoSymbol XF86Sleep
keycode 151 = XF86WakeUp NoSymbol XF86WakeUp
keycode 152 = XF86Explorer NoSymbol XF86Explorer
keycode 153 = XF86Send NoSymbol XF86Send
keycode 154 =
keycode 155 = XF86Xfer NoSymbol XF86Xfer
keycode 156 = XF86Launch1 NoSymbol XF86Launch1
keycode 157 = XF86Launch2 NoSymbol XF86Launch2
keycode 158 = XF86WWW NoSymbol XF86WWW
keycode 159 = XF86DOS NoSymbol XF86DOS
keycode 160 = XF86ScreenSaver NoSymbol XF86ScreenSaver
keycode 161 =
keycode 162 = XF86RotateWindows NoSymbol XF86RotateWindows
keycode 163 = XF86Mail NoSymbol XF86Mail
keycode 164 = XF86Favorites NoSymbol XF86Favorites
keycode 165 = XF86MyComputer NoSymbol XF86MyComputer
keycode 166 = XF86Back NoSymbol XF86Back
keycode 167 = XF86Forward NoSymbol XF86Forward
keycode 168 =
keycode 169 = XF86Eject NoSymbol XF86Eject
keycode 170 = XF86Eject XF86Eject XF86Eject XF86Eject
keycode 171 = XF86AudioNext NoSymbol XF86AudioNext
keycode 172 = XF86AudioPlay XF86AudioPause XF86AudioPlay XF86AudioPause
keycode 173 = XF86AudioPrev NoSymbol XF86AudioPrev
keycode 174 = XF86AudioStop XF86Eject XF86AudioStop XF86Eject
keycode 175 = XF86AudioRecord NoSymbol XF86AudioRecord
keycode 176 = XF86AudioRewind NoSymbol XF86AudioRewind
keycode 177 = XF86Phone NoSymbol XF86Phone
keycode 178 =
keycode 179 = XF86Tools NoSymbol XF86Tools
keycode 180 = XF86HomePage NoSymbol XF86HomePage
keycode 181 = XF86Reload NoSymbol XF86Reload
keycode 182 = XF86Close NoSymbol XF86Close
keycode 183 =
keycode 184 =
keycode 185 = XF86ScrollUp NoSymbol XF86ScrollUp
keycode 186 = XF86ScrollDown NoSymbol XF86ScrollDown
keycode 187 = parenleft NoSymbol parenleft
keycode 188 = parenright NoSymbol parenright
keycode 189 = XF86New NoSymbol XF86New
keycode 190 = Redo NoSymbol Redo
keycode 191 = XF86Tools NoSymbol XF86Tools
keycode 192 = XF86Launch5 NoSymbol XF86Launch5
keycode 193 = XF86Launch6 NoSymbol XF86Launch6
keycode 194 = XF86Launch7 NoSymbol XF86Launch7
keycode 195 = XF86Launch8 NoSymbol XF86Launch8
keycode 196 = XF86Launch9 NoSymbol XF86Launch9
keycode 197 =
keycode 198 =
keycode 199 = XF86TouchpadToggle NoSymbol XF86TouchpadToggle
keycode 200 = XF86TouchpadOn NoSymbol XF86TouchpadOn
keycode 201 = XF86TouchpadOff NoSymbol XF86TouchpadOff
keycode 202 =
keycode 203 = Mode_switch NoSymbol Mode_switch
keycode 204 = NoSymbol Alt_L NoSymbol Alt_L
keycode 205 = NoSymbol Meta_L NoSymbol Meta_L
keycode 206 = NoSymbol Super_L NoSymbol Super_L
keycode 207 = NoSymbol Hyper_L NoSymbol Hyper_L
keycode 208 = XF86AudioPlay NoSymbol XF86AudioPlay
keycode 209 = XF86AudioPause NoSymbol XF86AudioPause
keycode 210 = XF86Launch3 NoSymbol XF86Launch3
keycode 211 = XF86Launch4 NoSymbol XF86Launch4
keycode 212 = XF86LaunchB NoSymbol XF86LaunchB
keycode 213 = XF86Suspend NoSymbol XF86Suspend
keycode 214 = XF86Close NoSymbol XF86Close
keycode 215 = XF86AudioPlay NoSymbol XF86AudioPlay
keycode 216 = XF86AudioForward NoSymbol XF86AudioForward
keycode 217 =
keycode 218 = Print NoSymbol Print
keycode 219 =
keycode 220 = XF86WebCam NoSymbol XF86WebCam
keycode 221 =
keycode 222 =
keycode 223 = XF86Mail NoSymbol XF86Mail
keycode 224 = XF86Messenger NoSymbol XF86Messenger
keycode 225 = XF86Search NoSymbol XF86Search
keycode 226 = XF86Go NoSymbol XF86Go
keycode 227 = XF86Finance NoSymbol XF86Finance
keycode 228 = XF86Game NoSymbol XF86Game
keycode 229 = XF86Shop NoSymbol XF86Shop
keycode 230 =
keycode 231 = Cancel NoSymbol Cancel
keycode 232 = XF86MonBrightnessDown NoSymbol XF86MonBrightnessDown
keycode 233 = XF86MonBrightnessUp NoSymbol XF86MonBrightnessUp
keycode 234 = XF86AudioMedia NoSymbol XF86AudioMedia
keycode 235 = XF86Display NoSymbol XF86Display
keycode 236 = XF86KbdLightOnOff NoSymbol XF86KbdLightOnOff
keycode 237 = XF86KbdBrightnessDown NoSymbol XF86KbdBrightnessDown
keycode 238 = XF86KbdBrightnessUp NoSymbol XF86KbdBrightnessUp
keycode 239 = XF86Send NoSymbol XF86Send
keycode 240 = XF86Reply NoSymbol XF86Reply
keycode 241 = XF86MailForward NoSymbol XF86MailForward
keycode 242 = XF86Save NoSymbol XF86Save
keycode 243 = XF86Documents NoSymbol XF86Documents
keycode 244 = XF86Battery NoSymbol XF86Battery
keycode 245 = XF86Bluetooth NoSymbol XF86Bluetooth
keycode 246 = XF86WLAN NoSymbol XF86WLAN
keycode 247 =
keycode 248 =
keycode 249 =
keycode 250 =
keycode 251 =
keycode 252 =
keycode 253 =
keycode 254 =
keycode 255 =

编辑:偶然发现了一个相关问题,并认为“我如何通过终端更改亮度?”的解决方案之一可以与我的笔记本电脑一起使用,但没有,我正在运行HP Pavilion DV6000,但我忘了提一下,我希望能够运行命令而不需要root访问权限。

至于使用xdotool,它会在此处更改规定的亮度:

在此处输入图片说明

但是屏幕保持当前亮度,因此在我的情况下不会影响与亮度相关的硬件。


您可以将输出结果添加xmodmap -pke | less到您的问题中吗:)
Seth 2013年

我不是要打扰您,但您是否尝试过我的解决方案?
赛斯

@Seth随时打扰我,是的,我刚刚尝试过,让我们聊天;)
Oyibo

1
看看/etc/acpi/
Sreevisakh

如果您仍然有兴趣,让我们谈谈。
托蒂

Answers:


13

如果xbacklight失败,并且键盘快捷键(例如:)fn+F4更改了亮度,则以下方法应起作用。

dbus方式

dbus-send --session --print-reply --dest="org.gnome.SettingsDaemon" /org/gnome/SettingsDaemon/Power org.gnome.SettingsDaemon.Power.Screen.SetPercentage uint32:`percentage` 

例如:将亮度设置为30%

dbus-send --session --print-reply --dest="org.gnome.SettingsDaemon" /org/gnome/SettingsDaemon/Power org.gnome.SettingsDaemon.Power.Screen.SetPercentage uint32:30  

如果显示如下,则说明您的操作系统可能太旧了。然后使用xdotool

错误org.freedesktop.DBus.Error.UnknownMethod:接口“ org.gnome.SettingsDaemon.Power.Screen”上具有签名“ u”的方法“ SetPercentage”不存在

xdotool
BrightnessUp:xdotool key XF86MonBrightnessUp
BrightnessDown:xdotool key XF86MonBrightnessDown


1
我真的很想学习dbus的东西,知道有什么很酷的链接可以将我从Google firehose中救出来吗?
Scott Goodgame 2013年

1
为什么不以dbus从何处开始询问
totti

@oyibo:什么dbus
totti

@Usingtotti我得到了dbus的以下输出,这使我认为它在我的情况下不起作用:method return sender=:1.4 -> dest=:1.153 reply_serial=2 uint32 30否则xdotool方法会以统一的方式更改右上栏中指出的亮度级别,但屏幕保持相同的亮度:(
奥义博

dbus和xdotool方法在12.10都可以正常工作。
desgua

9

您可能可以使用xbacklight不需要root权限的工具:

xbacklight +30%        # increases brightness by 30 percent
xbacklight -30%        # decreases brightness by 30 percent

请参阅man xbacklight以获取所有可用选项。当然,如果没有,则xbacklight需要安装它:

sudo apt-get update && sudo apt-get install xbacklight

xbacklight对我没有任何帮助 它可能适用于OP。
塞斯

1
不幸的是,我还是没有为我工作,不过还是谢谢你的建议!
Oyibo

7

您必须使用超级用户特权来执行此操作,在我的系统上,它拒绝授予sudoer 权限,因此我首先su通过运行将用户更改为sudo su,然后执行了这些命令来做到了。

要找出屏幕运行的最大亮度:

cat /sys/class/backlight/acpi_video0/max_brightness

那应该打印7或根据您的情况而定,这是您可以增加亮度的最大级别,现在可以更改亮度运行

echo "5" >> /sys/class/backlight/acpi_video0/brightness

"5"从基本上改变1-7会增加或减少亮度。

注意:对于执行上述命令的“无此文件”或目录的用户,请使用其他可用选项替换acpi_video0。要获取所有可用列表,请尝试以下命令:

ls /sys/class/backlight/

然后通过ls尝试使用echo和cat命令


我得到的第一行不起作用:cat: /sys/class/backlight/acpi_video0/max_brightness: No such file or directory我已经尝试了常规sudosudo su特权。
Oyibo

您可以在中检查确切的视频设备/sys/class/backlight/吗?是从鹦鹉螺还是在终端上双击?
Gufran 2013年

intel_backlight还有什么奇怪的是,那里有最大亮度文件,它说1 ...
Oyibo

是否尝试回显brightness文件中的亮度值?
古弗兰

是这样的:echo /sys/class/backlight/intel_backlight/max_brightness?是的,什么都没发生,还是我做错了什么?
Oyibo

3

测试它

在您的主目录中创建一个名为的文件.xmodmaptouch .xmodmap

然后打开文件以编辑内容: gedit .xmodmap

添加这些行:

!Make the F7 key brightness down
keycode  73 = XF86MonBrightnessDown NoSymbol XF86MonBrightnessDown
!Make the F8 key brightness up  
keycode  74 = XF86MonBrightnessUp NoSymbol XF86MonBrightnessUp  

保存文件然后运行xmodmap .xmodmap。如果按键现在可以完成您想要的操作,请继续。如果没有,请.xmodmap从家里删除文件。

继续

从破折号中打开启动应用程序。点击“添加”。将xmodmap .xmodmap在命令字段。其他字段是可选的,您可以将它们留为空白。再次单击“添加”。这使Xmodmap在启动时运行。

在此处输入图片说明


@Oyibo要尝试的第一件事是(在删除了之前所做的任何更改之后)运行:xmodmap -e "keycode 73 = XF86MonBrightnessDown NoSymbol XF86MonBrightnessDown"并查看是否有任何更改。
赛斯

您用来拍摄该屏幕截图的是什么?
starbeamrainbowlabs

@starbeamrainbowlabs我使用了一个名为shutter的程序。
赛斯

3

有一个亮度指示器,您可以下载http://codevanrohde.nl/wordpress/?p=128。这是我发现可在笔记本电脑上使用的唯一解决方案。有了它,您可以设置热键来控制亮度,使用鼠标滚轮或从指示器的下拉列表中选择。我用“ Win + Alt”代替了“ Fn”,这对我的手来说非常相似,现在我也可以将其与外部键盘一起使用了!

要添加PPA并安装:

sudo add-apt-repository ppa:indicator-brightness/ppa
sudo apt-get update && sudo apt-get install indicator-brightness

热键应分配给:

/opt/extras.ubuntu.com/indicator-brightness/indicator-brightness-adjust --up

/opt/extras.ubuntu.com/indicator-brightness/indicator-brightness-adjust --down
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.