Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Does anyone know if desktop switching can be done programatically? Exposé activation and deactivation? I know of the screencapture command for the last part of my proposed solution.

I would like to be able to restore my desktop work environment after a reboot. I have one idea how to do this.

Reason: I reboot every 2 - 4 weeks. I have 9 virtual desktops, each with a few to a dozen windows and applications. After a computer reboot it feels like a brain reboot and takes a few days to get everything back.

Concept: Manually prior to a planned reboot, or perhaps once a day via cron in case of accidental reboot or system freeze, I'd like to somehow capture the system state in order make recovery post-reboot easier.

Ideal Solution: I prefer the CLI. My ideal solution would be a text file of open files on each desktop, and terminal windows on each desktop, and what folder those terminal windows are in. I could then write a script that would go to desktop 1, open all the PDFs there in Preview, open all the .m files in AquaMacs, and open the terminals and cd them to the correct folder, etc. Repeat for each desktop.

I think AppleScript could easily tell me what PDFs are open in, but I don't think it can tell me what desktop they are on. Same with

Proposed Solution: Screenshots of each Desktop while in Exposé mode.

Is there a way to script switching from Desktop #1 through Desktop #9, where at each Desktop, it activates Exposé and takes a screenshot?

Now, after a reboot, I can at least go to a folder, open the 9 screenshots, and manually see what application and what files were open where.

share|improve this question

migrated from Jan 9 '11 at 5:53

This question came from our site for computer enthusiasts and power users.

up vote 1 down vote accepted

do you ever try Relaunch application:

Relaunch saves you time by taking Snapshots of which applications you are using, and starts them back up for you. Think of it as a launcher on steroids that lets you switch between work contexts with one click.

you can take a snapshot before restart your system and after that double click on the snapshot you created then it restored all your files and application you worked on.

share|improve this answer
First test was buggy - deleted comment. Relaunch is a basic start in the right direction. It only opens, none of the PDFs. It doesn't know anything about virtual desktops. But it has some potential. – user588 Sep 3 '10 at 19:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.