问题描述
如何设置对笔记本电脑电源按钮的操作?我尝试使用 awful.key({ },"Power",...
但它不起作用。
解决方法
尝试在终端中运行 xev
并查看它对按键的指示。例如,我的键盘上有一个计算器键,它似乎是 XF86Calculator
:
KeyRelease event,serial 37,synthetic NO,window 0x2400001,root 0x761,subw 0x0,time 179605294,(572,728),root:(2493,769),state 0x10,keycode 148 (keysym 0x1008ff1d,XF86Calculator),same_screen YES,XLookupString gives 0 bytes:
XFilterEvent returns: False
这里有一些关于密钥名称可能是什么的随机猜测:
$ grep -r Power /usr/include/X11
/usr/include/X11/Xtrans/Xtranslcl.c: * Pittsburgh Powercomputing Corporation (PPc)/Quarterdeck Office Systems
/usr/include/X11/XF86keysym.h:#define XF86XK_PowerDown 0x1008FF21 /* Deep sleep the system */
/usr/include/X11/XF86keysym.h:#define XF86XK_PowerOff 0x1008FF2A /* Power off system entirely */
/usr/include/X11/Sunkeysym.h:#define SunXK_PowerSwitch 0x1005FF76
/usr/include/X11/Sunkeysym.h:#define SunXK_PowerSwitchShift 0x1005FF7D