Add -t command line key, to show taskbar by default.

Portnov [2008-10-05 17:52:45]
Add -t command line key, to show taskbar by default.
Filename
qwerty.py
diff --git a/qwerty.py b/qwerty.py
index 38ddbc5..4de4020 100755
--- a/qwerty.py
+++ b/qwerty.py
@@ -56,11 +56,14 @@ speckeys = {}

 def help():
     print """Synopsis:
-qwerty.py [-a] [-c | --config /path/to/config] [-f] [-g | --geometry geometry] [-d] [-h | --help]
+qwerty.py [-a] [-t] [-c | --config /path/to/config] [-f] [-g | --geometry geometry] [-d] [-h | --help]

 -a
     Fill empty keys with keys from other sections

+-t
+    Show taskbar by default
+
 -c | --config /path/to/config
     Use specified config file instead of ~/.config/qwerty.conf

@@ -274,11 +277,14 @@ def parse_cmdline():
     decorate = True
     geometry = ''
     fill_empty = False
+    taskbar = False

-    opts,args = getopt(sys.argv[1:], 'ac:g:fdh',['config=','geometry=','help'])
+    opts,args = getopt(sys.argv[1:], 'atc:g:fdh',['config=','geometry=','help'])
     for k,v in opts:
         if k == '-a':
             fill_empty = True
+        if k == '-t':
+            taskbar = True
         if k == '-c' or k == '--config':
             config_file = v
         if k == '-g' or k == '--geometry':
@@ -294,7 +300,7 @@ def parse_cmdline():
     if fullscreen:
         decorate = False

-    return fill_empty, fullscreen, geometry, decorate
+    return fill_empty, taskbar, fullscreen, geometry, decorate


 def dict_from_keylist(keys):
@@ -597,7 +603,7 @@ class KeyEditDialog(object):
         self.hide()

 class GUI(object):
-    def __init__(self, fullscreen, geometry, decorate):
+    def __init__(self, fullscreen, geometry, decorate, taskbar):
         global sections

         self.buttons = {}
@@ -642,7 +648,7 @@ class GUI(object):
             self.rows[2].append(self.buttons[c])

         self.taskbar = gtk.VBox()
-        self.taskbar_shown = False
+        self.taskbar_shown = taskbar

         self.keyboard = gtk.VBox()
         box = gtk.HBox()
@@ -675,7 +681,6 @@ class GUI(object):
         self.window.add(self.main)

         self.window.show_all()
-        self.taskbar.hide()

         try:
             self.collect_windows()
@@ -683,6 +688,8 @@ class GUI(object):
             self.clients_list = []
             print 'Could not get list of open windows!'

+        self.switch_taskbar(taskbar)
+
     def calc_sizes(self):
         global LABEL_FONT_SIZE
         global DESC_FONT_SIZE
@@ -768,8 +775,11 @@ class GUI(object):
         self.activate_window(self.convert_class(cls)[0])
         self.exit()

-    def switch_taskbar(self):
-        self.taskbar_shown = not self.taskbar_shown
+    def switch_taskbar(self, show=None):
+        if show is None:
+            self.taskbar_shown = not self.taskbar_shown
+        else:
+            self.taskbar_shown = show
         if self.taskbar_shown:
             self.keyboard.hide()
             self.fill_taskbar()
@@ -973,9 +983,9 @@ class GUI(object):
                   btn.mark_running(K.cls)
         self.refresh()

-fill_empty, fullscreen, geometry, decorate = parse_cmdline()
+fill_empty, taskbar, fullscreen, geometry, decorate = parse_cmdline()
 parse_config(fill_empty)

-g = GUI(fullscreen, geometry, decorate)
+g = GUI(fullscreen, geometry, decorate, taskbar)
 g.show_section(defsection+1,[])
 gtk.main()
ViewGit