mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-07-16 13:14:20 +02:00
xsecurelock: keep a reference to monitor
This commit is contained in:
parent
bce64c1118
commit
76577590e1
1 changed files with 6 additions and 4 deletions
|
@ -129,6 +129,7 @@ def on_overlay_draw(widget, cctx, ctx):
|
||||||
|
|
||||||
def on_background_change(monitor, f1, f2, event, ctx):
|
def on_background_change(monitor, f1, f2, event, ctx):
|
||||||
"""Update background when changed."""
|
"""Update background when changed."""
|
||||||
|
print(event, ctx)
|
||||||
if event not in (
|
if event not in (
|
||||||
Gio.FileMonitorEvent.CHANGES_DONE_HINT,
|
Gio.FileMonitorEvent.CHANGES_DONE_HINT,
|
||||||
Gio.FileMonitorEvent.RENAMED,
|
Gio.FileMonitorEvent.RENAMED,
|
||||||
|
@ -199,14 +200,15 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
gio_event_args = (None, None, None, Gio.FileMonitorEvent.CHANGES_DONE_HINT)
|
gio_event_args = (None, None, None, Gio.FileMonitorEvent.CHANGES_DONE_HINT)
|
||||||
if ctx.background_image:
|
if ctx.background_image:
|
||||||
|
print(ctx.background_image)
|
||||||
gfile = Gio.File.new_for_path(ctx.background_image)
|
gfile = Gio.File.new_for_path(ctx.background_image)
|
||||||
monitor = gfile.monitor_file(Gio.FileMonitorFlags.WATCH_MOVES, None)
|
monitor1 = gfile.monitor_file(Gio.FileMonitorFlags.WATCH_MOVES, None)
|
||||||
monitor.connect("changed", on_background_change, ctx)
|
monitor1.connect("changed", on_background_change, ctx)
|
||||||
on_background_change(*gio_event_args, ctx)
|
on_background_change(*gio_event_args, ctx)
|
||||||
if ctx.weather_file:
|
if ctx.weather_file:
|
||||||
gfile = Gio.File.new_for_path(ctx.weather_file)
|
gfile = Gio.File.new_for_path(ctx.weather_file)
|
||||||
monitor = gfile.monitor_file(Gio.FileMonitorFlags.WATCH_MOVES, None)
|
monitor2 = gfile.monitor_file(Gio.FileMonitorFlags.WATCH_MOVES, None)
|
||||||
monitor.connect("changed", on_weather_change, ctx)
|
monitor2.connect("changed", on_weather_change, ctx)
|
||||||
GLib.timeout_add(1000, on_weather_change, *gio_event_args, ctx)
|
GLib.timeout_add(1000, on_weather_change, *gio_event_args, ctx)
|
||||||
GLib.timeout_add(1000, on_clock_change, ctx)
|
GLib.timeout_add(1000, on_clock_change, ctx)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue