告訴 mplayer 防止螢幕保護程序在播放時啟動
我知道 mplayer 有一些心跳設置,但我不記得它是什麼,誰能告訴我?
另一件令人討厭的事情曾經只是工作並且沿線某處不再是預設的
mplayer``-heartbeat-cmd
有每 30 秒執行一次命令的開關,但正如手冊頁所說:這可能被“濫用”以禁用不支持正確 X API 的螢幕保護程序
用於禁用螢幕保護程序的實際開關是
-stop-xscreensaver
; 你應該先試試
mplayer -stop-xscreensaver
對我不起作用(Debian wheezy; xscreensaver=5.15-3, xfce4=4.8.0.3, mplayer=2:1.0~rc4.dfsg1+svn34540-1+b2) - 螢幕保護程序在電影中仍然打開。我寫了一個屏保抑制工具xscreensaver-inhibit
和一個 mplayer 包裝器play
。xscreensaver-inhibit
對 youtube 等其他東西很有用,所以我在面板上放了一個快捷方式。
$HOME/bin/xscreensaver-inhibit
如下:#!/bin/bash usage () { echo "usage: $0 [on|off]" echo ' Turns screensaver inhibition on or off.' echo ' default: toggle on/off' exit 1; } if [ -n "$1" ] ; then [ "$1" = "on" -o "$1" = "off" ] || usage fi inhibit () { while [ -f "$lock" ] ; do # echo "$lock exists" # UPDATE Dec 2018 this command seems to have stopped working after upgrading to Debian Stretch. # DISPLAY=:0 xdg-screensaver reset # Replaced with this command which is working for me, # though if you do not use xscreensaver you might need something else. DISPLAY=:0 xscreensaver-command -deactivate sleep 50 done # echo "$lock is gone" } lock="/tmp/xsi.lock" if [ -e "$lock" ] ; then echo 'Screensaver currently inhibited.' on='on' else echo 'Screensaver operating normally.' on='' fi if [ "$1" = "on" ] ; then if [ -n "$on" ] ; then echo 'Starting screensaver inhibitor anyway.' else echo 'Screensaver inhibitor started.' fi touch "$lock" && inhibit & fi if [ "$1" = "off" ] ; then if [ -n "$on" ] ; then echo 'Screensaver inhibitor(s) stopped.' else echo 'Perhaps the screensaver daemon is not running or another program is inhibiting it.' fi rm -f "$lock" fi if [ ! -n "$1" ] ; then if [ -n "$on" ] ; then echo 'Screensaver inhibitor(s) stopped.' rm -f "$lock" else echo 'Screensaver inhibitor started.' touch "$lock" && inhibit & fi fi
$HOME/bin/play
如下:#!/bin/sh xscreensaver-inhibit on DISPLAY=:0 mplayer -fs "$@" xscreensaver-inhibit off
我包括在內
DISPLAY=:0
,因此即使我通過 SSH 登錄,電影也會在本地活動顯示器上播放。play
也是我的文件管理器中所有電影文件的預設處理程序。請注意,
sox
如果/usr/bin/play
您已sox
安裝,則可能需要呼叫play
其他內容。您可以為您不希望螢幕保護程序中斷的其他全屏應用程序編寫類似的包裝器。
xscreensaver-inhibit
適用於我嘗試過的所有 DE、Linux 和螢幕保護程序。如果你得到xdg-screensaver: command not found
,執行apt-get install xdg-utils
。2018 年 12 月更新將主命令
xscreensaver-inhibit
從更改xdg-screensaver
為xscreensaver-command
- 未在所有 DE、Linux、螢幕保護程序上進行測試。YMMV