terminal-notifier 1.5.2 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b08bd293cf43906f2a2981022d9437f0a6758210
4
- data.tar.gz: d64d013c3d638884daace7310cbde29cf618f9a0
3
+ metadata.gz: bc0d510f599b6936ce8b16fbda223456053c2280
4
+ data.tar.gz: 314e51d3fdb3859e55a6b5500abe8fead4bbb6f6
5
5
  SHA512:
6
- metadata.gz: 1209ea24eb31275b6f1d6cc42b67c3ab2d557aa27d049d338f16a9f3fcef08a2cd084f5370501a4f412e587cef86bf9d5d193ba819b232dfbe00cef8dffd2340
7
- data.tar.gz: 4e0f15e611525579d5117c39df8fdea49a0ffb8488a8bca7a41fbbfbb3aef93285d869739faf807ab5ca2855073ad02439312c6725ac13f579599f273a982c6c
6
+ metadata.gz: a21300312cffba5d3d617becb181325a4bdc93c5d6de395343f87c505bed0bfbde2d2c8bca0a288e789d2e723e1cda39d99487952c7ca94ad7cad6b230e0c5b1
7
+ data.tar.gz: 2f54d00f7f18b78aac700484634db6c43531496fcc299a51a8a2f9a9cfca75405d5df4d4f01d6584ea62508019ceb8a2901012e6eeecf9264bca650b5a6a1f9c
@@ -6,18 +6,23 @@ which are available in Mac OS X 10.8 and higher.
6
6
 
7
7
  ## Caveats
8
8
 
9
- * The Notification Center _always_ uses the application’s own icon, there’s
10
- currently no way to specify a custom icon for a notification. The only way to
11
- use this tool with your own icon is to use the `-sender` option or include a
9
+ * Under OS X 10.8, the Notification Center _always_ uses the application’s own
10
+ icon, there’s currently no way to specify a custom icon for a notification. The only
11
+ way to use this tool with your own icon is to use the `-sender` option or include a
12
12
  build of terminal-notifier with your icon and **a different bundle identifier**
13
13
  instead. (If you do not change the bundle identifier, launch services will use
14
14
  a cached version of the icon.)
15
-
16
- However, you _can_ use unicode symbols and emojis. See the examples.
15
+ <br/>Consequently the `-appIcon` & `-contentImage` options aren't doing anything
16
+ under 10.8.
17
+ <br/>However, you _can_ use unicode symbols and emojis. See the examples.
17
18
 
18
19
  * It is currently packaged as an application bundle, because `NSUserNotification`
