efficient vim config
[dotfiles/.git] / .local / lib / python3.9 / site-packages / pywal / scripts / gtk_reload.py
1 #!/usr/bin/env python2
2 """
3 Small Python 2 script to reload GTK2 themes.
4
5 This uses Python2 since this requires 'send_clientmessage_toall()'
6 which isn't available in Python 3.
7
8 Original source: https://crunchbang.org/forums/viewtopic.php?id=39646
9 """
10 try:
11     import gtk
12 except ImportError:
13     print("[ERROR] gtk_reload: GTK reload requires PyGTK.")
14     exit(1)
15
16
17 def gtk_reload():
18     """Reload GTK2 themes."""
19     events = gtk.gdk.Event(gtk.gdk.CLIENT_EVENT)
20     data = gtk.gdk.atom_intern("_GTK_READ_RCFILES", False)
21     events.data_format = 8
22     events.send_event = True
23     events.message_type = data
24     events.send_clientmessage_toall()
25
26
27 gtk_reload()