gharris999;308728 Wrote: > Does this plugin work with Mac OSX? What has to happen to make it work? I think it does already. I tested this on X.5.3 but I guess most versions of OS X will work as well: - Install the plugin in ~/Library/Application Support/SqueezeCenter/Plugins - In the subroutine sub doSystemShutdown() of file Plugin.pm, make the following changes:
a) comment out the "shutdown -r" (= reboot) lines # system "sudo", '/sbin/shutdown', '-r', 'now'; and replace them with the following: system '/usr/bin/osascript', '-e', 'tell app "Finder" to restart'; b) comment out the "shutdown -h" (=halt) lines # system 'sudo', '/sbin/shutdown', '-h', 'now'; and replace them with this: system '/usr/bin/osascript', '-e', 'tell app "Finder" to shut down'; or that (which is probably safer): system '/usr/bin/osascript', '-e', 'tell app "Finder" to sleep'; No need to muck with sudo settings and that's a good thing, me thinks. Now there are a few caveats, here: 1. On a desktop, and particularly on a multi-user machine like OS X, shutting down may not be such a great idea. That's why I suggest using "sleep" instead of shutdown 2. To avoid losing data upon a shutdown or reboot, opened applications will offer to save documents or cancel shutdown. In case no one responds to applications prompts the shutdown times out. So you can't be certain the Mac will indeed stop or restart. But SC will die anyway I think. 3. Perhaps you think you can log out and keep SC running in the background. Well that's certainly the way to go, but the Login Window is not as scriptable, AFAIK. You can't "tell app "Login Window" to shut down". So I believe the clean way of doing it is to write a small launchd Daemon that will have the power to shutdown/reboot the machine in the unix way; I suggest the deamon should check (with "who" ?) and refuse to shutdown or reboot if user sessions are opened on the machine or if SC is not running. I believe this would work on X.4 and X.5 machines. In order to support X.3 and prior systems the StartupItem init scheme should be used instead of Launchd. If you're interested, have a look at http://developer.apple.com/technotes/tn2005/tn2083.html for authoritative info on the topic. I have little interest, time and skills to code and test this myself. -- epoch1970 ------------------------------------------------------------------------ epoch1970's Profile: http://forums.slimdevices.com/member.php?userid=16711 View this thread: http://forums.slimdevices.com/showthread.php?t=48521 _______________________________________________ plugins mailing list [email protected] http://lists.slimdevices.com/lists/listinfo/plugins
