git-dude icon indicating copy to clipboard operation
git-dude copied to clipboard

Add OS X Notification Center notification backend support

Open morgant opened this issue 10 years ago • 7 comments

Pull Request #30 added support for OS X Notification Center (OS X 10.8 Mountain Lion and newer) using terminal-notifier. Unfortunately, it also added GitHub-specific support, so was not accepted, but the OS X Notification Center support would be a nice addition.

morgant avatar Feb 24 '15 19:02 morgant

Feel free to send a pull-request then :)

ku1ik avatar Feb 25 '15 09:02 ku1ik

FWIW, I was able to accomplish this via the following (no external packages):

git config --global dude.notify-command 'osascript -e "display notification \"$DESCRIPTION\" with title \"$TITLE\""'

joshdick avatar Oct 14 '15 16:10 joshdick

We have 2 options then:

  • add osascript support to the code,
  • or document the above example in the readme

ku1ik avatar Oct 15 '15 08:10 ku1ik

I believe the osascript support for notifications was added in OS X Mavericks. terminal-notifier or Growl would still be necessary for earlier versions of OS X.

joshdick avatar Oct 15 '15 14:10 joshdick

Using git config per @joshdick didn't work for me, not sure what's up, getting a "Service exited with abnormal code" in the logs when I run this as a LaunchAgent daemon...

digitaljhelms avatar Nov 03 '15 04:11 digitaljhelms

@digitaljhelms Which version of OS X are you using? This has worked fine for me on both Yosemite and El Capitan.

joshdick avatar Nov 03 '15 05:11 joshdick

@joshdick El Capitan (10.11.1)

Command line failure: 732:742: syntax error: A identifier can’t go after this “"”. (-2740)

I walked through a few repos symlinked in ~/.git-dude and ran git dude manually until I found the repo causing the error. While, I don't know the specific commit that's the culprit, I can speculate it has something to do with a double quote in the description or title that, if not escaped before being passed to the osascript command, causes the error... Perhaps working an escaping solution into the notify command (something like http://stackoverflow.com/a/23923108) would resolve this.

digitaljhelms avatar Nov 05 '15 16:11 digitaljhelms