19
20
  does not work from a ‘Foundation tool’. [radar://11956694](radar://11956694)
20
21
 
22
+ * If you intend to package terminal-notifier with your app to distribute it on the
23
+ MAS, please use 1.5.2 since 1.6.0+ uses a private method override which is not
24
+ allowed in the AppStore guidelines.
25
+
21
26
 
22
27
  ## Download
23
28
 
@@ -67,7 +72,7 @@ $ terminal-notifier -group 'address-book-sync' -title 'Address Book Sync' -subti
67
72
  #### Options
68
73
 
69
74
  At a minimum, you have to specify either the `-message` , the `-remove`
70
- option or the `-list` option.
75
+ or the `-list` option.
71
76
 
72
77
  -------------------------------------------------------------------------------
73
78
 
@@ -161,6 +166,22 @@ For information on the `ID` see the `-activate` option.
161
166
 
162
167
  -------------------------------------------------------------------------------
163
168
 
169
+ `-appIcon URL` **[10.9+ only]**
170
+
171
+ Specifies The URL of an image to display instead of the application icon.
172
+
173
+ **WARNING: This option is subject to change since it relies on a private method.**
174
+
175
+ -------------------------------------------------------------------------------
176
+
177
+ `-contentImage URL` **[10.9+ only]**
178
+
179
+ Specifies The URL of an image to display attached inside the notification.
180
+
181
+ **WARNING: This option is subject to change since it relies on a private method.**
182
+
183
+ -------------------------------------------------------------------------------
184
+
164
185
  `-open URL`
165
186
 
166
187
  Specifies a resource to be opened when the user clicks the notification. This
@@ -10,7 +10,7 @@ def filename
10
10
  end
11
11
 
12
12
  def zipfile
13
- "#{filename}.zip"
13
+ "#{version}.zip"
14
14
  end
15
15
 
16
16
  task :clean do
@@ -21,14 +21,18 @@ end
21
21
  desc "Fetch latest build from the GitHub releases"
22
22
  task :update_build do
23
23
  unless File.exist?(zipfile)
24
- sh "curl -L -O 'https://github.com/alloy/terminal-notifier/releases/download/#{version}/terminal-notifier-#{version}.zip'"
24
+ sh "curl -L -O 'https://github.com/alloy/terminal-notifier/archive/#{zipfile}'"
25
25
  end
26
26
 
27
27
  rm_rf "vendor"
28
28
  mkdir "vendor"
29
29
 
30
30
  sh "unzip -o -d vendor #{zipfile}"
31
- mv "vendor/#{filename}", "vendor/terminal-notifier"
31
+ mv "vendor/#{filename}", 'vendor/terminal-notifier'
32
+
33
+ %x(xcodebuild -project '../Terminal\ Notifier.xcodeproj' -target terminal-notifier SYMROOT=build -verbose)
34
+ mv '../build/Release/terminal-notifier.app', 'vendor/terminal-notifier/'
35
+ chmod 0755, 'vendor/terminal-notifier/terminal-notifier.app/Contents/MacOS/terminal-notifier'
32
36
  end
33
37
 
34
38
  desc "Build gem"
@@ -9,6 +9,8 @@ NSString * const NotificationCenterUIBundleID = @"com.apple.notificationcenterui
9
9
  #define NSAppKitVersionNumber10_8 1187
10
10
  #define NSAppKitVersionNumber10_9 1265
11
11
 
12
+ #define contains(str1, str2) ([str1 rangeOfString: str2 ].location != NSNotFound)
13
+
12
14
  NSString *_fakeBundleIdentifier = nil;
13
15
 
14
16
  @implementation NSBundle (FakeBundleIdentifier)
@@ -66,24 +68,21 @@ isMavericks()
66
68
 
67
69
  +(void)initializeUserDefaults
68
70
  {
69
- NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
71
+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
70
72
 
71
- // initialize the dictionary with default values depending on OS level
72
- NSDictionary *appDefaults;
73
+ // initialize the dictionary with default values depending on OS level
74
+ NSDictionary *appDefaults;
73
75
 
74
- if (isMavericks())
75
- {
76
- //10.9
77
- appDefaults = @{@"sender": @"com.apple.Terminal"};
78
- }
79
- else
80
- {
81
- //10.8
82
- appDefaults = @{@"": @"message"};
83
- }
76
+ if (isMavericks()) {
77
+ //10.9
78
+ appDefaults = @{@"sender": @"com.apple.Terminal"};
79
+ } else {
80
+ //10.8
81
+ appDefaults = @{@"": @"message"};
82
+ }
84
83
 
85
- // and set them appropriately
86
- [defaults registerDefaults:appDefaults];
84
+ // and set them appropriately
85
+ [defaults registerDefaults:appDefaults];
87
86
  }
88
87
 
89
88
  - (void)printHelpBanner;
@@ -113,6 +112,8 @@ isMavericks()
113
112
  " Old notifications with the same ID will be removed.\n" \
114
113
  " -activate ID The bundle identifier of the application to activate when the user clicks the notification.\n" \
115
114
  " -sender ID The bundle identifier of the application that should be shown as the sender, including its icon.\n" \
115
+ " -appIcon URL The URL of a image to display instead of the application icon (Mavericks+ only)\n" \
116
+ " -contentImage URL The URL of a image to display attached to the notification (Mavericks+ only)\n" \
116
117
  " -open URL The URL of a resource to open when the user clicks the notification.\n" \
117
118
  " -execute COMMAND A shell command to perform when the user clicks the notification.\n" \
118
119
  "\n" \
@@ -186,10 +187,12 @@ isMavericks()
186
187
 
187
188
  if (message) {
188
189
  NSMutableDictionary *options = [NSMutableDictionary dictionary];
189
- if (defaults[@"activate"]) options[@"bundleID"] = defaults[@"activate"];
190
- if (defaults[@"group"]) options[@"groupID"] = defaults[@"group"];
191
- if (defaults[@"execute"]) options[@"command"] = defaults[@"execute"];
192
- if (defaults[@"open"]) options[@"open"] = [defaults[@"open"] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
190
+ if (defaults[@"activate"]) options[@"bundleID"] = defaults[@"activate"];
191
+ if (defaults[@"group"]) options[@"groupID"] = defaults[@"group"];
192
+ if (defaults[@"execute"]) options[@"command"] = defaults[@"execute"];
193
+ if (defaults[@"open"]) options[@"open"] = [defaults[@"open"] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
194
+ if (defaults[@"appIcon"]) options[@"appIcon"] = defaults[@"appIcon"];
195
+ if (defaults[@"contentImage"]) options[@"contentImage"] = defaults[@"contentImage"];
193
196
 
194
197
  [self deliverNotificationWithTitle:defaults[@"title"] ?: @"Terminal"
195
198
  subtitle:subtitle
@@ -200,6 +203,15 @@ isMavericks()
200
203
  }
201
204
  }
202
205
 
206
+ - (NSImage*)getImageFromURL:(NSString *) url;
207
+ {
208
+ if(!contains(url, @"file://")){ // Prefix file:// if not present
209
+ url = [NSString stringWithFormat:@"%@%@", @"file://", url];
210
+ }
211
+ NSURL *imageURL = [NSURL URLWithString:url];
212
+ return [[NSImage alloc] initWithContentsOfURL:imageURL];
213
+ }
214
+
203
215
  - (void)deliverNotificationWithTitle:(NSString *)title
204
216
  subtitle:(NSString *)subtitle
205
217
  message:(NSString *)message
@@ -215,6 +227,19 @@ isMavericks()
215
227
  userNotification.informativeText = message;
216
228
  userNotification.userInfo = options;
217
229
 
230
+ if(isMavericks()){
231
+ // Mavericks options
232
+ if(options[@"appIcon"]){
233
+ // replacement app icon
234
+ [userNotification setValue:[self getImageFromURL:options[@"appIcon"]] forKey:@"_identityImage"];
235
+ [userNotification setValue:@(true) forKey:@"_identityImageHasBorder"];
236
+ }
237
+ if(options[@"contentImage"]){
238
+ // content image
239
+ userNotification.contentImage = [self getImageFromURL:options[@"contentImage"]];
240
+ }
241
+ }
242
+
218
243
  if (sound != nil) {
219
244
  userNotification.soundName = [sound isEqualToString: @"default"] ? NSUserNotificationDefaultSoundName : sound ;
220
245
  }
@@ -17,11 +17,11 @@
17
17
  <key>CFBundlePackageType</key>
18
18
  <string>APPL</string>
19
19
  <key>CFBundleShortVersionString</key>
20
- <string>1.5.2</string>
20
+ <string>1.6.0</string>
21
21
  <key>CFBundleSignature</key>
22
22
  <string>????</string>
23
23
  <key>CFBundleVersion</key>
24
- <string>10</string>
24
+ <string>11</string>
25
25
  <key>LSMinimumSystemVersion</key>
26
26
  <string>${MACOSX_DEPLOYMENT_TARGET}</string>
27
27
  <key>LSUIElement</key>
@@ -19,11 +19,11 @@
19
19
  <key>CFBundlePackageType</key>
20
20
  <string>APPL</string>
21
21
  <key>CFBundleShortVersionString</key>
22
- <string>1.5.2</string>
22
+ <string>1.6.0</string>
23
23
  <key>CFBundleSignature</key>
24
24
  <string>????</string>
25
25
  <key>CFBundleVersion</key>
26
- <string>10</string>
26
+ <string>11</string>
27
27
  <key>DTCompiler</key>
28
28
  <string>com.apple.compilers.llvm.clang.1_0</string>
29
29
  <key>DTPlatformBuild</key>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terminal-notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Duran
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-12 00:00:00.000000000 Z
11
+ date: 2014-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bacon