Skip to content

Instantly share code, notes, and snippets.

@narusemotoki
Created November 2, 2012 08:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save narusemotoki/3999524 to your computer and use it in GitHub Desktop.
Save narusemotoki/3999524 to your computer and use it in GitHub Desktop.
Linuxの通知を出すPythonスクリプト
#!/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