autostart
This commit is contained in:
parent
9d01cbf57e
commit
0551a18cc9
6 changed files with 69 additions and 10 deletions
|
|
@ -2,7 +2,7 @@
|
|||
import os
|
||||
from os.path import dirname, abspath
|
||||
import subprocess
|
||||
import time
|
||||
import sys
|
||||
import webbrowser
|
||||
|
||||
import gi
|
||||
|
|
@ -26,7 +26,8 @@ class OMLIcon:
|
|||
icon = None
|
||||
indicator = None
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, autostart=False):
|
||||
self.autostart = autostart
|
||||
if appindicator:
|
||||
self.indicator = appindicator.Indicator.new("OML", icon,
|
||||
appindicator.IndicatorCategory.APPLICATION_STATUS)
|
||||
|
|
@ -40,7 +41,8 @@ class OMLIcon:
|
|||
self.icon.connect("activate", self._click)
|
||||
self.icon.connect("popup-menu", self._click)
|
||||
subprocess.Popen([ctl, 'start'])
|
||||
GLib.timeout_add_seconds(1, self._open, None)
|
||||
if not self.autostart:
|
||||
GLib.timeout_add_seconds(1, self._open, None)
|
||||
GLib.timeout_add_seconds(60, self._check, None)
|
||||
|
||||
def _check(self, *args, **kwargs):
|
||||
|
|
@ -85,5 +87,7 @@ class OMLIcon:
|
|||
webbrowser.open_new_tab(url)
|
||||
self.menu = None
|
||||
|
||||
OMLIcon()
|
||||
Gtk.main()
|
||||
if __name__ == '__main__':
|
||||
autostart = len(sys.argv) > 1 and sys.argv[1] == '--autostart'
|
||||
OMLIcon(autostart)
|
||||
Gtk.main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue