-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathedit-interactive-svg
More file actions
executable file
·40 lines (34 loc) · 929 Bytes
/
edit-interactive-svg
File metadata and controls
executable file
·40 lines (34 loc) · 929 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python3
import os
import time
from traceback import print_exc
import subprocess
from subprocess import Popen
import dbus
from gi.repository import GLib
from dbus.mainloop.glib import DBusGMainLoop
BUS_NAME = 'org.editInteractiveSVG.server'
SYSTEMD_SERVICE = 'editInteractiveSVG.service'
def get_url():
bus = dbus.SystemBus()
try:
o = bus.get_object(
BUS_NAME,
"/Server"
)
except dbus.DBusException:
print_exc()
exit(1)
i = dbus.Interface(o, BUS_NAME)
return i.Url()
if __name__ == '__main__':
status = int(os.system(
'systemctl is-active --quiet %s' % SYSTEMD_SERVICE
))
if status != 0:
print('systemd service "%s" is not started' % SYSTEMD_SERVICE)
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
loop = GLib.MainLoop()
Popen(["firefox", get_url()])
exit(0)
loop.run()