-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNotifications.py
More file actions
37 lines (29 loc) · 837 Bytes
/
Notifications.py
File metadata and controls
37 lines (29 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import os
import subprocess
import sublime
import sublime_plugin
PLUGIN_SETTINGS = "notifications.sublime-settings"
class Notifiers(sublime_plugin.EventListener):
""" Notify user on file save """
def growl(self, msg, title):
settings = sublime.load_settings(PLUGIN_SETTINGS)
notifier = settings.get('notifier')
if notifier == 'subnotify':
# SubNotify
sublime.active_window().run_command('sub_notify', {
'title': title,
'msg': msg,
'sound': False
})
elif notifier == 'terminal-notifier':
# Terminal Notifier
sublime.active_window().run_command('terminal_notifier', {
'title': title,
# 'subtitle': title,
'message': msg
})
def on_post_save(self, view):
filename = os.path.basename(view.file_name())
title = 'File was saved.'
self.growl(filename, title)
print(os.getcwd())