Lion: Use Hazel to Prevent Saved State for ANY Application

From your noodle to other noodles. Talk about ways to get the most from Hazel. Even exchange recipes for the cool rules you've thought up. DO NOT POST YOUR QUESTIONS HERE.

Moderators: Mr_Noodle, Moderators

Saved states in Lion are great... sometimes. I prefer to have saved states only in certain applications. Since Lion hasn't included this feature, Hazel to the rescue:

(1) Add ~/Library/Saved Application States/ as a watch folder
(2) Set up a rule: If name includes the Application You DON'T want to save a state for then move to trash

It works great.
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

I also mention that Hazel can be used to LOCK a state. This means that when you open the application it will be in the same state every time. First, set the application that you'd like to "freeze" and quit the application. Quitting will force Lion to update the saved state in the ~/Library/Saved Application States/ folder. Then, navigate in finder to that directory copy the appropriate saved state and append -HazelCache to the end of the application's duplicated saved state folder.

(*) Setup your app, quit, and copy the cache file
(1) Add ~/Library/Saved Application States/ as a watch folder
(2) If name is com.whatever.applicationname.savedstate then delete file and run shell script.
(3) Set shell script to /bin/cp ~/Library/Saved\ Application\ States\com.whatever.applicationname.savedState-HazelCache ~/Library/Saved\ Application\ States\com.whatever.applicationname.savedState

Basically, every time Lion creates a new saved state for the application, hazel will overwrite it with a different saved state.

NOTE: In this current VERY BASIC implementation, Hazel will loop (because it creates the file that it's looking for). I'm not using this, but showing that's its possible. If you're going to use this hint, I'd suggest setting a flag to prevent the looping.
a_freyer
 
Posts: 631
Joined: Tue Sep 30, 2008 9:21 am
Location: Colorado

Interesting. I'm not sure if there are any issues with doing this out from underneath the system but I guess the worst that happens is that you just lose state for that app. Thanks for the tip.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Tips & Tricks - DO NOT POST QUESTIONS