Skip to main content
Question

Change notification center alert duration

  • March 20, 2014
  • 46 replies
  • 175 views

Forum|alt.badge.img+4

Does anyone know how to successfully change then capture the changes made to the Notifications pane in System Preferences so I can then push the settings to end users?

I would like to change the Management Action from Banners to Alerts so the notifications I push to the users have to be manually dismissed by the user. Currently with the banner alerts users only have a couple of seconds to read the alert unless they open up notification center which they don't generally use.

external image link

Many thanks in advance.

46 replies

Forum|alt.badge.img+11
  • Contributor
  • March 20, 2014

Did you try using the snapshot method on composer to see what settings are altered? I would imagine it a a bunch of plists. It wouldn't surprise me though if it is a DB in mavericks.


Forum|alt.badge.img+11
  • Valued Contributor
  • March 20, 2014

Slightly off-topic, but is there away to manually send out notifications when new items are available in Self Service or to provide reminders of up-coming software push?


mm2270
Forum|alt.badge.img+24
  • Legendary Contributor
  • March 20, 2014

@corbin3ci][/url - yes, but it involves using an app like terminal-notifier and a script. Or, if you're on version 9 of the JSS, you may be able to leverage the Management Action.app from a policy. I'm not clear on how easy it is to use the Notification Center feature in 9 just to send out notifications, but it should be possible

Edit: Also, I'm almost certain that these settings for Notification Center are stored in a SQLite db, under both 10.8 and 10.9. They aren't that easy to manipulate or push out as a result.


stevewood
Forum|alt.badge.img+38
  • Hall of Fame
  • March 20, 2014

From Item #11 of the "11 Things You Might Not Know About the Casper Suite" presentation at JNUC 2013:

/Library/Application Support/JAMF/bin/Management Action.app/Contents/MacOS/Management Action -title "You win" -subtitle "Thank you #JNUC" -message "That is a wrap"

Of course, you could also use cocoaDialog instead of using Notification Center.


bentoms
Forum|alt.badge.img+35
  • Hall of Fame
  • March 20, 2014

Or even via AppleScript: http://macosxautomation.com/mavericks/notifications/01.html

Which is how I guess JAMFHelper does it.


Forum|alt.badge.img+4
  • Author
  • Contributor
  • March 20, 2014

@pblake There is a .db in ~/Library/Application Support/NotificationCenter/ I am trying to work out how to setup a policy to deploy it and get the users computer to use it rather than the current .db that is created on the users computer. Any thoughts?


bentoms
Forum|alt.badge.img+35
  • Hall of Fame
  • March 21, 2014

@appleconvert, not sure of the information contained in the below helps at all: https://github.com/alloy/terminal-notifier/issues/44


Forum|alt.badge.img+5
  • Contributor
  • April 11, 2014

I'd also like to change the default from banner to alert also as that way the user has a better chance of seeing the message but also can dismiss it in their own time compared to the 5sec delay currently.

i'm sure there is a way to do a sqlite change for this kinda stuff like it's done for setting the default wallpaper since apple moved away from the .plist for that setting....


Forum|alt.badge.img+8
  • Contributor
  • April 25, 2014

We are wanting to do something similar (I think). We want to disable Messages notifications since we have blocked the messages app, but it doesn't seem that we can set the preference. Anyone had any success with this?


Forum|alt.badge.img+7

Hey guys,

Is there anyway to automate this? Also is there a way to change the size of the window? Management wants the wording not to be truncated on a long message.

Thanks.


bentoms
Forum|alt.badge.img+35
  • Hall of Fame
  • May 21, 2014

@jrserapio, the window is display size is limited by Apple.

For a longer duration & more text I'd suggest looking at JAMFHelper.


Forum|alt.badge.img+7

@bentoms Thanks for the input. I kind of figured that. I just looked into JamfHelper thanks to @stevewood post. I have seen it being mentioned before on other posts, but didn't realize what it could do (visual learner i guess). Now i just have to put JamfHelper to work for me.

Thanks all.


mm2270
Forum|alt.badge.img+24
  • Legendary Contributor
  • May 22, 2014

Hi @jserapio - you might also want to take a look at cocoaDialog version 3.x. It specifically has a window type called "notify" that, under version 3 uses an embedded version of Growl to send up small bubble notifications on the screen. In its default behavior the "bubble" window is black with white text, which isn't the nicest look to me, but the advantage is it can accept quite a bit of text without getting cut off. The bubble window expands vertically to whatever size is needed to show the text.
You can also turn off the new Growl like functionality and use the older style bubbles, which lets you specify the exact background, text and border colors to use with hex values, but then you lose the auto window expansion, so its a trade off.

Let me know if you decide to look at that and need some help with it.


Forum|alt.badge.img+10
  • Contributor
  • May 23, 2014

I filed a request with Apple a few weeks ago to allow admins to control Notification Center through the command line or other means.


Forum|alt.badge.img+5
  • Contributor
  • May 30, 2014

We did find a way to extend the "Banner" dialog box (see below). You can set the duration it sticks (which by default is approximately 5 seconds) to however long you want. Just a click on it anywhere closes it.

defaults write com.apple.notificationcenterui bannerTime SECONDS
(http://www.cnet.com/news/change-the-notification-center-banner-dwell-time-in-os-x)

The downside, however, is that this is a global setting for ALL banners. So we're still on a hunt to find a way to change the setting from "Banner" to "Alert" - the best solution we believe.


Forum|alt.badge.img+10
  • Contributor
  • February 21, 2015

In Mavericks and Yosemite, the preferences for Notification Center are stored in a database in /var/folders. You can find the specific database folder for the logged in user with:

getconf DARWIN_USER_DIR

On my computer the database is: /var/folders/8y/0wl97s7x46z279sv8p2h38k80000gn/0/com.apple.notificationcenter/db/db

There is a table called app_info that stores the settings. I wrote a python script that is below that will modify the database. Run with -h to see the help on using it. Run with -i to get specific Bundle IDs.

If you only want to set "Management Actions" to "Alerts" using this script you would upload this script to your JSS and run a policy with the following parameters:

1: -e com.jamfsoftware.Management-Action
2: -a Alert

https://github.com/matt4836/modifyNotificationCenter https://github.com/matt4836/modifyNotificationCenter


Forum|alt.badge.img+13
  • Contributor
  • March 4, 2015

@matt4836 how do you get the JSS to pass those parameters into the python script?


Forum|alt.badge.img+10
  • Contributor
  • March 4, 2015

@jesseshipley
Create new script in JSS
Paste in the contents of this script.
Create policy to run this script. Use the Parameter options. Scope and trigger.


Forum|alt.badge.img+13
  • Contributor
  • March 4, 2015

Filling in the parameter options doesn't do anything though. It just makes them accessible variables for $4 and $5 i thought. Wen I run it with those parameters filled it doesn't modify the app I'm trying. If I run the script though passing the variable from the command line it works.


Forum|alt.badge.img+10
  • Contributor
  • March 5, 2015

@jesseshipley Ah I thought you could pass hyphens through. I will update by the end of the week for Casper. You could always copy it locally first then run another policy that calls it directly with the command lines arguments.


Forum|alt.badge.img+13
  • Contributor
  • March 5, 2015

That's what I was planning to do in a worst case. Was just curious if I were missing something about the parameters.


Forum|alt.badge.img+10
  • Contributor
  • March 6, 2015

@jesseshipley Here is the updated version I tested in 10.9 upgraded from 10.8 (appears that it keeps the database in the home directory). Clean install of 10.9 and 10.10 use the /var/folder.

There are two versions now. One for Casper. Read the first couple lines to use with your policy.

https://github.com/matt4836/modifyNotificationCenter


Forum|alt.badge.img+13
  • Contributor
  • March 6, 2015

Thanks for the change! Only thing I notice is that you only have All, Apple, NonApple, and NonSystem now. Is there a way to pass it a specific bundle ID so you are only effecting that one?


Forum|alt.badge.img+10
  • Contributor
  • March 7, 2015

Yes, you can type in an App Bundle directly. You the first script with -i to get a list. It is possible to modify that script for an Extension Attribute as well, that would return all the notification center bundles for a computer.


Forum|alt.badge.img+7
  • Contributor
  • June 19, 2015

@matt4836 Thank you a ton for building these scripts. Exactly what I wanted. I was using this to set the Management Action prompts to Alerts. With your Casper version, there is one line I think that is missing (I added this to line 204) under the “Figure out what app” section….

elif APPS_IN_QUESTION == "CASPER": cur.execute("SELECT * FROM app_info %s"% APPS_WHERE_DICT["CASPER"])

Every other app variable was listed in the list except the Casper one. As soon as I added this line, the modifications to the Management Action notifications took. Again, thanks for the work on that script!