Clarity

True Multiple Desktops on Mac OS

A free open source Python application for increased productivity by Ben Shirt-Ediss
Updated June 2021: Added support for Mac OS Big Sur and the ability to share desktops across multiple Macs
Switch Between Desktops

True Multiple Desktops

Mission Control on Mac OS lets the user "switch between desktops". However, this really just means switching between different sets of open windows. The files displayed on the desktop in the background always remain the same. Often the desktop ends up being one big cluttered mess of files, which is not really a good use of the desktop.

Clarity is a free open source application for Mac OS that allows the user to effectively have multiple desktops, each with their own file layout, and to switch which one is displayed as the current desktop.

Clarity boosts organisation and productivity because different projects can be assigned to different desktops. Want a desktop for finance files, another for work files and a third for creative project files? That's fine: switching desktop instantly puts the relevant files right at your fingertips ready for working on. Clarity is also useful when giving sharing-screen presentations as an empty desktop can be switched to at any time (sparing your audience from seeing all of your desktop digital life).

Finally, Clarity does not interfere with Mission Control: the window group displayed over the top of current desktop files can be changed with Mission Control, just as it was before.

Download

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

Install

Installation is manual and requires using the Terminal. This can be opened by searching for Terminal.app on your Mac.

STEP 1: 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:

python3 --version

If the 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 Mac OS. 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

STEP 2: 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 the Clarity application folder: in future, it will store all of the files and folders on each of the desktops. At the moment, it has just one folder inside called _clarity where the Python files that run the Clarity application reside.

An alternative way to get the application is to open Terminal and clone the code repository by entering:

git clone https://bitbucket.org/ben_s_e/clarity; mv clarity desktops

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

Personally, I find it convenient to place the Clarity application folder in Dropbox, so that all of my desktop files will be backed up, and so that I can use Clarity across multiple Macs (see later). But using another cloud drive folder like Google Drive etc. should work just as well.

In my case, I moved the desktops folder to /Users/ben/Dropbox/desktops. I will use this example for the remainder of the instructions.

STEP 3: 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 folder. For example, I would type:

cd /Users/ben/Dropbox/desktops/_clarity

Then set execute permissions for all of the Python files by typing:

chmod +x *.py

STEP 4: Make changes to your .zprofile (or .bash_profile) file

The following changes allow Clarity to be controlled from short commands from the Terminal.

If you are using the ZSH shell for Terminal (which you may well be if you are on Mac OS Catalina, Big Sur or newer - look in the title bar of Terminal), type the following in Terminal:

cd $HOME

touch .zprofile

open -a TextEdit .zprofile

If you are using the BASH shell for Terminal, type the following in Terminal instead:

cd $HOME

touch .bash_profile

open -a TextEdit .bash_profile

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

export PATH=$PATH:/Users/ben/Dropbox/desktops/_clarity

alias sw="switch_desktop.py"

alias xd="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 fully quit and close the Terminal!

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

echo $PATH

In my case, the PATH variable will contain the path /Users/ben/Dropbox/desktops/_clarity.

STEP 5: Set Clarity application settings

Finally, Clarity needs to be told where your Desktop folder is located and where the Clarity application folder is located on your Mac.

Open the file settings.py in the desktops/_clarity folder.

  • Set DESKTOP_PATH to be the path to your Desktop folder. For example, on my system, I set DESKTOP PATH = "/Users/ben/Desktop"
  • Set APP_PATH to be the path to your Clarity app folder. For example, on my system, I set APP_PATH = "/Users/ben/Dropbox/desktops"

Now installation is complete.

STEP 6: Test!

Open Terminal, and type:

sw

If installation of Clarity was successful, a list of two desktops should be displayed:

Clarity Desktops

>>>> 0    Empty Desktop

     *    New Desktop (waiting to be assigned)

If your Desktop currently has no files or folders, the arrow will be next to "Empty Desktop". Otherwise, if your Desktop has content, the arrow will be next to "New Desktop (waiting to be assigned)".

Note: You may get the warning below. Click OK: Clarity requires access to Finder in order to find out what icons are on the Desktop and their display locations.

Access to Finder - Authorise

Quick Example

Clarity is controlled by four Terminal commands:

sw Switch Desktop (or display a list of all desktops available)
ad Assign Desktop
rd Renumber/Rename Current Desktop
xd 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 already has the following items:

Desktop 1

Open Terminal and enter:

sw

This will display a list of desktops available:

Clarity Desktops

     0    Empty Desktop

>>>> *    New Desktop (waiting to be assigned)

The blue arrow always shows which desktop is currently displayed.

Right now, your current desktop has files, but it is not know to Clarity. That is, it is a "New Desktop" waiting to be assigned a number and name, so that Clarity knows about it.

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

ad 1 home

Your desktop has now been remembered as Desktop 1, as the updated desktop list shows:

Clarity Desktops

     0    Empty Desktop

>>>> 1    home

     *    New Desktop (waiting to be assigned)

