diff options
| author | Mattias Andrée <maandree@operamail.com> | 2014-02-27 09:25:43 +0100 | 
|---|---|---|
| committer | Mattias Andrée <maandree@operamail.com> | 2014-02-27 09:25:43 +0100 | 
| commit | e36e0864960ff20ad33ff08ccb57143f4835c61e (patch) | |
| tree | c74a728d768facc441ad1acea34fa59f5f243e06 | |
| parent | add Bar.clear (diff) | |
| download | xpybar-e36e0864960ff20ad33ff08ccb57143f4835c61e.tar.gz xpybar-e36e0864960ff20ad33ff08ccb57143f4835c61e.tar.bz2 xpybar-e36e0864960ff20ad33ff08ccb57143f4835c61e.tar.xz | |
configurability
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
| -rwxr-xr-x | src/__main__.py | 42 | 
1 files changed, 35 insertions, 7 deletions
| diff --git a/src/__main__.py b/src/__main__.py index 55b5fe8..38c5298 100755 --- a/src/__main__.py +++ b/src/__main__.py @@ -22,11 +22,39 @@ import Xlib.display, Xlib.Xatom, Xlib.ext.randr, Xlib.X  from x import * -OUTPUT, HEIGHT, YPOS, TOP = 0, 12, 24, True +global OUTPUT, HEIGHT, YPOS, TOP, FONT, BACKGROUND, FOREGROUND +global dislay, outputs, redraw, Bar, start, stop + +OUTPUT, HEIGHT, YPOS, TOP = 0, 12, 0, True  FONT = '-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*'  BACKGROUND, FOREGROUND = (0, 0, 0), (192, 192, 192) +def redraw(): +    ''' +    Invoked when redraw is needed, feel free to replace it completely +    ''' +    global bar +    bar.clear() + +def start(): +    ''' +    Invoked when it is time to create panels and map them, +    feel free to replace it completely +    ''' +    global bar +    bar = Bar(OUTPUT, HEIGHT, YPOS, TOP, FONT, BACKGROUND, FOREGROUND) +    bar.map() + +def stop(): +    ''' +    Invoked when it is time to unmap the panels, +    feel free to replace it completely +    ''' +    global bar +    bar.unmap() + +  class Bar:      '''      Docked panel @@ -154,12 +182,13 @@ class Bar:          self.change_font(self.font) +# TODO load configurations + +  open_x()  display = get_display()  outputs = get_monitors() -bar = Bar(OUTPUT, HEIGHT, YPOS, TOP, FONT, BACKGROUND, FOREGROUND) - -bar.map() +start()  while True:      try: @@ -168,10 +197,9 @@ while True:              break      except KeyboardInterrupt:          break -    bar.clear() -    bar.draw_text(0, 10, '°°° TEST °°°') +    redraw()      display.flush() -bar.unmap() +stop()  close_x() | 
