Skip to main content
Question

Mavericks - CocoaDialog at logout

  • January 13, 2014
  • 71 replies
  • 216 views

Show first post

71 replies

Forum|alt.badge.img+9
  • Contributor
  • October 25, 2014

I ment to add, if you are trying to trigger this to run at logout, I would try to capture the logout by using a launchd with the loginwindow argument in the plist. This should be able to capture it and you can stop it and run your script which will fake the logout, then actually log them out after running.

I will hopefully be able to test this, as right now I'm not doing this as a logout process, I'm doing it as a timed function.


loceee
Forum|alt.badge.img+10
  • Contributor
  • October 27, 2014

@GaToRAiD Can you elaborate how you would capture a logout via the method you've mentioned?

I would be great to re-instate the "you are shutting down, install updates now" prompt in Patchoo for 10.8+ when people are initiating a logout or shutdown themselves.

But I think we all need to start concentrating on putting cocoaDialog to bed. Sad, but no one seems to have taken the reigns on it. :(

JAMF please add a progress bar handler to jamfHelper and I can migrate to use it exclusively!


loceee
Forum|alt.badge.img+10
  • Contributor
  • October 27, 2014

I've been thinking about how we might be able to kludge a progressbar out of jamfHelper... it's almost acceptable, but there's a white flash when you fire jamfHelper in fs mode. Otherwise you could technically toggle two jamfHelper processes and kludge a progress bar. Toggling two utility or hud windows is pretty klunky though. Back to the drawing board...

external image link
external image link


Forum|alt.badge.img+9
  • Contributor
  • October 27, 2014

The main issue with the com.apple.loginwindow's logout hook is that from my research by design, apple doesn't want things to be able to run in a gui fashion once the logout process has begun. This is of course from Mavericks+, so the tricky part is being able to tell when a logout has happened. I've been experimenting with a way to see that the trigger of logout, shutdown, etc has happened. Now, I've only been able to monitor this behavior with a tool that is built in object C. I'm still trying to do some digging to see if there is a process that I can watch for that is the trigger to this event.


Forum|alt.badge.img+6
  • Contributor
  • May 19, 2015

The jamfHelper app can display during logout. How do JAMF do it? I am going to try asking JAMF support and see if they are willing to share.


bentoms
Forum|alt.badge.img+35
  • Hall of Fame
  • May 19, 2015

@nigelg If you download CocoaDialog's source, there are many errors about depreciated code when compiling the app.

I'm guessing that's not going to help.


Forum|alt.badge.img+6
  • Contributor
  • May 19, 2015

@bentoms I want to display my own cocoa app at logout as we do our own in-house syncing. jamfHelper shows at logout so I want to know how jamf have permissions to be able to do it. I have tried creating a basic cocoa app and can display it at login but not during logout. I have tried adding it directly to the jamf logouthook.sh which launches jamfHelper but that didn't work (obviously) so theres something about jamfHelper that means it has permission to display over the logout window. I remember reading something about sockets some months ago when there was a jamfHelper bug and it wouldn't display for a couple of versions.


daz_wallace
Forum|alt.badge.img+13
  • Contributor
  • May 19, 2015

We hit an issue which sounds similar starting with Mavericks (Mac OS X 10.9.x). We used to run iHook with some pretty pictures etc at logout whilst a sync ran.

We ended up utilising Big Honking Text instead and it meet our needs in a good enough way.

Darren


russeller
Forum|alt.badge.img+16
  • Valued Contributor
  • May 19, 2015

Hello- I stumbled across this recently: http://jacobsalmela.com/os-x-yosemite-osascript-enabling-access-assistive-devices/

The author was trying to get the command line tool osascript to run at the loginwindow so he could use the ARD UNIX command to enter the username/password info en masse. He created a python script to help automate the entry of command line or apps to the Accessibility pane in Yosemite. Not sure if this would help in this situation, I'm guessing the CocoaDialog issue is something else.


mm2270
Forum|alt.badge.img+24
  • Legendary Contributor
  • May 19, 2015

Those are two different issues. Accessibility settings in the last several OS X versions prevents applications from controlling the UI with automation tasks, like clicking buttons and such, until they are added into the Accessibility pane and given that access. That's not the same issue as displaying a dialog of some kind over the actual login window. I'm not sure what an application needs to be able to do that, but it may need to be a signed application to start; not sure.


russeller
Forum|alt.badge.img+16
  • Valued Contributor
  • May 19, 2015

@mm2270 that makes sense. I figured it was something like that. Thanks for clarifying.


loceee
Forum|alt.badge.img+10
  • Contributor
  • May 19, 2015

Mr Neagle has responded with the links to the important code that makes it happen with Munki's tools in this thread.


loceee
Forum|alt.badge.img+10
  • Contributor
  • May 19, 2015

...hold the phone.

With a fork that I managed to get to compile on 10.10 ... https://github.com/cooljeanius/cocoadialog

And some changes those hints offered up by greg, I've got cocoaDialog presenting a dialog over the loginwindow run by a launchagent at the loginwindow.

Massive disclaimer that I don't really know what I am doing at all in cocoa. Stay tuned.


loceee
Forum|alt.badge.img+10
  • Contributor
  • May 20, 2015

loceee
Forum|alt.badge.img+10
  • Contributor
  • May 20, 2015

Doesn't work on a logout hook though. Not sure what jamfHelper is doing there.


Forum|alt.badge.img+13
  • Contributor
  • May 20, 2015

@loceee This works using a LaunchDaemon with the regular v3.0b of cocoadialog.


loceee
Forum|alt.badge.img+10
  • Contributor
  • May 20, 2015

Ahaha. I was actually about to test the original release now. What a numpty. Move along, nothing to see here.


bentoms
Forum|alt.badge.img+35
  • Hall of Fame
  • May 20, 2015

@nigelg Imm not sure if the JAMFHelper is a signed app.. That might help.

Also it maybe the method used to call JAMFHelper.

@jesseshipley works at logout via a launchdaemon?


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

Try that binary again... looks like I might have cracked it... cocoaDialog.zip

sudo defaults read com.apple.loginwindow LogoutHook
{
    LogoutHook = "/Library/Scripts/logouthook.sh";
}

/Library/Scripts/logouthook.sh

#!/bin/bash
/Applications/cocoaDialog.app/Contents/MacOS/cocoaDialog ok-msgbox --text "I am displaying on a logout hook"
sleep 1
exit

Ya'll owe me a beer at JNUC if I fixed it.


russeller
Forum|alt.badge.img+16
  • Valued Contributor
  • May 21, 2015

I tested @loceee build of CocoaDialog with @dwandro92 script with a JSS logout trigger and it worked! Well done! Did you have to just remove the legacy code from CocoaDialog? Any other tweaks?


mm2270
Forum|alt.badge.img+24
  • Legendary Contributor
  • May 21, 2015

@loceee

Ya'll owe me a beer at JNUC if I fixed it.

Indeed! Will you actually be making it out there this year?


jhbush
Forum|alt.badge.img+27
  • Esteemed Contributor
  • May 21, 2015

@loceee thank you for fixing this. Will you be pushing your changes to your fork of CocoaDialog on your GitHub repo?


loceee
Forum|alt.badge.img+10
  • Contributor
  • May 22, 2015

@mm2270 actually pretty unlikely. 2 kids in childcare and a mortgage... and I kinda doubt I can get $ out of work to ship me over. Pour one out for me though.

@ssrussell other tweaks I found in similar projects - all in github fork now.

@jhbush1973 done. https://github.com/loceee/cocoadialog

INSERT shameless plug - all details on my blog - http://www.rehrehreh.com


mscottblake
Forum|alt.badge.img+24
  • Honored Contributor
  • May 22, 2015

Very cool, @loceee. Thanks for your effort on this. You should try to do a PR back to the main repo too.


loceee
Forum|alt.badge.img+10
  • Contributor
  • May 22, 2015

@mscottblake is anyone even maintaining the repo anymore?