aboutsummaryrefslogtreecommitdiffstats
path: root/src/__main__.py
blob: 72575cfc4aecd41f77bf49feae7fbbeb0c485c32 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python3
'''
xpybar – xmobar replacement written in python
Copyright © 2014  Mattias Andrée (maandree@member.fsf.org)

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
'''

import Xlib.display, Xlib.Xatom, Xlib.ext.randr, Xlib.X

from x import *


open_x()

width, height, left, top, panel_height, at_top = get_monitors()[0][:3] + [24, 1 * 12, True]
print(width, height, left, top)

display = get_display()
window = create_panel(width, height, left, top, panel_height, at_top)
gc = window.create_gc()

window.map()
display.flush()

while True:
    try:
        e = display.next_event()
        if e.type == Xlib.X.DestroyNotify:
            break
    except KeyboardInterrupt:
        break
    gc.change(foreground = get_screen().black_pixel)
    window.fill_rectangle(gc, 0, 0, width, panel_height)
    display.flush()

window.unmap()
close_x()