Dis-allow quitting from an app?

Posted:
in macOS edited January 2014
Is there a way to tweak OS X so that it does not allow you to quit an app? Kinda like the kiddie computers at the apple stores? I want to use one of my macs as a media center, and do not want my sisters to quit the app.



Please excuse me if this should be in the apps forum, but I figured it had more to do with the OS.



Noah

Comments

  • Reply 1 of 11
    davegeedavegee Posts: 2,765member
    Quote:

    Originally posted by noah93

    Is there a way to tweak OS X so that it does not allow you to quit an app? Kinda like the kiddie computers at the apple stores? I want to use one of my macs as a media center, and do not want my sisters to quit the app.



    Please excuse me if this should be in the apps forum, but I figured it had more to do with the OS.



    Noah




    I don't know if this is the best option but given my unix background I'd look at some of the gui based cron tab managers (search versiontracker for cron) and just add an entry that runs every so often (seconds?) that would test to see if 'someapp' is running and if it isn't restart it.



    If you want to get really fancy you could then create some kind of 'test-file' prior to the restart that would get deleted once the program has been restarted...



    With something like this in place you could then test to see if the file you created had indeed been deleted (showing a successful application relaunch) and if the file hadn't (showing something else has gone wrong) and then issue a system restart and/or shutdown.



    Yea my answer is kinda vague but you didn't really leave us with any specifics to go into greater detail with...



    Dave



    P.S. If I'm not mistaken the cron script could even be an Applescript... So you could ask assistance from that group to do all of the testing/test-file creation & deletion.



    P.S.S.



    Oh, and while you might be tempted to just 'edit' the application and remove the Quit menu option... This is NOT the way to go! There are PLENTY of ways that an application can be 'asked' to quit that wouldn't require the 'Quit menu option' to be in place. Applescript, Installers, the OS itself and simple app crashes to name just a few....
  • Reply 2 of 11
    MarvinMarvin Posts: 15,326moderator
    Yeah, I think the script method above is the way to go.



    Even if you launch a program with higher privileges i.e as root (this doesn't require enabling root btw - you can use a program called pseudo) it does ask you for a password if you quit via the activity monitor but not if you quit via the usual methods (dock or quit menu).



    Of course, unless the script is running as a root daemon, someone could quit the script that checks if the app is launched.
  • Reply 3 of 11
    rraburrabu Posts: 264member
    Or create another account on the computer that is highly restricted: simple finder, media app in question is only app avaiable to run, etc.



    When you leave the computer as a media center, leave that account logged in. When you want to use your computer, switch to your account. That way, you can even leave apps/files open in your account with no worries about anyone getting in.



    This would most likely be your most effective way of securing the computer. If your sister quits the media app in question, no problem. The only thing allowed with the simple finder is to relaunch that app...
  • Reply 4 of 11
    akheron01akheron01 Posts: 152member
    Try this, simply replace the finder with the App you want always running for that user. Make a new user account and go into that account and open the terminal, type the following



    defaults write com.apple.loginwindow Finder /Applications/MyApp.app



    Obviously replacing MyApp with the name of the program you want to always be running. Now, even if the user tries to force quit the program it will simply restart itself!
  • Reply 5 of 11
    akheron01akheron01 Posts: 152member
    I should add a note of warning to my previous post, do NOT do this to your main user account, especially if you don't know what you're doing. What this does is it makes the Mac think that the application you specify is now the shell for that machine. If you want to reverse the effects of the previous command, simply type



    defaults delete com.apple.loginwindow Finder



    into the command line.
  • Reply 6 of 11
    a_greera_greer Posts: 4,594member
    Can OSX have multiple shells? In Linux you can have like 8 shells at once, ctrl+F(1-8) to switch, I would do the same thing in OSX and make finder be one and the app be another, then simply set the app to be your default shell for that user account...
  • Reply 7 of 11
    akheron01akheron01 Posts: 152member
    Quote:

    Originally posted by a_greer

    Can OSX have multiple shells? In Linux you can have like 8 shells at once, ctrl+F(1-8) to switch, I would do the same thing in OSX and make finder be one and the app be another, then simply set the app to be your default shell for that user account...



    I don't know about doing it like that, but you could very easily make multiple accounts, each one for a different shell. Then simply use fast user switching to go between the shells, this has the added benefit of giving you the cool rotating cube effect when you switch to a different shell.
  • Reply 8 of 11
    noah93noah93 Posts: 168member
    Thanks a bunch for the help guys! I think I will go with akheron01 idea.



    As for the first poster request, I'll give some more details.



    - I would like MediaCentral to stay open at all times, but I would also like to be able to quit it with a password and return to normal usage.



    - It would be running on a standalone Mac Mini Solo, which would only be usede as a Media Centre.



    - Going to be remote controlled from ARD 3.



    This leads me to some questions. If I connect from ARD, can I run the 'fix' script remotely? Without needing separate accounts on the Mac?



    As in, if I replace the finder with MediaCentral.app, would I still be able to open the terminal?



    And wouldn't akheron01 script change the prefs for the entire Mac?



    Thanks again for the help,

    Noah
  • Reply 9 of 11
    akheron01akheron01 Posts: 152member
    Quote:

    Originally posted by noah93

    - I would like MediaCentral to stay open at all times, but I would also like to be able to quit it with a password and return to normal usage.



    This is precisely the behavior you'll get if you implement a separate user account. You're going to first set up your admin account on the mac which will be for normal usage then set up an account for the media center program, name it something descriptive like "Media Centre". In the Accounts system preference panel click on "Login Options" and set Media Centre to be the user that is automatically logged in, this way it will bring back up the media center even if you restart it. Also, enable fast user switching while you're in the login options, now your accounts names will appear in the upper right hand corner of the screen and you can switch between them and enter a password, if you don't do this then you will simply have to logout from the apple menu and log back in to whichever account you want to use using a password.



    Quote:



    - Going to be remote controlled from ARD 3.



    This leads me to some questions. If I connect from ARD, can I run the 'fix' script remotely? Without needing separate accounts on the Mac?



    As in, if I replace the finder with MediaCentral.app, would I still be able to open the terminal?





    You can absolutely still run the terminal from your media center account, unless you specifically take steps to disable them you should still have the dock and the spotlight menu with which you can access anything on the computer. If you'd like you can set up the media center account to have limited access to programs so only certain ones will be allowed. Alternatively, if you'd like you can totally turn off access to every program, as well as the spotlight menu, as well as the dock (look on www.macosxhints.com for more info on disabling spotlight or the dock) and turn on "Remote Login" in the Sharing preferences panel which will allow you to use SSH to login from directly to the command line of your media center mac, then you can issue terminal commands directly from another computer.



    Quote:



    And wouldn't akheron01 script change the prefs for the entire Mac?





    Nope, Mac OS X is very good about keeping user accounts separate, you have to specifically go out of your way to make something effect the entire system.



    Quote:



    Thanks again for the help





    I'm glad to help, if you have any more questions or need some info on SSH don't hesitate to ask, or just google it!
  • Reply 10 of 11
    pyr3pyr3 Posts: 946member
    Other than auto-restarting the app and disabling force-quitting, can't you just remove the 'Quit' option from the Application menu in Interface Builder, then you could just bind CMD+Q to something else. (I've never tried this in a project, just a thought)





    Quote:

    Originally posted by a_greer

    Can OSX have multiple shells? In Linux you can have like 8 shells at once, ctrl+F(1-8) to switch, I would do the same thing in OSX and make finder be one and the app be another, then simply set the app to be your default shell for that user account...



    Also realize that those are virtual *terminals*. It's emulating 8 terminals. Even then, X Windows only runs in one of them (F7 usually). It's not like you can switch between 8 X Windows displays. (I've only ever heard of someone enabling X on F7 and F8 with different options. But even then, I think that each one requires separate login, sort of like just running two separate X Windows processes)
  • Reply 11 of 11
    fluffyfluffy Posts: 361member
    Just set the Monkeylives flag.
Sign In or Register to comment.