dimmer: tentative to quit if we are obscured (presumably by i3lock)

This does not happend because, I suppose, we are using a compositor.
This commit is contained in:
Vincent Bernat 2021-08-06 00:16:58 +02:00
parent 6e75c87102
commit d72855073a

View file

@ -13,9 +13,15 @@ import cairo
import argparse
def visibility_event(widget, event):
if event.state == Gdk.VisibilityState.FULLY_OBSCURED:
gtk.main_quit()
def realize_event(widget):
window = widget.get_window()
window.set_override_redirect(True)
window.set_events(window.get_events() | Gdk.EventMask.VISIBILITY_NOTIFY_MASK)
def draw_event(widget, event, options, elapsed):
@ -82,8 +88,9 @@ if __name__ == "__main__":
window.move(geom.x, geom.y)
window.connect("draw", draw_event, options, [])
window.connect("delete-event", Gtk.main_quit)
window.connect("realize", realize_event)
window.connect("visibility-notify-event", visibility_event)
window.connect("delete-event", Gtk.main_quit)
window.show_all()