sheagcraig / yo

Send Notification Center messages from the command line
Apache License 2.0
383 stars 44 forks source link

Possible solution for Casper usage #20

Closed sheagcraig closed 6 years ago

sheagcraig commented 7 years ago
#!/usr/bin/python

import subprocess
from SystemConfiguration import SCDynamicStoreCopyConsoleUser

current_user = SCDynamicStoreCopyConsoleUser(None, None, None)[0]
notification = '/Library/Application\ Support/IT/bin/yo --title "IT Alert" --info "Updates required." --icon /Library/Application\ Support/CPE/share/DeathTaco.png'
cmd = ['/usr/bin/su', '-l', current_user, '-c', notification]
subprocess.call(cmd)