Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.