X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=bin%2Fnotify.py;h=3caa7d2a70ede6e931d5b535dc3c02f6bce00405;hb=HEAD;hp=68c331a86483ec8144592fd73a81ec6e6407bc79;hpb=e03c647317bd1861e4e84f59089bc5ebca44e739;p=config%2Fdotfiles.git diff --git a/bin/notify.py b/bin/notify.py deleted file mode 100755 index 68c331a..0000000 --- a/bin/notify.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/python - -# notify.py is a simple notification program displaying a message on the -# screen. - -# Copyright (C) 2011-2012 Simon Ruderich -# -# 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 . - - -import sys -import locale - -import pygtk -pygtk.require('2.0') # there might be a GTK 1 version installed, ignore it -import gtk -import pango -import gobject - - -# Pressing the mouse inside the window quits notify. -def mouse_press_callback(widget, event): - gtk.main_quit() - - -if __name__ == '__main__': - # Display configuration. - BOLD = True - FG_COLOR = 'blue' - BG_COLOR = 'yellow' - - # We need a popup so the window manager doesn't touch our window. - window = gtk.Window(gtk.WINDOW_POPUP) - # No window border or close/resize buttons. - window.set_decorated(False) - # In case set_decorated(False) doesn't work with the used window manager. - window.connect('delete-event', gtk.main_quit) - # Enable mouse click events, by default windows don't receive them. - window.add_events(gtk.gdk.BUTTON_PRESS_MASK) - window.connect('button-press-event', mouse_press_callback) - - # Background color. - window.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(BG_COLOR)) - - string = sys.argv[1].decode(locale.getdefaultlocale()[1]) - - # Colored message string. - label_message = gtk.Label(string) - label_message.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(FG_COLOR)) - window.add(label_message) - - if BOLD: - attributes = pango.AttrList() - attributes.insert(pango.AttrWeight(pango.WEIGHT_HEAVY, end_index=-1)) - label_message.set_attributes(attributes) - - # Display at the top at full screen width. - screen = window.get_screen() - window.resize(screen.get_width(), 30) - window.move(0, 15) - - window.show_all() - gtk.main()