Switch Between Desktops

True Multiple Desktops

Mission Control on macOS lets the user "switch between desktops". However, this really just means switching between different sets of open windows. The desktop icons in the background always remain the same.

It would be useful to have multiple desktops in the true sense, where the desktop icons can also be changed between different sets of icons. This would allow different projects to be developed on different desktops, for example, boosting organisation and productivity.

Clarity is a free open source application written in Python for macOS, that allows the user to have effectively multiple Desktop folders, and to choose which one is currently displayed as icons on the desktop. (Maybe one day Apple will implement this neat feature).

To note: Clarity does not interfere with Mission Control. The window group displayed over the top of the desktop icons can be changed with Mission Control, just as it was before.


    Download Clarity for macOS (.zip file)    

Tested on macOS High Sierra (10.13) and Mojave (10.14).

If you find Clarity useful and want to donate a small amount, you can buy me a coffee. It is appreciated!


Installation is manual and requires using the Terminal.

❶ Check Python 3 is installed.

Clarity is written in Python 3, and so a working version of this programming language is required. Open the Terminal app, and check the system python version by typing:

$ python --version


$ python3 --version

If the first command returns a version of Python that is 2.x and the second command returns "command not found", then Python 3 does not exist and needs to be installed.

An easy way to install Python 3 is via Homebrew - a package management system for macOS. To install Homebrew, open Terminal and type:

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Once Homebrew is installed (installation can take a while), tell Homebrew to install Python 3 by typing the following in Terminal:

$ brew install python

Finally, verify Python 3 is installed properly by checking the version number:

$ python3 --version

❷ Set up a folder for the Clarity application.

Double click the zip file downloaded above, to extract the folder inside it. Depending on system configuration, the zip file may already be unzipped in your Downloads folder.

Rename the unzipped folder as desktops. This folder is going to be the Clarity application folder. In future, this folder will store all of the files and folders on each of the desktops. At the moment, it has just one folder inside called clarity-code where the Python files that run the Clarity application reside.

Move the desktops folder to somewhere on your system, but make sure all folders on the path to this folder have no spaces.

For example, I find it convenient to place the Clarity application folder in Dropbox, so its path is /Users/ben/Dropbox/desktops. I will use this example for the remainder of the instructions.

❸ Set file permissions.

All the python files of the Clarity application need to have execute permissions set, so they can be run with a single command.

Open Terminal and change to the desktops/clarity-code folder. For example, I would type:

$ cd /Users/ben/Dropbox/desktops/clarity-code

Then set execute permissions for four files by typing:

$ chmod +x assign_desktop.py

$ chmod +x delete_desktop.py

$ chmod +x switch_desktop.py

$ chmod +x renumber_desktop.py

❹ Make a symbolic link to the system Desktop folder.

This step creates a special folder in the Clarity application folder which is a symbolic link to the Desktop folder on the current machine. The contents of this special folder exactly mirror the contents of the Desktop folder.

Open Terminal and type:

$ ln -s $HOME/Desktop/ /Users/ben/Dropbox/desktops/mymac

Where the path /Users/ben/Dropbox/desktops is (obviously) changed for the path to your Clarity app folder. Don't forget to add the "mymac" folder on the end.

❺ Make changes to .bash_profile

The following changes allow Clarity to be controlled from short commands from the Terminal. Open Terminal, and type:

$ cd $HOME

$ open -a TextEdit .bash_profile

If the error "The file does not exist" is displayed, type the following to first create the file:

$ touch .bash_profile

$ open -a TextEdit .bash_profile

In TextEdit, add these lines at the bottom of the .bash_profile file:

export PATH=$PATH:/Users/ben/Dropbox/desktops/clarity-code

alias sw="switch_desktop.py"

alias dd="delete_desktop.py"

alias ad="assign_desktop.py"

alias rd="renumber_desktop.py"

Where the /Users/ben/Dropbox/desktops part is again changed for the path to your Clarity app folder.

Save the file, then quit TextEdit via the menu TextEdit → Quit Text Edit.

Next, quit Terminal via the menu Terminal → Quit Terminal. It is important to quit Terminal.

Open Terminal again. Check that your system PATH variable now includes the path to the desktops/clarity-code folder (probably listed as the last entry) by typing:

$ echo $PATH

In the example, the PATH variable will contain the path /Users/ben/Dropbox/desktops/clarity-code.

❻ Set application settings.

Clarity needs to be told where the relevant folders set up above are.

Using TextEdit, open the file settings.py in the desktops/clarity-code folder.

  • Under #SETTING1, change the folder name in quotes to be the path to your Desktop folder. (e.g. on my system, this is /Users/ben/Desktop)
  • Under #SETTING2, change the folder name in quotes to be the path to your Clarity app folder. (e.g. on my system, this is /Users/ben/Dropbox/desktops)
  • Under #SETTING3, change the folder name in quotes to be the path to the Desktop symlink in Step 4. (e.g. on my system, this is /Users/ben/Dropbox/desktops/mymac)

❼ Test!

Quit all programs.

Open Terminal, and type:

$ sw

If installation was successful, a list of desktops similar to the following should be displayed:

>>>> 0    (Empty Desktop)

     -    (Assign Desktop a number)

Note: If the message box "Terminal wants access to control Finder" appears at any point, click OK to allow.

Quick Example

Clarity is controlled by four terminal commands:

sw Switch Desktop
ad Assign Desktop
rd Renumber/Rename Desktop
dd Delete Desktop

The example below shows how they are used.

Suppose that you have just installed Clarity according to the above instructions, and that your desktop has the following items:

Desktop 1

