Category filter
Script to enable/disable Stage Manager on Mac
This document provides a script to enable or disable stage manage on Mac. Stage Manager for macOS is a feature that helps you organize the opened applications on your devices. It allows you to find and switch between the apps on the screen without any hassle. This feature positions the currently active app in the center of the screen, while other minimized apps appear as small thumbnails beside it. Users can simply click on its corresponding thumbnail to switch to a different app. The setting is helpful when multitasking on various tasks. While this feature is disabled by default, when you want to enable it across your digital workspace, you can use the script described here. The doc also helps you with a script to disable Stage Manager. These scripts can be executed using Hexnode’s Execute Custom Script action.
Scripting language – Bash
File extension – .sh
Script to enable Stage Manager
1 2 3 4 5 6 7 8 9 10 11 |
#!/bin/bash CurrentUser=$(ls -l /dev/console | awk '/ / { print $3 }') echo "$DATE Current user = $CurrentUser" CurrentUserUID=$(id -u "$CurrentUser") echo "Current user UID = $CurrentUserUID" launchctl asuser $CurrentUserUID sudo -iu "$CurrentUser" defaults write com.apple.WindowManager GloballyEnabled -bool true |
com.apple.windowManager – It is a system process responsible for managing the windows and GUI (Graphical User Interface) elements on screen.
In the above script, the defaults write com.apple.WindowManager GloballyEnabled –bool true command enables Stage Manager.
Script to disable Stage Manager
1 2 3 4 5 6 7 8 9 10 11 |
#!/bin/bash CurrentUser=$(ls -l /dev/console | awk '/ / { print $3 }') echo "$DATE Current user = $CurrentUser" CurrentUserUID=$(id -u "$CurrentUser") echo "Current user UID = $CurrentUserUID" launchctl asuser $CurrentUserUID sudo -iu "$CurrentUser" defaults write com.apple.WindowManager GloballyEnabled -bool false |
In the above script, the defaults write com.apple.WindowManager GloballyEnabled –bool false command disables Stage Manager.
You can easily verify its outcome by checking the Control Centre. The Stage Manager option will be enabled or disabled based on the script you run.
Scripts to modify Stage Manager settings
Stage Manager has several settings that you can customize according to your needs.
Show/Hide recent applications
1 2 3 4 5 |
#!/bin/bash CurrentUser=$(ls -l /dev/console | awk '/ / { print $3 }') su -l $CurrentUser -c 'defaults write com.apple.WindowManager AutoHide -bool false' |
defaults write com.apple.WindowManager AutoHide -bool [True/False] Adjusts auto hide behavior. This option controls the “Show Recent Apps” and “Hide Recent Apps” GUI option.
-bool true: The recent applications will not be visible on the left side of the screen when minimized.
-bool false: The recent applications will be visible on the left side of the screen when minimized.
Modify display behavior of application windows
1 2 3 |
#!/bin/bash CurrentUser=$(ls -l /dev/console | awk '/ / { print $3 }') su -l $CurrentUser -c 'defaults write com.apple.WindowManager AppWindowGroupingBehavior -bool false' |
AppWindowGroupingBehavior – This parameter determines which window needs to be shown when you switch to an application. There are two options available: ‘All at Once’ and ‘One at a Time’.
- All at Once (-bool false): When you switch to an application, all its windows will be displayed at the same time.
- One at a Time (-bool true): When you switch to an application, only one of its windows will be displayed at a time. The other windows will be hidden.
These options are available as drop-down menu options within the ‘Show windows from an application’ setting in Stage Manager on the device end. Once the above-mentioned script is executed, the option would get configured accordingly. For example, in the above script defaults write com.apple.WindowManager AppWindowGroupingBehavior -bool false sets the option All at Once.