如何在Python中捕获系统挂起事件? [英] How can I catch a system suspend event in Python?
本文介绍了如何在Python中捕获系统挂起事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
我认为最简单的方法是使用 DBUS python 界面
并收听'AboutToSleep'和/或'Sleeping'事件' org.freedesktop.UPower'界面
I'm using ubuntu 12.04. Is there a way to catch a suspend event in Python, i.e. if the laptop is going to suspend, do this...? The same question for catching shutdown event.
解决方案
i think simplest method would be to use DBUS python interface and listen for 'AboutToSleep' and/or 'Sleeping' event on 'org.freedesktop.UPower' interface
这篇关于如何在Python中捕获系统挂起事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文