terminal-notifier 1.7.1 → 1.7.2

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: eb346770c5841b855bd10ed29ef4978737796f04
4
- data.tar.gz: a0a5aafa6599e3f25b9a77008caef94b5e1bd2ad
3
+ metadata.gz: 4dcd4d5574c0f6a72194c404b75c3492c4cf1893
4
+ data.tar.gz: 141fcb8e6689657588c37473bf5c62d99113a9f5
5
5
  SHA512:
6
- metadata.gz: cb29172445667301209d649c57c0859c2f2efd49732d1626cd0372739d2d2ad2bd5f183dd341b3c7a1a1573a11710eb8a716f6838ffac1e3b6c750dc5a88d32a
7
- data.tar.gz: ed36e3f179a80f957e1e55b375e59080a4590e40f7d5b0f0c536671f511c7b0d01409a7f22ce20a174bf423069b56298e2b111d9e6292594a2da9b9c9dccb68b
6
+ metadata.gz: b5aa0028909e4ac903c9e8593502e96b80a3febcc4052a3cdb56d7ef53586bd53715e0f533faf8f229056d7f28aacde56bfee1d03265cba1d5a41a3c46c19c8b
7
+ data.tar.gz: 3e9f8458371332df5f478dc8e2e1c900b832e13f1114aca718de301270ab0c80193de4806d6a4c7a66be10a494da410f2d68b41bee045cce87bbb2efa63b82af
@@ -16,7 +16,7 @@ module TerminalNotifier
16
16
 
17
17
  def self.execute(verbose, options)
18
18
  if available?
19
- command = [BIN_PATH, *options.map { |k,v| v = v.to_s; ["-#{k}", "#{Shellwords.escape(v[0,1])}#{v[1..-1]}"] }.flatten]
19
+ command = [BIN_PATH, *options.map { |k,v| v = v.to_s; ["-#{k}", "#{v[0] == "-" ? " " : ""}#{Shellwords.escape(v[0,1])}#{v[1..-1]}"] }.flatten]
20
20
  command = Shellwords.join(command) if RUBY_VERSION < '1.9'
21
21
  result = ''
22
22
  IO.popen(command) do |stdout|
@@ -1,27 +1,29 @@
1
1
  # terminal-notifier
2
2
 
3
- terminal-notifier is a command-line tool to send Mac OS X User Notifications,
4
- which are available in Mac OS X 10.8 and higher.
3
+ terminal-notifier is a command-line tool to send macOS User Notifications,
4
+ which are available on macOS 10.8 and higher.
5
5
 
6
6
 
7
7
  ## Caveats
8
8
 
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
- build of terminal-notifier with your icon and **a different bundle identifier**
13
- instead. (If you do not change the bundle identifier, launch services will use
14
- a cached version of the icon.)
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.
9
+ * On macOS 10.8, the `-appIcon` and `-contentImage` options do nothing.
10
+ This is because Notification Center on 10.8 _always_ uses the application’s own icon.
11
+
12
+ You can do one of the following to work around this limitation on 10.8:
13
+ - Use the `-sender` option to “fake it” (see below)
14
+ - Include a build of terminal-notifier with your icon **and a different bundle identifier**.
15
+ (If you don’t change the bundle identifier, launch services uses a cached version of the icon.)
16
+
17
+ However, you _can_ use unicode symbols and emojis! See the examples.
18
18
 
19
19
  * It is currently packaged as an application bundle, because `NSUserNotification`