Now, when you switch away from this desktop to another one, all the folders and files (and their exact desktop positions) are saved! When you switch back to this desktop in future, they will be put back.

So, lets try that out by switching to the empty desktop (which is always Desktop 0). Entering:

sw 0

Gives:

Clarity Desktops

>>>> 0    Empty Desktop

     1    home

     *    New Desktop (waiting to be assigned)

Desktop 2

All of your files and folders disappear, giving an empty desktop. But don't worry - your files are safely stored in the Clarity app folder (look in subfolder 1/ there).

Your original desktop can be brought back again by typing:

sw 1

Clarity Desktops

     0    Empty Desktop

>>>> 1    home

     *    New Desktop (waiting to be assigned)

Desktop 1

Note: If you're Clarity application folder is in Dropbox (like mine is), Dropbox can complain at this stage, as below. Click "Don't ask me again" and "Move about of Dropbox".

Dropbox Complain

Now rename the current desktop by using the rd command (meaning "renumber/rename desktop"). We will keep the desktop number as 1, but name it "current" instead:

rd 1 current

Clarity Desktops

     0    Empty Desktop

>>>> 1    current

     *    New Desktop (waiting to be assigned)

Now, switch back to the empty desktop:

sw 0

And then add some new files and folders. So, for example the desktop may now look like this:

Desktop 3

By adding files, the desktop has gone from "Empty" to a "New Desktop" that needs to be assigned a number and name for Clarity to recognise it. Typing sw in Terminal to list all desktops confirms this:

sw

Clarity Desktops

     0    Empty Desktop

     1    current

>>>> *    New Desktop (waiting to be assigned)

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

ad 5 math-project

Clarity Desktops

     0    Empty Desktop

     1    current

>>>> 5    math-project

     *    New Desktop (waiting to be assigned)

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 new desktop a number and name.

Finally, to delete a desktop, first switch away from it and then use the xd command. For example, to delete desktop 5 just added, first switch e.g. to desktop 1:

sw 1

And type:

xd 5

Note that the delete desktop xd command permanently deletes files - they do not go into the Trash, so a written confirmation "yes" is required.

And that's it -- you know all the Clarity commands!

File Storage

All files for desktops that are not currently displaying are stored in the Clarity application folder. Navigate to the desktops folder using Finder (in my example /Users/ben/Dropbox/desktops).

Desktop files are in the subfolder with the desktop number:

Clarity Folders

Feel free to manually add or delete files/folders in these folders at any time, Clarity won't mind. Note that items on the currently displaying desktop are not in the Clarity application folder -- they are in the Desktop folder!

Hate Terminal?

If you prefer to avoid using Terminal as far as possible you can easily make an app that sits in the Dock and switches to a certain desktop when clicked. (You must originally set up the desktops in Terminal, however, following the Quick Example above).

STEP 1: Open Script Editor

Open Script Editor.app, and enter the following:

do shell script "cd /Users/ben/Dropbox/desktops/_clarity; python3 switch_desktop.py 1"

Script Editor

Replace the /Users/ben/Dropbox/desktops part with the path to your Clarity application folder.

Replace the number after the switch_desktop.py part with the number of the desktop you want to switch to, when clicking the app.

STEP 2: Save the App

Click File, Export... and in the dialog box where it says "File Format" select "Application". Give a name to the application, and save e.g. to the Desktop.

Close Script Editor, and press "Delete" when it asks you if you want to save the script.

In Finder, move the exported app file to the /Applications folder. Then, drag the app to the Dock. Clicking the app in the Dock will change to the desktop you specified.

Note that Mac OS may show some security pop up boxes when first clicking the app, simply OK them:

App Block Desktop App Block Finder

Follow Steps 1 and 2 above to create an app for each desktop that you want quick access to.

Minor Issues

Clarity works by physically moving files and folders 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.

☞  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.

☞  In very rare cases, file names can contain strange characters that do not play nice with Clarity and prevent the desktop from switching.

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 Mac OS Mojave and later, 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.

Multiple Macs

Clarity is also designed to work across multiple Macs. Files and folders from one desktop can be displayed and editted on one Mac, and when the desktop is switched away from, it is free to be grabbed by another Mac. The Macs may even have different resolution displays.

1. First of all, the Clarity application folder needs to be in a Cloud Drive folder available on all Macs (Google Drive, Dropbox etc).

2. Second, the Clarity application folder needs to be at the same path on all Macs. For example, I use Dropbox and have the folder /Users/ben/Dropbox/desktops existing on two Macs. (For coding geeks: This requirement is because the same settings.py file is shared between all Clarity applications.)

3. When Clarity is installed on the first Mac, the application files exist on all other Macs via the cloud drive folder. So, simply follow installation steps 1, 3 and 4 on the other Macs.

4. The Clarity commands should now work on the other Macs.

Note that when you switch to a desktop on one Mac, it goes red in the desktops list, and another Mac cannot request it until it is switched away from.

Tip: When switching away from a desktop, wait for your cloud drive to sync before requesting that desktop on another Mac.

Licence

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

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