Skip to content

DesktopRenamer AppleScript Guide

Michael Y. Qiu edited this page Mar 30, 2026 · 2 revisions

DesktopRenamer supports AppleScript, allowing you to automate space management, renaming, and window positioning.

Commands

Space Management

get current space name

Get the custom name of the currently active space.

tell application "DesktopRenamer"
    set currentName to get current space name
    display dialog "You are on: " & currentName
end tell

get all spaces

Get a list of all detected spaces. The result is a newline-separated string where each line is formatted as ID~Name~DisplayID~Num.

tell application "DesktopRenamer"
    set allSpaces to get all spaces
    -- Example parsing: first space ID
    set AppleScript's text item delimiters to "~"
    set firstSpaceID to text item 1 of paragraph 1 of allSpaces
end tell

rename current space

Rename the currently active space.

tell application "DesktopRenamer"
    rename current space "Work Focus"
end tell

rename space [ID] to [Name]

Rename a specific space by its internal ID.

tell application "DesktopRenamer"
    rename space "1234-5678" to "Project Alpha"
end tell

switch to space [ID]

Switch to a specific space by its internal ID.

tell application "DesktopRenamer"
    switch to space "1234-5678"
end tell

Window Management

move window next

Move the currently active window to the next space on the current display.

tell application "DesktopRenamer"
    move window next
end tell

move window previous

Move the currently active window to the previous space on the current display.

tell application "DesktopRenamer"
    move window previous
end tell

move window to space [ID]

Move the currently active window to a specific space by its internal ID.

tell application "DesktopRenamer"
    move window to space "1234-5678"
end tell

UI Controls

toggle menubar

Toggle the visibility of the DesktopRenamer icon in the macOS menu bar. Returns the new visibility state (true for visible, false for hidden).

tell application "DesktopRenamer"
    toggle menubar
end tell

toggle labels

Toggle both the Active and Preview label windows.

tell application "DesktopRenamer"
    toggle labels
end tell

toggle active label

Toggle only the Active label window (the one showing the current desktop name).

tell application "DesktopRenamer"
    toggle active label
end tell

toggle preview label

Toggle only the Preview label window (the large labels shown during space switching or Mission Control).

tell application "DesktopRenamer"
    toggle preview label
end tell

toggle desktop visibility

Toggle the "Keep visible on desktop" setting for the Active label window.

tell application "DesktopRenamer"
    toggle desktop visibility
end tell

Practical Examples

Quick Space Rename Toggle

This script checks the current space name and toggles it between "Work" and "Break".

tell application "DesktopRenamer"
    set currentName to get current space name
    if currentName is "Work" then
        rename current space "Break"
    else
        rename current space "Work"
    end if
end tell

Move Window and Follow

This script moves the active window to the next space and then switches the display to that space.

tell application "DesktopRenamer"
    set allSpaces to get all spaces
    set currentID to "" -- (Implementation detail: you'd need logic to find next ID)
    
    move window next
    delay 0.5
    -- (Logic to switch to the known next ID)
end tell