关于整个桌面会话:
有两个流行的applet用于防止睡眠/暂停:Caffeine和Inhibit Applet(内置Cinnamon applet:右键单击底部面板 – >将Applet添加到Panel – > Inhibit Applet.但它们在整体上是防止的(它不是可以设置自己的禁止应用程序列表).
关于具体应用:
我下载了传输源,并看到通过调用DBUS方法(org.gnome.SessionManager.Inhibit)向Cinnamon DBUS会话提供了防止.因此,它必须是一个存储程序列表的应用程序,并监视列表中的至少一个程序是否正在执行.如果正在执行,则将DBUS方法调用到Cinnamon会话.但我没有找到像我刚刚描述的那样的程序.
据我所知,每个希望防止自己进入睡眠/暂停/屏幕保护程序的程序都必须实现DBUS方法的调用.我没有发现Firefox源代码,但我想如果它没有实现DBUS调用,那么这部分是由Mint团队的开发人员通过补丁实现的(它可能触及任何不实现DBUS方法的程序).
但是,我发现Firefox正在工作(使用dbus-monitor),关于youtube中的视频播放时会发生什么.当视频开始播放时,Firefox会发送两个电话:
$dbus-monitor
. . .
# disable screensaver
method call time=1523976795.844938 sender=:1.104 ->
destination=org.freedesktop.ScreenSaver serial=9 path=/ScreenSaver;
interface=org.freedesktop.ScreenSaver; member=Inhibit
string "firefox"
string "video-playing"
# disable sleeping
method call time=1523976795.893407 sender=:1.21 -> destination=:1.3
serial=61 path=/org/gnome/SessionManager;
interface=org.gnome.SessionManager; member=Inhibit
string "firefox"
uint32 0
string "video-playing"
uint32 8
. . .
调用最后一个方法后,创建了以下抑制器:
$dbus-send --session --type=method_call --print-reply
--dest=org.gnome.SessionManager /org/gnome/SessionManager
org.gnome.SessionManager.GetInhibitors
method return time=1523969881.311742 sender=:1.3 -> destination=:1.188
serial=491 reply_serial=2
array [
object path "/org/gnome/SessionManager/Inhibitor6"
]
当来自youtube的视频已停止时,将删除抑制剂:
$dbus-send --session --type=method_call --print-reply
--dest=org.gnome.SessionManager /org/gnome/SessionManager
org.gnome.SessionManager.GetInhibitors
method return time=1523969881.311742 sender=:1.3 -> destination=:1.188
serial=493 reply_serial=2
array [
]
关于传输:
传输具有用于防止睡眠的复选框:首选项 – >桌面选项卡 – >当种子活跃时禁止冬眠.
关于VLC:
VLC以与Firefox相同的方式阻止睡眠/暂停:
$dbus-monitor
. . .
method call time=1523977809.526716 sender=:1.8017 ->
destination=org.freedesktop.ScreenSaver serial=3 path=/ScreenSaver;
interface=org.freedesktop.ScreenSaver; member=Inhibit
string "vlc"
string "Playing some media."
method call time=1523977809.527152 sender=:1.21 -> destination=:1.3
serial=91 path=/org/gnome/SessionManager;
interface=org.gnome.SessionManager; member=Inhibit
string "vlc"
uint32 0
string "Playing some media."
uint32 8
. . .
$dbus-send --session --type=method_call --print-reply
--dest=org.gnome.SessionManager /org/gnome/SessionManager
org.gnome.SessionManager.GetInhibitors
method return time=1523977813.424421 sender=:1.3 ->
destination=:1.8018 serial=85789 reply_serial=2
array [
object path "/org/gnome/SessionManager/Inhibitor7750"
]
关于Xviewer:
当您开始幻灯片放映时,它将DBUS方法称为前面描述的程序.我不会发布任何关于Xviewer的DBUS,因为它喜欢上一个.