From bc8b7bf97b0905f8b08c3db136c8828230744dff Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Mon, 15 Aug 2022 10:56:47 +0200 Subject: [PATCH] i3-companion: on resume, force DPMS off --- bin/i3-companion | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bin/i3-companion b/bin/i3-companion index 028e130..97424ff 100755 --- a/bin/i3-companion +++ b/bin/i3-companion @@ -25,6 +25,7 @@ import i3ipc import ravel import xcffib import xcffib.randr +import xcffib.dpms import xcffib.xproto from i3ipc.aio import Connection from systemd import daemon, journal @@ -993,6 +994,21 @@ async def network_manager_status(i3, event, *args): return " ".join(status) +@on( + DBusSignal( + interface="org.freedesktop.login1.Manager", + member="PrepareForSleep", + signature="b", + ), +) +async def on_sleep_resume(i3, event, path, sleeping): + if not sleeping: + logger.info("resume from sleep") + dpms = i3.x11(xcffib.dpms.key) + dpms.Forcelevel(0) + i3.x11.flush() + + # Main function