#!/usr/bin/python

import os
from gi.repository import Gdk, Gtk, GObject

CUSTOM_CSS="""
@define-color super-light-aubergine #F4F1F3;

#subtle-label {

}
"""

def refresh(win):
    win.queue_draw()
    return True

def memstat():
    with open("/proc/%i/statm" % os.getpid()) as f:
        size, resident, share, text, lib, data, dt = f.readline().split()
    print "size: %s res: %s" % (size, resident)
    return True

if __name__ == "__main__":

    label = Gtk.Label("label1")
    label.set_name("subtle-label")

    win = Gtk.Window()
    win.set_size_request(300, 200)
    win.add(label)
    win.show_all()
    win.connect("destroy", Gtk.main_quit)

    provider = Gtk.CssProvider()
    provider.load_from_data(CUSTOM_CSS)
    screen = Gdk.Screen.get_default()
    context = win.get_style_context()
    context.add_provider_for_screen(screen, provider, 800)

    GObject.timeout_add(200, refresh, win)
    GObject.timeout_add_seconds(1, memstat)

    Gtk.main()
