Created
November 2, 2012 08:40
-
-
Save narusemotoki/3999524 to your computer and use it in GitHub Desktop.
Linuxの通知を出すPythonスクリプト
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from optparse import OptionParser | |
import pynotify | |
def notify(app_name, title, message): | |
icon = 'dialog-information' | |
if app_name is None: | |
app_name = 'app_name' | |
if title is None: | |
title = 'title' | |
if message is None: | |
message = 'message' | |
pynotify.init(app_name) | |
pynotify.Notification(title, message, icon).show() | |
if __name__ == '__main__': | |
parser = OptionParser() | |
parser.add_option('-a', '--app-name') | |
parser.add_option('-t', '--title') | |
parser.add_option('-m', '--message') | |
(options, args) = parser.parse_args() | |
notify(options.app_name, options.title, options.message) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment