嗨,我想運行這個腳本,當我打電話給腳本關閉屏幕。如何使用xset關閉屏幕?
Script代碼:
#!/bin/sh
STATUS=`xset -q | grep "Monitor is" | awk '{print $3}'`
if [ "${STATUS}" = "On" ]
then
xset dpms force off
else
xset dpms force on
fi
exit 0
但是,當我調用腳本,我收到此錯誤
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 142 (DPMS)
Minor opcode of failed request: 6 (DPMSForceLevel)
Serial number of failed request: 10
Current serial number in output stream: 12
這看起來不像一個編程問題(你是寫這個腳本還是隻是從某處抓取它?),但更像是一個X服務器配置問題。您是否真的*看過* xset q'輸出以查看DPMS是否存在? –
試試這個:xset + dpms –
參見http://unix.stackexchange.com/questions/316929/display-is-not-capable-of-dpms-after-gnome-wayland-update – paulie4