20
20
  does not work from a ‘Foundation tool’. [radar://11956694](radar://11956694)
21
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.
22
+ * If you intend to package terminal-notifier with your app to distribute it on the Mac App Store, please use 1.5.2; version 1.6.0+ uses a private method override, which is not allowed in the App Store Guidelines.
23
+
24
+ * To enable actions on the notification (the buttons that allow the user to select an option),
25
+ open System Preferences > Notifications, select terminal-notifer in the sidebar, and select the "Alerts" alert style.
26
+ ![Enable alerts in System Preferences](assets/System_prefs.png)
25
27
 
26
28
 
27
29
  ## Download
@@ -60,38 +62,49 @@ $ terminal-notifier -[message|group|list] [VALUE|ID|ID] [options]
60
62
 
61
63
  This will obviously be a bit slower than using the tool without the wrapper.
62
64
 
63
- Some examples are:
64
65
 
65
- Display piped data with a sound
66
+ ### Example Uses
67
+
68
+ Display piped data with a sound:
66
69
  ```
67
70
  $ echo 'Piped Message Data!' | terminal-notifier -sound default
68
71
  ```
69
72
 
70
- Multiple actions and custom dropdown list
73
+ ![Example 1](assets/Example_1.png)
74
+
75
+ Multiple actions and custom dropdown list:
71
76
  ```
72
77
  $ terminal-notifier -message "Deploy now on UAT ?" -actions Now,"Later today","Tomorrow" -dropdownLabel "When ?"
73
78
  ```
74
79
 
75
- Yes or No ?
80
+ ![Example 2](assets/Example_2.png)
81
+
82
+ “Yes or No ?”:
76
83
  ```
77
84
  $ terminal-notifier -title ProjectX -subtitle "new tag detected" -message "Deploy now on UAT ?" -closeLabel No -actions Yes -appIcon http://vjeantet.fr/images/logo.png
78
85
  ```
79
86
 
80
- Open an URL when the notification is clicked
87
+ ![Example 3](assets/Example_3.png)
88
+
89
+ Open an URL when the notification is clicked:
81
90
  ```
82
91
  $ terminal-notifier -title '💰' -message 'Check your Apple stock!' -open 'http://finance.yahoo.com/q?s=AAPL'
83
92
  ```
84
93
 
85
- Open an app when the notification is clicked
94
+ ![Example 4](assets/Example_4.png)
95
+
96
+ Open an app when the notification is clicked:
86
97
  ```
87
98
  $ terminal-notifier -group 'address-book-sync' -title 'Address Book Sync' -subtitle 'Finished' -message 'Imported 42 contacts.' -activate 'com.apple.AddressBook'
88
99
  ```
89
100
 
101
+ ![Example 5](assets/Example_5.png)
102
+
90
103
 
91
- #### Options
104
+ ### Options
92
105
 
93
- At a minimum, you have to specify either the `-message` , the `-remove`
94
- or the `-list` option.
106
+ At a minimum, you must specify either the `-message` , the `-remove`, or the
107
+ `-list` option.
95
108
 
96
109
  -------------------------------------------------------------------------------
97
110
 
@@ -99,8 +112,8 @@ or the `-list` option.
99
112
 
100
113
  The message body of the notification.
101
114
 
102
- Note that if this option is omitted and data is piped to the application, that
103
- data will be used instead.
115
+ If you pipe data into terminal-notifier, you can omit this option,
116
+ and the piped data will become the message body instead.
104
117
 
105
118
  -------------------------------------------------------------------------------
106
119
 
@@ -118,78 +131,86 @@ The subtitle of the notification.
118
131
 
119
132
  `-sound NAME`
120
133
 
121
- The name of a sound to play when the notification appears. The names are listed
122
- in Sound Preferences. Use 'default' for the default notification sound.
134
+ Play the `NAME` sound when the notification appears.
135
+ Sound names are listed in Sound Preferences.
136
+
137
+ Use the special `NAME` “default” for the default notification sound.
123
138
 
124
139
  -------------------------------------------------------------------------------
125
140
 
126
141
  `-reply` **[10.9+ only]**
127
142
 
128
- The notification will be displayed as a reply type alert.
143
+ Display the notification as a reply type alert.
129
144
 
130
145
  -------------------------------------------------------------------------------
131
146
 
132
147
  `-actions VALUE1,VALUE2,"VALUE 3"` **[10.9+ only]**
133
148
 
134
- The notification actions avalaible.
149
+ Use `VALUE*` as actions for the notification.
135
150
  When you provide more than one value, a dropdown will be displayed.
136
- You can customize this dropdown label with the next option
137
- Does not work when -reply is used
151
+
152
+ You can customize this dropdown label with the `-dropdownLabel` option.
153
+
154
+ Does not work when `-reply` is used.
138
155
 
139
156
  -------------------------------------------------------------------------------
140
157
 
141
158
  `-dropdownLabel VALUE` **[10.9+ only]**
142
159
 
143
- The notification actions dropdown title (only when multiples -actions values are provided).
144
- Does not work when -reply is used
160
+ Use the `VALUE` label for the notification’s dropdown menu actions
161
+ (only when multiple `-actions` values are provided).
162
+
163
+ Does not work when `-reply` is used.
145
164
 
146
165
  -------------------------------------------------------------------------------
147
166
 
148
167
  `-closeLabel VALUE` **[10.9+ only]**
149
168
 
150
- The notification "Close" button label.
169
+ Use the `VALUE` label for the notification’s Close button.
151
170
 
152
171
  -------------------------------------------------------------------------------
153
172
 
154
173
  `-timeout NUMBER`
155
174
 
156
- Auto close the alert notification after NUMBER seconds.
175
+ Automatically close the alert notification after `NUMBER` seconds.
157
176
 
158
177
  -------------------------------------------------------------------------------
159
178
 
160
179
  `-json`
161
180
 
162
- Outputs the event as JSON.
181
+ Output the event as JSON.
163
182
 
164
183
  -------------------------------------------------------------------------------
165
184
 
166
185
  `-group ID`
167
186
 
168
- Specifies the ‘group a notification belongs to. For any ‘group only _one_
187
+ Specifies the notification’s ‘group’. For any ‘group’, only _one_
169
188
  notification will ever be shown, replacing previously posted notifications.
170
189
 
171
- A notification can be explicitely removed with the `-remove` option, describe
172
- below.
190
+ A notification can be explicitly removed with the `-remove` option (see
191
+ below).
173
192
 
174
- Examples are:
193
+ Example group IDs:
175
194
 
176
- * The sender’s name to scope the notifications by tool.
177
- * The sender’s process ID to scope the notifications by a unique process.
178
- * The current working directory to scope notifications by project.
195
+ * The sender’s name (to scope the notifications by tool).
196
+ * The sender’s process ID (to scope the notifications by a unique process).
197
+ * The current working directory (to scope notifications by project).
179
198
 
180
199
  -------------------------------------------------------------------------------
181
200
 
182
201
  `-remove ID` **[required]**
183
202
 
184
- Removes a notification that was previously sent with the specified ‘group ID,
185
- if one exists. If used with the special group "ALL", all message are removed.
203
+ Remove a previous notification from the `ID` ‘group’, if one exists.
204
+
205
+ Use the special `ID` “ALL” to remove all messages.
186
206
 
187
207
  -------------------------------------------------------------------------------
188
208
 
189
209
  `-list ID` **[required]**
190
210
 
191
- Lists details about the specified ‘group’ ID. If used with the special group
192
- "ALL", details about all currently active messages are displayed.
211
+ Lists details about the specified ‘group’ `ID`.
212
+
213
+ Use the special `ID` “ALL” to list details about all currently active messages.
193
214
 
194
215
  The output of this command is tab-separated, which makes it easy to parse.
195
216
 
@@ -197,13 +218,13 @@ The output of this command is tab-separated, which makes it easy to parse.
197
218
 
198
219
  `-activate ID`
199
220
 
200
- Specifies which application should be activated when the user clicks the
221
+ Activate the application specified by `ID` when the user clicks the
201
222
  notification.
202
223
 
203
- You can find the bundle identifier of an application in its `Info.plist` file
224
+ You can find the bundle identifier (`CFBundleIdentifier`) of an application in its `Info.plist` file
204
225
  _inside_ the application bundle.
205
226
 
206
- Examples are:
227
+ Examples application IDs are:
207
228
 
208
229
  * `com.apple.Terminal` to activate Terminal.app
209
230
  * `com.apple.Safari` to activate Safari.app
@@ -212,30 +233,28 @@ Examples are:
212
233
 
213
234
  `-sender ID`
214
235
 
215
- Specifying this will make it appear as if the notification was send by that
216
- application instead, including using its icon.
236
+ Fakes the sender application of the notification. This uses the specified
237
+ application’s icon, and will launch it when the notification is clicked.
217
238
 
218
- Using this option fakes the sender application, so that the notification system
219
- will launch that application when the notification is clicked. Because of this
220
- it is important to note that you cannot combine this with options like
221
- `-execute`, `-open`, and `-activate` which depend on the sender of the
222
- notification to be ‘terminal-notifier’ to perform its work.
239
+ Because this option fakes the notification sender, it cannot be used with options
240
+ like `-execute`, `-open`, and `-activate`, because they depend on the sender being
241
+ ‘terminal-notifier’ to work.
223
242
 
224
- For information on the `ID` see the `-activate` option.
243
+ For information on the `ID`, see the `-activate` option.
225
244
 
226
245
  -------------------------------------------------------------------------------
227
246
 
228
247
  `-appIcon PATH` **[10.9+ only]**
229
248
 
230
- Specifies The PATH of an image to display instead of the application icon.
249
+ Specify an image `PATH` to display instead of the application icon.
231
250
 
232
- **WARNING: This option is subject to change since it relies on a private method.**
251
+ **WARNING: This option is subject to change, since it relies on a private method.**
233
252
 
234
253
  -------------------------------------------------------------------------------
235
254
 
236
255
  `-contentImage PATH` **[10.9+ only]**
237
256
 
238
- Specifies The PATH of an image to display attached inside the notification.
257
+ Specify an image `PATH` to attach inside of the notification.
239
258
 
240
259
  **WARNING: This option is subject to change since it relies on a private method.**
241
260
 
@@ -243,14 +262,14 @@ Specifies The PATH of an image to display attached inside the notification.
243
262
 
244
263
  `-open URL`
245
264
 
246
- Specifies a resource to be opened when the user clicks the notification. This
247
- can be a web or file URL, or any custom URL scheme.
265
+ Open `URL` when the user clicks the notification. This can be a web or file URL,
266
+ or any custom URL scheme.
248
267
 
249
268
  -------------------------------------------------------------------------------
250
269
 
251
270
  `-execute COMMAND`
252
271
 
253
- Specifies a shell command to run when the user clicks the notification.
272
+ Run the shell command `COMMAND` when the user clicks the notification.
254
273
 
255
274
 
256
275
  ## License
@@ -259,7 +278,7 @@ All the works are available under the MIT license. **Except** for
259
278
  ‘Terminal.icns’, which is a copy of Apple’s Terminal.app icon and as such is
260
279
  copyright of Apple.
261
280
 
262
- Copyright (C) 2012-2016 Eloy Durán <eloy.de.enige@gmail.com>, Julien Blanchard
281
+ Copyright (C) 2012-2017 Eloy Durán <eloy.de.enige@gmail.com>, Julien Blanchard
263
282
  <julien@sideburns.eu>
264
283
 
265
284
  Permission is hereby granted, free of charge, to any person obtaining a copy of
@@ -279,3 +298,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
279
298
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
280
299
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
281
300
  SOFTWARE.
301
+
@@ -16,7 +16,7 @@ module TerminalNotifier
16
16
 
17
17
  def self.execute(verbose, options)
18
18
  if available?
19
- command = [BIN_PATH, *options.map { |k,v| v = v.to_s; ["-#{k}", "#{Shellwords.escape(v[0,1])}#{v[1..-1]}"] }.flatten]
19
+ command = [BIN_PATH, *options.map { |k,v| v = v.to_s; ["-#{k}", "#{v[0] == "-" ? " " : ""}#{Shellwords.escape(v[0,1])}#{v[1..-1]}"] }.flatten]
20
20
  command = Shellwords.join(command) if RUBY_VERSION < '1.9'
21
21
  result = ''
22
22
  IO.popen(command) do |stdout|
@@ -15,6 +15,13 @@ describe "TerminalNotifier" do
15
15
  IO.expects(:popen).with(command).yields(StringIO.new('output'))
16
16
  TerminalNotifier.execute(false, :message => '[ZOMG] "OH YEAH"')
17
17
  end
18
+
19
+ it "correctly escapes arguments that start with a dash" do
20
+ command = [TerminalNotifier::BIN_PATH, '-message', ' -kittens', '-title', ' -rule']
21
+ command = Shellwords.join(command) if RUBY_VERSION < '1.9'
22
+ IO.expects(:popen).with(command).yields(StringIO.new('output'))
23
+ TerminalNotifier.execute(false, :message => '-kittens', :title => '-rule')
24
+ end
18
25
 
19
26
  it "returns the result output of the command" do
20
27
  TerminalNotifier.execute(false, 'help' => '').should == `'#{TerminalNotifier::BIN_PATH}' -help`
@@ -420,11 +420,13 @@ isMavericks()
420
420
  ^{
421
421
  __block BOOL notificationStillPresent;
422
422
  do {
423
- notificationStillPresent = NO;
424
- for (NSUserNotification *nox in [[NSUserNotificationCenter defaultUserNotificationCenter] deliveredNotifications]) {
425
- if ([nox.userInfo[@"uuid"] isEqualToString:[NSString stringWithFormat:@"%ld", self.hash] ]) notificationStillPresent = YES;
423
+ @autoreleasepool {
424
+ notificationStillPresent = NO;
425
+ for (NSUserNotification *nox in [[NSUserNotificationCenter defaultUserNotificationCenter] deliveredNotifications]) {
426
+ if ([nox.userInfo[@"uuid"] isEqualToString:[NSString stringWithFormat:@"%ld", self.hash] ]) notificationStillPresent = YES;
427
+ }
428
+ if (notificationStillPresent) [NSThread sleepForTimeInterval:0.20f];
426
429
  }
427
- if (notificationStillPresent) [NSThread sleepForTimeInterval:0.20f];
428
430
  } while (notificationStillPresent);
429
431
 
430
432
  dispatch_async(dispatch_get_main_queue(), ^{
@@ -17,11 +17,11 @@
17
17
  <key>CFBundlePackageType</key>
18
18
  <string>APPL</string>
19
19
  <key>CFBundleShortVersionString</key>
20
- <string>1.7.1</string>
20
+ <string>1.7.2</string>
21
21
  <key>CFBundleSignature</key>
22
22
  <string>????</string>
23
23
  <key>CFBundleVersion</key>
24
- <string>16</string>
24
+ <string>17</string>
25
25
  <key>LSMinimumSystemVersion</key>
26
26
  <string>${MACOSX_DEPLOYMENT_TARGET}</string>
27
27
  <key>LSUIElement</key>
@@ -32,7 +32,12 @@
32
32
  <string>MainMenu</string>
33
33
  <key>NSPrincipalClass</key>
34
34
  <string>NSApplication</string>
35
- <key>NSUserNotificationAlertStyle</key>
35
+ <key>NSAppTransportSecurity</key>
36
+ <dict>
37
+ <key>NSAllowsArbitraryLoads</key>
38
+ <true/>
39
+ </dict>
40
+ <key>NSUserNotificationAlertStyle</key>
36
41
  <string>alert</string>
37
42
  </dict>
38
43
  </plist>
@@ -3,7 +3,7 @@
3
3
  <plist version="1.0">
4
4
  <dict>
5
5
  <key>BuildMachineOSBuild</key>
6
- <string>15G1004</string>
6
+ <string>16E195</string>
7
7
  <key>CFBundleDevelopmentRegion</key>
8
8
  <string>en</string>
9
9
  <key>CFBundleExecutable</key>
@@ -19,7 +19,7 @@
19
19
  <key>CFBundlePackageType</key>
20
20
  <string>APPL</string>
21
21
  <key>CFBundleShortVersionString</key>
22
- <string>1.7.1</string>
22
+ <string>1.7.2</string>
23
23
  <key>CFBundleSignature</key>
24
24
  <string>????</string>
25
25
  <key>CFBundleSupportedPlatforms</key>
@@ -27,25 +27,30 @@
27
27
  <string>MacOSX</string>
28
28
  </array>
29
29
  <key>CFBundleVersion</key>
30
- <string>16</string>
30
+ <string>17</string>
31
31
  <key>DTCompiler</key>
32
32
  <string>com.apple.compilers.llvm.clang.1_0</string>
33
33
  <key>DTPlatformBuild</key>
34
- <string>8A218a</string>
34
+ <string>8B62</string>
35
35
  <key>DTPlatformVersion</key>
36
36
  <string>GM</string>
37
37
  <key>DTSDKBuild</key>
38
- <string>16A300</string>
38
+ <string>16B2649</string>
39
39
  <key>DTSDKName</key>
40
40
  <string>macosx10.12</string>
41
41
  <key>DTXcode</key>
42
- <string>0800</string>
42
+ <string>0810</string>
43
43
  <key>DTXcodeBuild</key>
44
- <string>8A218a</string>
44
+ <string>8B62</string>
45
45
  <key>LSMinimumSystemVersion</key>
46
46
  <string>10.8</string>
47
47
  <key>LSUIElement</key>
48
48
  <true/>
49
+ <key>NSAppTransportSecurity</key>
50
+ <dict>
51
+ <key>NSAllowsArbitraryLoads</key>
52
+ <true/>
53
+ </dict>
49
54
  <key>NSHumanReadableCopyright</key>
50
55
  <string>Copyright © 2012-2016 Eloy Durán, Julien Blanchard. All rights reserved.</string>
51
56
  <key>NSMainNibFile</key>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terminal-notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 1.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Duran
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-10-04 00:00:00.000000000 Z
12
+ date: 2017-05-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bacon
@@ -92,6 +92,12 @@ files:
92
92
  - vendor/terminal-notifier/Terminal Notifier/en.lproj/MainMenu.xib
93
93
  - vendor/terminal-notifier/Terminal Notifier/main.m
94
94
  - vendor/terminal-notifier/Terminal.icns
95
+ - vendor/terminal-notifier/assets/Example_1.png
96
+ - vendor/terminal-notifier/assets/Example_2.png
97
+ - vendor/terminal-notifier/assets/Example_3.png
98
+ - vendor/terminal-notifier/assets/Example_4.png
99
+ - vendor/terminal-notifier/assets/Example_5.png
100
+ - vendor/terminal-notifier/assets/System_prefs.png
95
101
  - vendor/terminal-notifier/terminal-notifier.app/Contents/Info.plist
96
102
  - vendor/terminal-notifier/terminal-notifier.app/Contents/MacOS/terminal-notifier
97
103
  - vendor/terminal-notifier/terminal-notifier.app/Contents/PkgInfo
@@ -119,9 +125,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
125
  version: '0'
120
126
  requirements: []
121
127
  rubyforge_project:
122
- rubygems_version: 2.4.5.1
128
+ rubygems_version: 2.5.2
123
129
  signing_key:
124
130
  specification_version: 4
125
131
  summary: Send User Notifications on Mac OS X 10.8 or higher.
126
132
  test_files: []
127
- has_rdoc: