Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save fabrizziosoares/f7d01c95b4485279de80fcdb90d78a1a to your computer and use it in GitHub Desktop.

Select an option

Save fabrizziosoares/f7d01c95b4485279de80fcdb90d78a1a to your computer and use it in GitHub Desktop.
The following shows how you can tell macOS to assign an application to always show on all desktops, one specific desktop, or to unbind it.

macOS - Setting 'Assign to Desktop' via Terminal

The following shows how you can tell macOS to assign an application to show on one specific desktop, all desktops, or just a single desktop.

Show Current Config

⇒ defaults read com.apple.spaces app-bindings
{
    "com.apple.activitymonitor" = AllSpaces;
    "com.googlecode.iterm2" = AllSpaces;
    "com.riotgames.riotgames.riotclientux" = AllSpaces;
    "com.toggl.toggldesktop.toggldesktop" = AllSpaces;
    "org.audacityteam.audacity" = "7B8802D8-756C-445B-AE72-23FCABFC74C4";
    "org.whispersystems.signal-desktop" = AllSpaces;
    "ru.keepcoder.telegram" = AllSpaces;
}
⇒ /usr/libexec/PlistBuddy -c "Print :app-bindings" ~/Library/Preferences/com.apple.spaces.plist
Dict {
    ru.keepcoder.telegram = AllSpaces
    com.googlecode.iterm2 = AllSpaces
    com.riotgames.riotgames.riotclientux = AllSpaces
    com.toggl.toggldesktop.toggldesktop = AllSpaces
    org.whispersystems.signal-desktop = AllSpaces
    com.apple.activitymonitor = AllSpaces
    org.audacityteam.audacity = 7B8802D8-756C-445B-AE72-23FCABFC74C4
}

Assign to 'None'

⇒ /usr/libexec/PlistBuddy -c "Delete :app-bindings:im.beeper" ~/Library/Preferences/com.apple.spaces.plist
# successfully deleted

⇒ killall Dock
# to ensure it is updated properly based on the plist changes
⇒ /usr/libexec/PlistBuddy -c "Delete :app-bindings:im.beeper" ~/Library/Preferences/com.apple.spaces.plist
Delete: Entry, ":app-bindings:im.beeper", Does Not Exist

Assign to 'This Desktop' (or a specific desktop)

Note: I haven't tested this

⇒ /usr/libexec/PlistBuddy -c "Add :app-bindings:im.beeper string TODO-THE-UUID-OF-THE-DESKTOP" ~/Library/Preferences/com.apple.spaces.plist

⇒ killall Dock
# to ensure it is updated properly based on the plist changes

Assign to 'All Desktops'

⇒ /usr/libexec/PlistBuddy -c "Add :app-bindings:im.beeper string AllSpaces" ~/Library/Preferences/com.apple.spaces.plist

⇒ killall Dock
# to ensure it is updated properly based on the plist changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment