Managing multiple desktops

I’ve been disappointed with the virtual desktop apps that are out there because they all seem to be misnamed. They don’t really provide multiple desktops but multiple multi-app window sets. I don’t need window sets, I want to use different desktop folders. For instance, in a pinch, I want to swap my cluttered, crazy desktop with a pristine one, and, in an instant, switch it back. To this end, I have devised a fairly basic script:

set home_path to (path to "cusr" as string)

set the_desktop_name to "Desktop"
set the_desktop_alt_name to "Desktop_alt"
set the_desktop_temp_name to "Desktop_temp"

tell application "Finder"
	try
		get (home_path & the_desktop_alt_name & ":") as alias
	on error
		make new folder at folder home_path with properties {name:the_desktop_alt_name}
	end try
	quit
end tell

tell application "System Events"
	repeat while (name of processes) contains "Finder"
		delay 1
	end repeat
end tell

my mv_rename(home_path, the_desktop_alt_name, the_desktop_temp_name)
my mv_rename(home_path, the_desktop_name, the_desktop_alt_name)
my mv_rename(home_path, the_desktop_temp_name, the_desktop_name)

tell application "Finder" to launch

on mv_rename(parent_path, original_name, new_name)
	do shell script "cd " & (quoted form of POSIX path of parent_path) & "; mv " & (quoted form of original_name) & " " & (quoted form of new_name)
end mv_rename

I’m going to work on this quite a bit but does anyone see any significant problem(s) with this code? What if I change paths so that the folders actually move to different locations, not simply renamed?

Thanks!

Jon

Novel approach, Jon. I like it.

I can’t think of a reason why one would be better functionally but it might not be a bad idea to create, and move them to, a support folder in ~/Library/Application Support/ for the purpose of organization. Users might find this approach more acceptable and less confusing.

– Rob

That’s exactly what I was thinking. I’ve mapped out (in my head only) an AS Studio app that allows you to cycle between as many desktops as you’d like. It would allow you to create a description and hide the naming structure in a support folder. It would also allow you to set some other desktop parameters such as specifying the desktop picture per desktop. A nice companion to FWM, I think.

Jon

OK, so I’ve made some progress. As Rob suggested, I’ve determined that hiding the multiple desktops from the user in the Application Support folder is the way to go. I’ve wrapped my (significantly improved) code in an AppleScript Studio app. The new app is called “TatorTop” (Tator as in Rotator; Top as in Desktop) and is available for direct download:

[url=http://homepage.mac.com/jonn8/tat/TaTb.hqx]http://homepage.mac.com/jonn8/tat/TaTb.hqx[/url]

and, as always, the beta code is:

betacode

PLEASE READ THIS WHOLE MESSAGE BEFORE USING THE APPLICATION – POSSIBLE DATA LOSSS COULD OCCUR FROM USING TATORTOP!

You may want to move all of your essential files/folders that are currently on your desktop to another folder in your home directory, not on the desktop. If you want to see the interface without modifying your system, simply hit “Cancel” when it asks for your administrative password.

In essence, this app will create a new folder in your Application Support folder named TatorTop, it will then move your desktop folder there (and rename it “Desktop 1”). It will also create two alternate desktop folders called “Desktop 2” & “Desktop 3”. Finally, it will create a symbolic link named “Desktop” to the moved & renamed desktop folder (“Desktop 1”) at the root level of your home folder and then restart the Finder.

This appears to work without incident on my machine. The symbolic link works fine and whatever you move to “~/Library/Application Support/TatorTop/Desktop 1/” will appear on your desktop (and any item you move to the desktop will appear in this folder). Also, running a script command “path to desktop as string” will return “~:Library:Application Support:TatorTop:Desktop 1:” so it shouldn’t break any scripts or applications. even if you hardcode “~:Desktop”, it should still work because the symbolic link is at that location.

To create and move the folders, you need to enter your administrator password. None of the commands used actually require administrative privileges but I require it of the user to make sure they are allowed to modify the machine at all. Once it is set up, then the interface allows you to choose from any of the three desktops and instantly make any of them active. This is accomplished by quitting the Finder, deleting the symbolic link, and recreating it pointing to any of the three desktop folders in the Application Support folder. I’ve also added an option to have separate desktop pictures per desktop folder.

The app also includes an uninstaller to revert your system back to its original state (select “Uninstall…” from the application menu). This will delete the symbolic link, move “Desktop 1” back to the root of your home directory, rename it “Desktop” and move “Desktop 2” & “Desktop 3” to your desktop so you won’t lose any files in case there were files/folders on those desktops (a future enhancement will look at the contents of those folders and will only place them on the desktop if they are not empty).

There is no help and the website is really just a place holder for now. If folks think it’s viable, I’ll start working on the documentation (always the hardest part, by far). I plan on adding some more features including better error checking, a utility to combine desktops (move all files/folders to a single folder adjusting file names as necessary), perhaps support for more desktops (do people really need more than 3?), implementing the uninstaller if the timeout has ended, drag & drop support of the desktop pictures, and, most importantly of all, making this a status item app so it will always be available for quick switching from the menu bar. Suggestions for features are encouraged. Would any of you pay for this?

Thanks (as always),
Jon

Yikes! :wink:

I wonder if it would be possible/easier to simply move the items contained by the Desktop folder. Other than issues with files/documents that might be open (TT could issue a warning before proceeding), it seems that it might eliminate the need to restart the Finder. I admit that I haven’t used TatorTop yet so I may be speaking from left field. :stuck_out_tongue:

Jon, is there anything that you know of that would prevent TT from working in Jaguar? If not, I’ll go ahead and do some testing.

– Rob

Rob, I think it should work fine in 10.2.x. I know that disclaimer was pretty loud, I just don’t want anyone to lose data. The truth is that it is pretty hard to lose data but easy to misplace it. None of the commands for deleting the folders will work if the folders are not empty. The trouble would be if you place a file in one of the alternate desktops and then rotate or uninstall it altogether. I just want people to be aware of what is going on before it does its magic.

think for now I’m going to stick with multiple folders–it’s just much faster than trying to capture all the files & icon positions and then move it all back (although I have code for this if anyone is interested).

The further I develop this, the more I’ve been thinking about its usefulness to users. If you were giving a demo from your PowerBook, you could very quickly switch to a clean desktop with your company logo as the desktop picture. One more quick rotation and you have all of your aliases for launching the demo. One more rotation returns you to your original (and in my case) totally over-crowded desktop with all of my current project files strewn about.

Anyway, thanks for looking into it. I made some very good progress today and should have a new beta in the next few days with just about everything I want to get in for the first release. Still, thoughts, comments, suggestions, criticisms are strongly encouraged.

Thanks,
Jon

I must say that based on my first use, TT works very well in Jaguar. My first impression is that this will be a very useful app for many users.

Feature Idea:

Building on your presentation example, if the switch could be activated by a keystroke, switching would be almost seamless. Here’s my rough idea:

  1. Keep the current app for use by non-power users and as the configuration mechanism for power users.
  2. Create a faceless, scriptable app (daemon) that can do the switching when commanded to do so by a script.
  3. Power users assign a keystroke to run a script that switches to Desktop 1, Desktop 2 or Desktop 3 (an individual script for each Desktop).

This would allow ttd (TaterTop daemon) to work quickly and invisibly (to those viewing the presentation). ttd could be optional at install time. :slight_smile:

– Rob

I like this app, though it wont be getting as much use as your script to markup code app in the near future when I do the complete rewrite of iMagine’s documentation.

It is stable for such an early beta, and it has a real professional feel to it. I wish I could achieve that so quickly.

Two things that I noticed while running it. I hadn’t bothered copying TaTor to my apps folder and my default download directory is my desktop, so after running Tator, switching desktops and then quiting Tator, and since I hadn’t read the docs I didn’t know where Tator was anymore. Luckily the system did so I found Tator easily in recent items. Secondly my desktop folder icon in my finder window in the left hand column is now just a standard folder icon, rather than the usual desktop icon look. I’ll post again after logging in and out and see if that restores itself.

Kevin

Thanks. Glad to hear people are getting some use out of “Convert Script…”

Yes, this is a major problem. That’s what I was getting at that you won’t lose data but you may misplace it. Thinking about that some more, you actually may lose data if you are working on a file opened from the desktop and it is still open when you run the TT install/uninstall utility and the application with open documents doesn’t know how to resolve the moved file. This may be a stopper for releasing this to the general public. I’ll have to see what I can do about the install/uninstall utility to make sure all open files are closed. If I can do that, then there will be very little chance of lost data. The recent items feature doesn’t have a problem with this because it relies on aliases which will resolve correctly to the moved files. OT: The way the Finder indicates that a symbolic link is an alias is frustrating because it doesn’t resolve to the original item if that item is moved.

Yes, I’ve noticed this too. It doesn’t come back through a re-login or even a restart but if you uninstall TT, it returns. Somehow the Finder is doing some magic to the icon. I’m working on it…

Thanks for the feed back. In other news, I’ve released TatorTop 1.0b2.

What’s new:

  • Added limited preference support.
  • Added limited status menu support. (See preferences.)
  • Enabled the “Check for Update” feature.
  • Made the annotations persistent through relaunch.
  • Enabled drag & drop in the desktop picture wells.
  • Added tool tips. (You can trun them off via the preferences.)
  • Added progress bars for install/uninstall.
  • Improved the authentication routine with better error messages.
  • Added option to uninstall after the evaluation period is over. (Needs a little more work.)
  • Streamlined the internal install and uninstall routines.
  • Changed the uninstall utility to only move alternate desktop folders to the desktop if the alternate folder is not empty.
  • Fixed the “Go to Website” button during the registration routine.
  • Fixed a bug that would prevent the desktop rotation if the specified desktop picture wasn’t found.
  • Lots of small code improvements.

Rob, the status menu feature essentially gives the user the control you were mentioning from a system-wide menu, albeit without the keyboard equivalents. I have developed some faceless scripts that function the same way as the menu but can be assigned to a key through the launcher of your choice (mine is xkeys) but that isn’t as attractive to me as the menu because the menu is self contained to the bundle. Let me know if this works for you or if I should pursue the daemon idea.

Speaking of the status menu, I finally figured out how to get this working (though a nifty workaround–it’s a separate application in the app bundle that is entirely written in Obj-C, not AS Studio and relies on the original app’s interface by telling that app’s controls to “perform action”) so it looks like it’s time to rev FWM again…

In the future, the check for version update feature should work to download the latest version. In the mean time, the new beta can be downloaded directly from:

[url=http://homepage.mac.com/jonn8/tat/TaTb.hqx]http://homepage.mac.com/jonn8/tat/TaTb.hqx[/url]

Thanks again,
Jon

Jon,

Here are some random observations after using the new release for a short time…

  1. The first time I launched the latest release, I got a dialog asking “Where is TTSM.app?”, likely the result of a ‘tell app “TTSM”…’. I know where it is but I was unable to choose it because it didn’t show up in the list. It took several attempts to cancel the dialog . Once I got out of the loop, I quit TT and tried again. Everything worked as expected and the troublesome dialog didn’t appear.

This may have been due to having two copies (new and old) on my hard drive - the OS/Finder may have been confused when I moved the previous release from my beta test folder to the trash and then moved the new release to the beta test folder. The moves all happened just seconds before launching the new release and I’ve seen this confusion before, with other apps under similar conditions. It’s no biggie since everything worked out but I wanted to warn you in case it becomes an issue down the road.

  1. I discovered an alias named “Desktop” on my desktop. It points to the Desktop 1 folder (the container of the alias). I discovered this after playing with TT for a while so I’m not sure when the alias appeared. I did not use the uninstall feature.

  2. The status menu is nice and works fine in Jaguar so far. I encountered one unexpected behavior: TT becomes the frontmost app after using the status menu to switch desktops.

  3. I don’t need keystroke switching so demand for that would have to be guaged by feedback from others. Maybe you can revisit the issue post 1.0 based on user feedback. If no one asks for the feature, fuggetaboudit. :wink:

Kudos: I haven’t tested every new feature but, so far, the stuff that I’ve tested is working fine. Very slick!

– Rob (who probably should have consumed more coffee before testing and responding)

Hi all,

I really appreciate you guys taking a look at this app but I think I need to pull the plug on it. It is just too easy to lose data if you switch desktops while other apps are open. For instance, if you have Safari set to download to the desktop, when you launch Safari, it grabs the path to the desktop. If you then rotate desktops using TatorTops and then download something in Safari, it will be saved in the folder that was the desktop when Safari was launched regardless of which folder is currently the desktop. If an application released by Apple behaves this way, it’s a pretty good bet that many, many others will do the same. So, even if a file isn’t open on the current desktop, you could still really screw up something (or confuse users prompting a flood of angry emails) and I just don’t think it’s worth it.

So, with that, if you’ve installed TT, you should probably use the uninstall utility to remove the modifications to your system and trash the app. Again, be sure to quit all open apps, then run TT & select “Uninstall…” from the application menu. The TT webpage has been taken down and the beta is no longer available.

Still, this was worthwhile and the status menu code will soon make an appearance in FWM. Stay tuned.

Thanks again,
Jon

Too bad (the decision to pull the plug) but I understand your concern and I’m glad that something useful came of it. :slight_smile:

– Rob

Thanks for the support, Rob.

If anyone is still interested in some of the functionality of TT, you should take a look at the freeware menu app Deviant.

Jon