Add arguments for panel.
This commit is contained in:
Родитель
0dad9dcb33
Коммит
dc88529bb5
|
@ -1,2 +1,2 @@
|
|||
#!/bin/sh
|
||||
python @prefix@/share/ibus/panel/main.py
|
||||
python @prefix@/share/ibus/panel/main.py $@
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
# Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
# Boston, MA 02111-1307 USA
|
||||
|
||||
import os
|
||||
import sys
|
||||
import getopt
|
||||
import ibus
|
||||
import gtk
|
||||
import dbus
|
||||
|
@ -45,11 +48,41 @@ class PanelApplication:
|
|||
gtk.main_quit ()
|
||||
|
||||
|
||||
def main ():
|
||||
|
||||
def launch_panel ():
|
||||
dbus.mainloop.glib.DBusGMainLoop (set_as_default=True)
|
||||
# gtk.settings_get_default ().props.gtk_theme_name = "/home/phuang/.themes/aud-Default/gtk-2.0/gtkrc"
|
||||
# gtk.rc_parse ("./themes/default/gtkrc")
|
||||
PanelApplication ().run ()
|
||||
|
||||
def print_help (out, v = 0):
|
||||
print >> out, "-h, --help show this message."
|
||||
print >> out, "-d, --daemonize daemonize ibus"
|
||||
sys.exit (v)
|
||||
|
||||
def main ():
|
||||
daemonize = False
|
||||
shortopt = "hd"
|
||||
longopt = ["help", "daemonize"]
|
||||
try:
|
||||
opts, args = getopt.getopt (sys.argv[1:], shortopt, longopt)
|
||||
except getopt.GetoptError, err:
|
||||
print_help (sys.stderr, 1)
|
||||
|
||||
for o, a in opts:
|
||||
if o in ("-h", "--help"):
|
||||
print_help (sys.stdout)
|
||||
elif o in ("-d", "--daemonize"):
|
||||
daemonize = True
|
||||
else:
|
||||
print >> sys.stderr, "Unknown argument: %s" % o
|
||||
print_help (sys.stderr, 1)
|
||||
|
||||
if daemonize:
|
||||
if os.fork ():
|
||||
sys.exit ()
|
||||
|
||||
launch_panel ()
|
||||
|
||||
if __name__ == "__main__":
|
||||
dbus.mainloop.glib.DBusGMainLoop (set_as_default=True)
|
||||
main ()
|
||||
|
|
Загрузка…
Ссылка в новой задаче