Open Terminal and type command sw to list all of the desktops available:

$ sw


     0    (Empty Desktop)

>>>> -    (Assign Desktop a number)

The green arrow to the left denotes which desktop is currently displayed.

Right now, the current desktop is not known to Clarity and it needs to be assigned a number and name.

In Terminal, add this desktop to Clarity by using the ad command (meaning "assign desktop"). We will give the desktop number 1 and name "home":

$ ad 1 home


     0    (Empty Desktop)

>>>> 1    home

     -    (Assign Desktop a number)

Your desktop has now been remembered as Desktop 1. When you switch away from this desktop to another one, all folders and files are recorded, including their positions, so that you can go back this desktop at any point. So, lets switch to the empty desktop (which is always Desktop 0):

$ sw 0


>>>> 0    (Empty Desktop)

     1    home

     -    (Assign Desktop a number)

Desktop 2

All of your files and folders disappear, but they are safely stored in the Clarity app folder.

The original desktop can be brought back again by typing sw 1 in Terminal. However, we won't do that now. Instead, we will put some new items on the desktop, such as files for a maths project we are currently working on:

Desktop 2

By adding files, the desktop has gone from an empty state, to a new desktop that needs to be assigned a number and name. Typing sw in Terminal confirms this:

$ sw


     0    (Empty Desktop)

     1    home

>>>> -    (Assign Desktop a number)

So now we assign our new desktop to be number 5 and give it name "math-project":

$ ad 5 math-project


     0    (Empty Desktop)

     1    home

>>>> 5    math-project

     -    (Assign Desktop a number)

☞  This is the general way new desktops are added to Clarity: The Empty Desktop is switched to, files are added (or not) to the desktop, and then the ad command is used to assign the desktop a number and name.

Now thinking again, you realise that the desktop would be better called "january-math-project" and assigned number 2. Use the rd command ("renumber or rename desktop") to change the number and/or name of the current desktop:

$ rd 2 january-math-project


     0    (Empty Desktop)

     1    home

>>>> 2    january-math-project

     -    (Assign Desktop a number)

Now, switch back to the original Desktop:

$ sw 1


     0    (Empty Desktop)

>>>> 1    home

     2    january-math-project

     -    (Assign Desktop a number)

Desktop 4

...And the files and folders magically re-appear at their original locations.

Next, go into the Clarity application folder desktops using Finder. There will be two folders numbered 1 and 2. These are the files and folders on desktop "home" and desktop "january-math-project" respectively. Feel free to manually add or delete files/folders in these folders at any time. Also feel free to move contents from one numbered desktop folder to another.

Imagine now that you decide to delete the math project desktop. Open Terminal and use the dd command ("delete desktop"). This command permanently deletes files - they do not go into the Trash, so a written confirmation "yes" is required.

$ dd 2


Are you sure that you want to delete Desktop 2 [january-math-project]?


All files on this Desktop will be PERMANENTLY deleted (not put in the Trash).

Respond by typing "yes" or "no":



Desktop 2 [january-math-project] deleted.


     0    (Empty Desktop)

>>>> 1    home

     -    (Assign Desktop a number)

And that's it.


Clarity works by physically moving files into and out of the Desktop folder. File moving leads to the following minor issues that you should be aware of:

☞  Applications can complain if (1) an application opens a file from one desktop, (2) the desktop is switched, and then (3) the application is asked to re-save the file. The application will no longer be able to find the file. To remedy, a little user discipline is required: when saving a file in an application, just make sure that the desktop the file came from is the current desktop.

☞  When the Clarity application folder is in Dropbox, "conflicted copies" of files and folders can result if the desktop is switched before Dropbox has finished synchronising. To remedy, simply make sure that Dropbox has finished synchronising before switching desktops. As a precaution, Clarity will let you know if it detects conflicted versions of files.

☞  When the Clarity application folder is in Dropbox, try not to put very large files or folders on the desktop or else Dropbox will take a long time to re-sync once the desktop is switched. This seems to be an absurdity with how Dropbox works - when physically moving files, Dropbox seems to delete the original file and then make an entire new copy of it (very inefficient). Other cloud storage services may not suffer this problem.

Also note:

☞  If there are mounted file systems showing on the current desktop, these persist on the desktop as the desktop is switched.

☞  When using MacOS Mojave, the "Use Stacks" feature can be turned on or off, but desktop icon positioning will only work when this setting is off.

☞  Clarity checks the screen resolution before displaying desktop icons. If the screen resolution has changed since the desktop was last displayed, Clarity automatically re-scales all icon positions so that they display correctly at the new resolution.


Clarity is Copyright © Ben Shirt-Ediss, 2018. All rights reserved.

The program is free software. It comes without any warranty, to the extent permitted by applicable law. You can redistribute it and/or modify it under the terms of the Creative Commons Attribution-ShareAlike 4.0 International Licence. See https://creativecommons.org/licenses/by-sa/4.0/.

Creative Commons Licence

Buy Me a Coffee

Clarity is free software for anybody to download, use and modify. If you find it a really useful addition to your Mac (like I do), you can donate any amount that you feel appropriate at my Monzo profile: https://monzo.me/benshirtediss/. Multiple currencies from many countries are accepted with no fees, so long as you use a debit card. No donation amount is too small! I appreciate it, thank you.

Alternatively, I can also accept transfers of Euros, Pounds, and US/Australian/New Zealand Dollars to my bank account, again with no fees. Please email ben at shirt-ediss dot me for details.

I am an individual, not a non-profit organisation, and so unfortunately I cannot issue tax receipts for gifts.

This page is based on the Responsive Side Menu layout from Pure.css.