Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Start Swing app after users log in but minimized



I've deleted the original post, but IIRC, you had a shell script that ran your app...

In that case, it would be your console app that would be hidden, not anything it launched... maybe that's why it's still shown.

But if your app is a self executing jar, or a java app wrapped using Jar Bundler (in /Developer/Java Tools), you should be ok.


On 23 Jul 2007, at 19:06, Nicolae Cismaru wrote:

Hi,

Thank you all for the quick answers. This is the first time I'm developing a Java application for
Mac.


In the loginwindow.plist, add the key/value
                       <key>Hide</key>
                       <true/>
Or is there something else?

There isn't, AFAIK.

I didn't know the Hide key did that. I've done some research and here's what I found.


1. If I register Skype as a Startup Item and flag it as hidden, its splash screen and the contact
list doesn't appear when I log in.


2. If I do the same thing for my Java/Swing application, the splash screen and the main window are
still displayed. I've also created a small Swing test application to prove this. You can download
it (source code and ant build script included) from:


http://www.4shared.com/file/20492931/7cac353e/StartupTest.html

I think simply making the application hidden, like the previous poster said,
will do exactly what you want.

This means that the splash screen and the main window are not hidden automatically. I'll have to
hide them from code as Greg suggested.


As for using the term minimized, that was a mistake. I actually wanted to say hidden.


Thanks again, Nicu


--- Greg Guerin <email@hidden> wrote:

In the loginwindow.plist, add the key/value
                       <key>Hide</key>
                       <true/>
Or is there something else?

There isn't, AFAIK.

The state of Hide is user-controllable. The initial state can be preset by
the application, but it should remain user-controllable, and not be forced
by the application. See System Preferences > Accounts > Login Items tab
(the tab is Startup Items on 10.3). It's the Hidden checkbox.


If the app has to do something by itself based on the state of Hide, it
should get the state by itself. Think of it as an external global
variable. There are several ways of getting its value.


One way is to exec() the command 'defaults read loginwindow
AutoLaunchedApplicationDictionary' and parse the resulting text to get the
value of interest.


The login items dictionary is also accessible by AppleScript. See the
Login Items Suite of System Events.app, and exec() the 'osascript' command
from Java. This also requires parsing the resulting text.


One could also use the XML DOM to parse loginwindow.plist, then walk the
tree to examine the Node of interest.


Of these, the XML DOM is probably simplest for a Java program, just because
you don't have to write any parsing code. You still have to do the
decoding, but that's probably simpler than writing a parser, IMO.


One last thing: any plist file can be stored in XML or in binary- plist
format. There is no guarantee which one it will be at any point. The
'plutil' command can convert a plist to XML, which should occur before XML
parsing is attempted. Read 'man plutil', and see its -convert xml1 and -o
options in particular.


  -- GG


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/nicolae.cismaru% 40yahoo.com


This email sent to email@hidden





______________________________________________________________________ ______________
Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=list&sid=396545433
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/adrianm_lists% 40mac.com


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Java-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: Start Swing app after users log in but minimized (From: Nicolae Cismaru <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.