You are not logged in.

#1 2016-11-12 13:55:51

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 849

[SOLVED] C get signal when monitor leaves power management mode

Hi,

i'm writing a C utility. I'd like to know if there is a way for my utility to get "notified" when screen leaves blanked mode (DPMS) and returns active.
I'm currently using xcb to check if screen is blanked (ie, if dpms power_level is > "DPMSModeOn"). My purpose is to stop my utility while screen is off, and restart it as soon as screen becomes active.
Is this possible?

Thanks!

Last edited by nierro (2016-11-12 14:09:25)

Offline

#2 2016-11-12 14:02:10

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,576
Website

Re: [SOLVED] C get signal when monitor leaves power management mode

X does not generate any events for DMPS mode changes.  You could use inotify to watch for changes in the relevant path under /sys/class, but this may vary by hardware.

I suspect your best approach will just be to periodically poll the state for yourself.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2016-11-12 14:09:15

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 849

Re: [SOLVED] C get signal when monitor leaves power management mode

This explains why i could not find much informations about that...thanks!
As a future note: https://blog.martin-graesslin.com/blog/ … d-wayland/ . Here Martin says exatcly that.
It seems wayland does signal when changing dpms state indeed, so i can at least use that on wayland.

Again, thank you!

Offline

Board footer

Powered by FluxBB