1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-20 04:48:00 +01:00

Implement -t/--tray to only run the wicd-gtk tray icon

This commit is contained in:
David Paleino
2011-11-03 09:32:25 +01:00
parent 69dfd4315f
commit 31c521d485
2 changed files with 16 additions and 7 deletions

View File

@@ -124,7 +124,7 @@ class TrayIcon(object):
Base Class for implementing a tray icon to display network status.
"""
def __init__(self, animate, displaytray=True):
def __init__(self, animate, displaytray=True, displayapp=False):
self.cur_sndbytes = -1
self.cur_rcvbytes = -1
self.last_sndbytes = -1
@@ -136,6 +136,8 @@ class TrayIcon(object):
self.tr = self.EggTrayIconGUI(self)
else:
self.tr = self.StatusTrayIconGUI(self)
if displayapp:
self.tr.toggle_wicd_gui()
self.icon_info = self.TrayConnectionInfo(self, self.tr, animate)
self.tr.icon_info = self.icon_info
print 'displaytray %s' % displaytray
@@ -931,6 +933,7 @@ wicd %s
wireless (and wired) connection daemon front-end.
Arguments:
\t-t\t--tray\tRun the wicd tray icon only.
\t-n\t--no-tray\tRun wicd without the tray icon.
\t-h\t--help\t\tPrint this help information.
\t-a\t--no-animate\tRun the tray without network traffic tray animations.
@@ -991,9 +994,10 @@ def main(argv):
"""
try:
opts, args = getopt.getopt(sys.argv[1:], 'nhao', ['help', 'no-tray',
'no-animate',
'only-notifications'])
opts, args = getopt.getopt(sys.argv[1:], 'tnhao', ['help', 'no-tray',
'tray',
'no-animate',
'only-notifications'])
except getopt.GetoptError:
# Print help information and exit
usage()
@@ -1006,6 +1010,8 @@ def main(argv):
if opt in ('-h', '--help'):
usage()
sys.exit(0)
elif opt in ('-t', '--tray'):
display_app = False
elif opt in ('-n', '--no-tray'):
use_tray = False
elif opt in ('-a', '--no-animate'):
@@ -1029,7 +1035,7 @@ def main(argv):
sys.exit(0)
# Set up the tray icon GUI and backend
tray_icon = TrayIcon(animate, displaytray=display_app)
tray_icon = TrayIcon(animate, displaytray=use_tray, displayapp=display_app)
# Check to see if wired profile chooser was called before icon
# was launched (typically happens on startup or daemon restart).

View File

@@ -1,4 +1,4 @@
.TH WICD-CLIENT "1" "June 2009" "wicd-client " "User Commands"
.TH WICD-CLIENT "1" "November 2011" "wicd-client " "User Commands"
.SH NAME
wicd-client \- frontend to the WICD daemon
.SH DESCRIPTION
@@ -9,6 +9,9 @@ an active X server on the current terminal, wicd-client will attempt to run
wicd-curses(8) instead. It will warn you the first time this happens.
.SS "Arguments:"
.TP
\fB\-t\fR \fB\-\-tray\fR
Run the wicd tray icon only.
.TP
\fB\-n\fR \fB\-\-no\-tray\fR
Run wicd without the tray icon.
.TP