Skip to content

Commit 5ff7cba

Browse files
committed
Update readme. Add files to repo
1 parent 1a644c8 commit 5ff7cba

File tree

4 files changed

+111
-2
lines changed

4 files changed

+111
-2
lines changed

Main.sublime-menu

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
[
2+
{
3+
"caption": "Preferences",
4+
"mnemonic": "n",
5+
"id": "preferences",
6+
"children":
7+
[
8+
{
9+
"caption": "Package Settings",
10+
"mnemonic": "P",
11+
"id": "package-settings",
12+
"children":
13+
[
14+
{
15+
"caption": "Notifications",
16+
"children":
17+
[
18+
{
19+
"command": "open_file",
20+
"args": {"file": "${packages}/Notifications/notifications.sublime-settings"},
21+
"caption": "Settings – Default"
22+
},
23+
{
24+
"command": "open_file",
25+
"args": {"file": "${packages}/User/notifications.sublime-settings"},
26+
"caption": "Settings – User"
27+
},
28+
{"caption": "-"},
29+
{
30+
"command": "notifications_test",
31+
"caption": "Test Notifications"
32+
}
33+
]
34+
}
35+
]
36+
}
37+
]
38+
}
39+
]

Notifications.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import os
2+
import subprocess
3+
import sublime
4+
import sublime_plugin
5+
6+
PLUGIN_SETTINGS = "notifications.sublime-settings"
7+
8+
9+
class Notifiers(sublime_plugin.EventListener):
10+
""" Notify user on file save """
11+
def growl(self, msg, title):
12+
settings = sublime.load_settings(PLUGIN_SETTINGS)
13+
notifier = settings.get('notifier')
14+
15+
if notifier == 'subnotify':
16+
# SubNotify
17+
sublime.active_window().run_command('sub_notify', {
18+
'title': title,
19+
'msg': msg,
20+
'sound': False
21+
})
22+
23+
elif notifier == 'terminal-notifier':
24+
# Terminal Notifier
25+
sublime.active_window().run_command('terminal_notifier', {
26+
'title': title,
27+
# 'subtitle': title,
28+
'message': msg
29+
})
30+
31+
def on_post_save(self, view):
32+
filename = os.path.basename(view.file_name())
33+
title = 'File was saved.'
34+
self.growl(filename, title)
35+
36+
37+
print(os.getcwd())

README.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,32 @@
1-
notifications
2-
=============
1+
#Notifications
32

43
Sublime text plugin that uses terminal-notifier or subnotify for event notifications
4+
5+
##Installation
6+
###Mac
7+
######Install terminal-notifier
8+
9+
```bash
10+
gem install terminal-notifier
11+
```
12+
13+
######Install one of the following Sublime plugins
14+
- Terminal Notifier
15+
- SubNotify
16+
17+
######Install this plugin
18+
- Download repo directly into Packages folder
19+
- Install via Package Control
20+
21+
######Setup Preferences
22+
Make sure Terminal Notifier or SubNotify are setup correctly.
23+
24+
Tell Notifications which plugin you want to use to display the notifications
25+
26+
```json
27+
{
28+
"notifier": "subnotify"
29+
}
30+
```
31+
32+
__Note:__ SubNotify is currently the default because it supports multiplatform notifications. This plugin has not yet been verified to work with Windows but the plan is to support Windows in the future.

notifications.sublime-settings

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
// Notification System to use.
3+
// Possible values: terminal-notifier, subnotify
4+
"notifier": "subnotify"
5+
}

0 commit comments

Comments
 (0)