Tutorial

Novas atualizações e melhorias para a Roundfleet.

Aviso importante

Os exemplos de código e scripts fornecidos nestes tutoriais são apenas para fins educacionais. A Roundfleet não é responsável por quaisquer problemas, danos ou vulnerabilidades de segurança que possam surgir do uso, modificação ou implementação destes exemplos. Sempre revise e teste o código em um ambiente seguro antes de usá-lo em sistemas de produção.

Configure Stage Manager on macOS Devices

Stage Manager is a powerful window management feature introduced in macOS Ventura that helps users organize and focus on their work by grouping windows and hiding inactive applications. This tutorial shows you how to manage Stage Manager settings across your Mac fleet using shell scripts.

What is Stage Manager?

Stage Manager is a window management system that:

  • Organizes windows into focused groups on the desktop
  • Reduces visual clutter by hiding inactive applications
  • Improves productivity by allowing users to switch between different work contexts
  • Supports external displays with independent Stage Manager controls
  • Integrates with Mission Control for enhanced window management

Prerequisites and Compatibility

System Requirements

  • macOS 13.0 (Ventura) or later - Stage Manager is not available on earlier versions
  • Supported devices: Mac computers with Apple Silicon (M1, M2, M3, M4) or Intel processors
  • Administrative privileges for script execution

Hardware Compatibility

Stage Manager works best on:

  • MacBook Pro and MacBook Air (2018 or later)
  • iMac (2019 or later)
  • Mac Studio (all models)
  • Mac Pro (2019 or later)
  • Mac Mini (2018 or later)

Basic Stage Manager Management

Enable Stage Manager

#!/bin/bash

# Script to enable Stage Manager on macOS
CurrentUser=$(ls -l /dev/console | awk '/ / { print $3 }')
CurrentUserUID=$(id -u "$CurrentUser")

echo "Roundfleet Stage Manager Enablement"
echo "Current user: $CurrentUser"
echo "Current user UID: $CurrentUserUID"

# Enable Stage Manager globally
launchctl asuser $CurrentUserUID sudo -iu "$CurrentUser" defaults write com.apple.WindowManager GloballyEnabled -bool true

echo "✅ Stage Manager has been enabled for user $CurrentUser"
echo "Changes will take effect after the next login or window manager restart"

Disable Stage Manager

#!/bin/bash

# Script to disable Stage Manager on macOS
CurrentUser=$(ls -l /dev/console | awk '/ / { print $3 }')
CurrentUserUID=$(id -u "$CurrentUser")

echo "Roundfleet Stage Manager Disablement"
echo "Current user: $CurrentUser"
echo "Current user UID: $CurrentUserUID"

# Disable Stage Manager globally
launchctl asuser $CurrentUserUID sudo -iu "$CurrentUser" defaults write com.apple.WindowManager GloballyEnabled -bool false

echo "❌ Stage Manager has been disabled for user $CurrentUser"
echo "Changes will take effect after the next login or window manager restart"

Advanced Stage Manager Configuration

Comprehensive Stage Manager Management Script

#!/bin/bash

# Advanced Stage Manager management for Mac fleet
DEVICE_NAME=$(scutil --get ComputerName)
CURRENT_USER=$(ls -l /dev/console | awk '/ / { print $3 }')
CURRENT_USER_UID=$(id -u "$CURRENT_USER")
MACOS_VERSION=$(sw_vers -productVersion)
LOG_FILE="/var/log/roundfleet_stage_manager.log"

# Function to log messages
log_message() {
    echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" | tee -a "$LOG_FILE"
}

# Function to check macOS version compatibility
check_compatibility() {
    local major_version=$(echo "$MACOS_VERSION" | cut -d. -f1)
    local minor_version=$(echo "$MACOS_VERSION" | cut -d. -f2)
    
    if [ "$major_version" -ge 13 ]; then
        echo "✅ macOS $MACOS_VERSION is compatible with Stage Manager"
        return 0
    else
        echo "❌ macOS $MACOS_VERSION is not compatible with Stage Manager (requires 13.0+)"
        return 1
    fi
}

# Function to get current Stage Manager status
get_stage_manager_status() {
    local status=$(launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults read com.apple.WindowManager GloballyEnabled 2>/dev/null)
    case "$status" in
        1) echo "enabled" ;;
        0) echo "disabled" ;;
        *) echo "undefined" ;;
    esac
}

# Function to enable Stage Manager
enable_stage_manager() {
    launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager GloballyEnabled -bool true
    log_message "Stage Manager enabled on $DEVICE_NAME for user $CURRENT_USER"
}

# Function to disable Stage Manager
disable_stage_manager() {
    launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager GloballyEnabled -bool false
    log_message "Stage Manager disabled on $DEVICE_NAME for user $CURRENT_USER"
}

# Function to configure recent apps visibility
configure_recent_apps() {
    local show_recent="$1"
    
    if [ "$show_recent" = "true" ]; then
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager AutoHide -bool false
        log_message "Recent apps visibility enabled"
        echo "✅ Recent applications will be visible on the left side"
    else
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager AutoHide -bool true
        log_message "Recent apps visibility disabled"
        echo "❌ Recent applications will be hidden"
    fi
}

# Function to configure window grouping behavior
configure_window_grouping() {
    local grouping_mode="$1"
    
    case "$grouping_mode" in
        "all_at_once")
            launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager AppWindowGroupingBehavior -bool false
            log_message "Window grouping set to 'All at Once'"
            echo "✅ Window grouping: All at Once"
            ;;
        "one_at_time")
            launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager AppWindowGroupingBehavior -bool true
            log_message "Window grouping set to 'One at a Time'"
            echo "✅ Window grouping: One at a Time"
            ;;
        *)
            echo "❌ Invalid grouping mode. Use 'all_at_once' or 'one_at_time'"
            return 1
            ;;
    esac
}

# Function to restart Window Manager
restart_window_manager() {
    launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" killall WindowManager 2>/dev/null
    sleep 2
    log_message "Window Manager restarted for user $CURRENT_USER"
}

# Function to validate Stage Manager configuration
validate_configuration() {
    local expected_state="$1"
    local current_state=$(get_stage_manager_status)
    
    if [ "$current_state" = "$expected_state" ]; then
        echo "✅ Configuration validation successful: Stage Manager is $expected_state"
        return 0
    else
        echo "❌ Configuration validation failed: Expected $expected_state, got $current_state"
        return 1
    fi
}

# Main execution
echo "Roundfleet Stage Manager Configuration"
echo "==================================="
echo "Device: $DEVICE_NAME"
echo "User: $CURRENT_USER"
echo "macOS Version: $MACOS_VERSION"
echo ""

log_message "Starting Stage Manager configuration on $DEVICE_NAME"

# Check compatibility
if ! check_compatibility; then
    log_message "Stage Manager configuration aborted due to compatibility issues"
    exit 1
fi

# Display current status
echo "Current Stage Manager status: $(get_stage_manager_status)"
echo ""

# Configuration options (uncomment as needed)
# enable_stage_manager
# disable_stage_manager
# configure_recent_apps "true"
# configure_window_grouping "all_at_once"
# restart_window_manager

log_message "Stage Manager configuration completed"

Interactive Stage Manager Configuration

#!/bin/bash

# Interactive Stage Manager configuration tool
CURRENT_USER=$(ls -l /dev/console | awk '/ / { print $3 }')
CURRENT_USER_UID=$(id -u "$CURRENT_USER")
MACOS_VERSION=$(sw_vers -productVersion)

# Function to get current Stage Manager status
get_stage_manager_status() {
    local status=$(launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults read com.apple.WindowManager GloballyEnabled 2>/dev/null)
    case "$status" in
        1) echo "enabled" ;;
        0) echo "disabled" ;;
        *) echo "not configured" ;;
    esac
}

# Function to get recent apps setting
get_recent_apps_status() {
    local status=$(launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults read com.apple.WindowManager AutoHide 2>/dev/null)
    case "$status" in
        1) echo "hidden" ;;
        0) echo "visible" ;;
        *) echo "not configured" ;;
    esac
}

# Function to get window grouping setting
get_window_grouping_status() {
    local status=$(launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults read com.apple.WindowManager AppWindowGroupingBehavior 2>/dev/null)
    case "$status" in
        1) echo "one at a time" ;;
        0) echo "all at once" ;;
        *) echo "not configured" ;;
    esac
}

# Function to display current configuration
display_current_config() {
    echo "Current Stage Manager Configuration:"
    echo "==================================="
    echo "Stage Manager: $(get_stage_manager_status)"
    echo "Recent Apps: $(get_recent_apps_status)"
    echo "Window Grouping: $(get_window_grouping_status)"
    echo ""
}

# Main interactive menu
echo "Roundfleet Stage Manager Interactive Configuration"
echo "==============================================="
echo "Device: $(scutil --get ComputerName)"
echo "User: $CURRENT_USER"
echo "macOS Version: $MACOS_VERSION"
echo ""

# Check compatibility
major_version=$(echo "$MACOS_VERSION" | cut -d. -f1)
if [ "$major_version" -lt 13 ]; then
    echo "❌ Stage Manager requires macOS 13.0 or later"
    echo "Current version: $MACOS_VERSION"
    exit 1
fi

display_current_config

echo "Configuration Options:"
echo "1. Enable Stage Manager"
echo "2. Disable Stage Manager"
echo "3. Show recent applications"
echo "4. Hide recent applications"
echo "5. Set window grouping to 'All at Once'"
echo "6. Set window grouping to 'One at a Time'"
echo "7. Apply recommended settings"
echo "8. Reset to defaults"
echo "9. Display current configuration"
echo "0. Exit"
echo ""

read -p "Enter your choice (0-9): " choice

case $choice in
    1)
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager GloballyEnabled -bool true
        echo "✅ Stage Manager enabled"
        ;;
    2)
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager GloballyEnabled -bool false
        echo "❌ Stage Manager disabled"
        ;;
    3)
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager AutoHide -bool false
        echo "✅ Recent applications will be visible"
        ;;
    4)
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager AutoHide -bool true
        echo "❌ Recent applications will be hidden"
        ;;
    5)
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager AppWindowGroupingBehavior -bool false
        echo "✅ Window grouping set to 'All at Once'"
        ;;
    6)
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager AppWindowGroupingBehavior -bool true
        echo "✅ Window grouping set to 'One at a Time'"
        ;;
    7)
        # Apply recommended enterprise settings
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager GloballyEnabled -bool true
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager AutoHide -bool false
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager AppWindowGroupingBehavior -bool false
        echo "✅ Applied recommended enterprise settings"
        ;;
    8)
        # Reset to system defaults
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults delete com.apple.WindowManager GloballyEnabled 2>/dev/null
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults delete com.apple.WindowManager AutoHide 2>/dev/null
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults delete com.apple.WindowManager AppWindowGroupingBehavior 2>/dev/null
        echo "✅ Reset to system defaults"
        ;;
    9)
        display_current_config
        ;;
    0)
        echo "Exiting..."
        exit 0
        ;;
    *)
        echo "Invalid choice. Please try again."
        ;;
esac

echo ""
echo "Configuration updated. Changes may require logout/login to take full effect."
echo "You can verify the changes in System Settings > Desktop & Dock > Stage Manager."

Enterprise Deployment Scripts

Bulk Stage Manager Configuration

#!/bin/bash

# Enterprise Stage Manager deployment script
COMPANY_NAME="Roundfleet"
DEPLOYMENT_DATE=$(date +"%Y-%m-%d")
LOG_FILE="/var/log/roundfleet_stage_manager_deployment.log"
REPORT_FILE="/tmp/stage_manager_deployment_report_$(date +%Y%m%d_%H%M%S).txt"

# Configuration settings
STAGE_MANAGER_ENABLED=true
RECENT_APPS_VISIBLE=true
WINDOW_GROUPING_MODE="all_at_once"  # Options: "all_at_once" or "one_at_time"
RESTART_WINDOW_MANAGER=true

# Function to log messages
log_message() {
    echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" | tee -a "$LOG_FILE"
}

# Function to check macOS compatibility
check_macos_compatibility() {
    local macos_version=$(sw_vers -productVersion)
    local major_version=$(echo "$macos_version" | cut -d. -f1)
    
    if [ "$major_version" -ge 13 ]; then
        log_message "macOS $macos_version is compatible with Stage Manager"
        return 0
    else
        log_message "macOS $macos_version is not compatible with Stage Manager"
        return 1
    fi
}

# Function to get device information
get_device_info() {
    local device_name=$(scutil --get ComputerName)
    local device_serial=$(system_profiler SPHardwareDataType | grep "Serial Number" | awk '{print $4}')
    local macos_version=$(sw_vers -productVersion)
    local current_user=$(ls -l /dev/console | awk '/ / { print $3 }')
    local hardware_model=$(system_profiler SPHardwareDataType | grep "Model Name" | cut -d: -f2 | xargs)
    
    echo "Device: $device_name"
    echo "Serial: $device_serial"
    echo "Hardware: $hardware_model"
    echo "macOS: $macos_version"
    echo "User: $current_user"
}

# Function to deploy Stage Manager configuration
deploy_stage_manager_config() {
    local current_user=$(ls -l /dev/console | awk '/ / { print $3 }')
    local current_user_uid=$(id -u "$current_user")
    
    # Enable/disable Stage Manager
    if [ "$STAGE_MANAGER_ENABLED" = true ]; then
        launchctl asuser $current_user_uid sudo -iu "$current_user" defaults write com.apple.WindowManager GloballyEnabled -bool true
        log_message "Stage Manager enabled for user $current_user"
        echo "✅ Stage Manager enabled"
    else
        launchctl asuser $current_user_uid sudo -iu "$current_user" defaults write com.apple.WindowManager GloballyEnabled -bool false
        log_message "Stage Manager disabled for user $current_user"
        echo "❌ Stage Manager disabled"
    fi
    
    # Configure recent apps visibility
    if [ "$RECENT_APPS_VISIBLE" = true ]; then
        launchctl asuser $current_user_uid sudo -iu "$current_user" defaults write com.apple.WindowManager AutoHide -bool false
        log_message "Recent apps visibility enabled"
        echo "✅ Recent apps will be visible"
    else
        launchctl asuser $current_user_uid sudo -iu "$current_user" defaults write com.apple.WindowManager AutoHide -bool true
        log_message "Recent apps visibility disabled"
        echo "❌ Recent apps will be hidden"
    fi
    
    # Configure window grouping behavior
    case "$WINDOW_GROUPING_MODE" in
        "all_at_once")
            launchctl asuser $current_user_uid sudo -iu "$current_user" defaults write com.apple.WindowManager AppWindowGroupingBehavior -bool false
            log_message "Window grouping set to 'All at Once'"
            echo "✅ Window grouping: All at Once"
            ;;
        "one_at_time")
            launchctl asuser $current_user_uid sudo -iu "$current_user" defaults write com.apple.WindowManager AppWindowGroupingBehavior -bool true
            log_message "Window grouping set to 'One at a Time'"
            echo "✅ Window grouping: One at a Time"
            ;;
    esac
    
    # Restart Window Manager if requested
    if [ "$RESTART_WINDOW_MANAGER" = true ]; then
        launchctl asuser $current_user_uid sudo -iu "$current_user" killall WindowManager 2>/dev/null
        sleep 2
        log_message "Window Manager restarted"
        echo "🔄 Window Manager restarted"
    fi
}

# Function to validate deployment
validate_deployment() {
    local current_user=$(ls -l /dev/console | awk '/ / { print $3 }')
    local current_user_uid=$(id -u "$current_user")
    
    local stage_manager_status=$(launchctl asuser $current_user_uid sudo -iu "$current_user" defaults read com.apple.WindowManager GloballyEnabled 2>/dev/null)
    local recent_apps_status=$(launchctl asuser $current_user_uid sudo -iu "$current_user" defaults read com.apple.WindowManager AutoHide 2>/dev/null)
    local window_grouping_status=$(launchctl asuser $current_user_uid sudo -iu "$current_user" defaults read com.apple.WindowManager AppWindowGroupingBehavior 2>/dev/null)
    
    local validation_success=true
    
    # Validate Stage Manager status
    if [ "$STAGE_MANAGER_ENABLED" = true ] && [ "$stage_manager_status" = "1" ]; then
        echo "✅ Stage Manager validation: PASSED"
    elif [ "$STAGE_MANAGER_ENABLED" = false ] && [ "$stage_manager_status" = "0" ]; then
        echo "✅ Stage Manager validation: PASSED"
    else
        echo "❌ Stage Manager validation: FAILED"
        validation_success=false
    fi
    
    # Validate recent apps setting
    if [ "$RECENT_APPS_VISIBLE" = true ] && [ "$recent_apps_status" = "0" ]; then
        echo "✅ Recent apps validation: PASSED"
    elif [ "$RECENT_APPS_VISIBLE" = false ] && [ "$recent_apps_status" = "1" ]; then
        echo "✅ Recent apps validation: PASSED"
    else
        echo "❌ Recent apps validation: FAILED"
        validation_success=false
    fi
    
    if [ "$validation_success" = true ]; then
        log_message "Deployment validation successful"
        return 0
    else
        log_message "Deployment validation failed"
        return 1
    fi
}

# Main deployment process
echo "$COMPANY_NAME Stage Manager Deployment" > "$REPORT_FILE"
echo "========================================" >> "$REPORT_FILE"
echo "Date: $DEPLOYMENT_DATE" >> "$REPORT_FILE"
echo "" >> "$REPORT_FILE"

get_device_info >> "$REPORT_FILE"
echo "" >> "$REPORT_FILE"

log_message "Starting Stage Manager deployment"
echo "Starting deployment..." >> "$REPORT_FILE"

# Check macOS compatibility
if ! check_macos_compatibility; then
    echo "Status: FAILED - Incompatible macOS version" >> "$REPORT_FILE"
    log_message "Deployment aborted due to macOS compatibility"
    exit 1
fi

# Deploy configuration
deploy_stage_manager_config

# Validate deployment
if validate_deployment; then
    echo "Status: SUCCESS" >> "$REPORT_FILE"
else
    echo "Status: FAILED" >> "$REPORT_FILE"
fi

log_message "Deployment completed"
echo "Deployment completed. Report saved to: $REPORT_FILE"
cat "$REPORT_FILE"

Stage Manager Monitoring and Reporting

#!/bin/bash

# Stage Manager monitoring and reporting script
CENTRAL_SERVER="your-roundfleet-server.com"
DEVICE_ID=$(system_profiler SPHardwareDataType | grep "Serial Number" | awk '{print $4}')
REPORT_FILE="/tmp/stage_manager_report_${DEVICE_ID}.json"

# Function to create JSON report
create_json_report() {
    local device_name=$(scutil --get ComputerName)
    local device_user=$(ls -l /dev/console | awk '/ / { print $3 }')
    local device_user_uid=$(id -u "$device_user")
    local os_version=$(sw_vers -productVersion)
    local timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
    local hardware_model=$(system_profiler SPHardwareDataType | grep "Model Name" | cut -d: -f2 | xargs)
    
    # Get Stage Manager settings
    local stage_manager_enabled=$(launchctl asuser $device_user_uid sudo -iu "$device_user" defaults read com.apple.WindowManager GloballyEnabled 2>/dev/null)
    local recent_apps_hidden=$(launchctl asuser $device_user_uid sudo -iu "$device_user" defaults read com.apple.WindowManager AutoHide 2>/dev/null)
    local window_grouping=$(launchctl asuser $device_user_uid sudo -iu "$device_user" defaults read com.apple.WindowManager AppWindowGroupingBehavior 2>/dev/null)
    
    # Check if Stage Manager is supported
    local major_version=$(echo "$os_version" | cut -d. -f1)
    local stage_manager_supported=$([ "$major_version" -ge 13 ] && echo "true" || echo "false")
    
    cat > "$REPORT_FILE" << EOF
{
  "device_info": {
    "device_id": "$DEVICE_ID",
    "device_name": "$device_name",
    "hardware_model": "$hardware_model",
    "user": "$device_user",
    "os_version": "$os_version",
    "timestamp": "$timestamp"
  },
  "stage_manager": {
    "supported": $stage_manager_supported,
    "enabled": $([ "$stage_manager_enabled" = "1" ] && echo "true" || echo "false"),
    "configured": $([ -n "$stage_manager_enabled" ] && echo "true" || echo "false"),
    "recent_apps_hidden": $([ "$recent_apps_hidden" = "1" ] && echo "true" || echo "false"),
    "window_grouping_mode": "$([ "$window_grouping" = "1" ] && echo "one_at_time" || echo "all_at_once")"
  },
  "window_manager": {
    "process_running": $(pgrep -x "WindowManager" > /dev/null && echo "true" || echo "false"),
    "last_restart": "$(ps -p $(pgrep -x "WindowManager") -o lstart= 2>/dev/null | xargs)"
  }
}
EOF
}

# Function to collect usage statistics
collect_usage_stats() {
    local device_user=$(ls -l /dev/console | awk '/ / { print $3 }')
    local device_user_uid=$(id -u "$device_user")
    
    # Check if Stage Manager is currently active
    local stage_manager_active=$(launchctl asuser $device_user_uid sudo -iu "$device_user" defaults read com.apple.WindowManager GloballyEnabled 2>/dev/null)
    
    if [ "$stage_manager_active" = "1" ]; then
        echo "Stage Manager is currently active"
        
        # Get window count (approximation)
        local window_count=$(launchctl asuser $device_user_uid sudo -iu "$device_user" osascript -e 'tell application "System Events" to count windows of every application process' 2>/dev/null)
        echo "Current window count: $window_count"
        
        # Check if external displays are connected
        local display_count=$(system_profiler SPDisplaysDataType | grep -c "Display Type:")
        echo "Connected displays: $display_count"
    else
        echo "Stage Manager is not active"
    fi
}

# Main execution
echo "Roundfleet Stage Manager Monitoring"
echo "================================="
echo "Device ID: $DEVICE_ID"

# Create monitoring report
create_json_report

# Collect usage statistics
collect_usage_stats

echo "Report generated: $REPORT_FILE"
echo "Stage Manager monitoring completed"

# Display report summary
echo ""
echo "Report Summary:"
echo "==============="
cat "$REPORT_FILE" | grep -E '"supported|enabled|configured"' | sed 's/[",]//g' | sed 's/^[ ]*//'

# Optional: Send to central server
# curl -X POST -H "Content-Type: application/json" -d @"$REPORT_FILE" "https://$CENTRAL_SERVER/api/stage-manager-reports"

Best Practices for Stage Manager Management

1. User Training and Adoption

  • Provide comprehensive training on Stage Manager features
  • Create user guides and documentation
  • Demonstrate productivity benefits
  • Offer personalized configurations based on user roles

2. Configuration Standards

  • Define organizational standards for Stage Manager settings
  • Create different profiles for different user types
  • Document approved configurations
  • Implement change management processes

3. Performance Considerations

  • Monitor system performance impact
  • Consider hardware capabilities when enabling Stage Manager
  • Test configurations on different device types
  • Provide rollback options

4. Integration with Other Tools

  • Coordinate with existing window management tools
  • Consider impact on screen sharing and remote access
  • Test with business applications
  • Ensure compatibility with accessibility features

Troubleshooting Common Issues

Issue: Stage Manager Not Available

# Check macOS version
macos_version=$(sw_vers -productVersion)
echo "macOS version: $macos_version"

# Check if running on compatible hardware
hardware_model=$(system_profiler SPHardwareDataType | grep "Model Name" | cut -d: -f2 | xargs)
echo "Hardware model: $hardware_model"

# Verify system requirements
if [[ "$macos_version" < "13.0" ]]; then
    echo "❌ Stage Manager requires macOS 13.0 or later"
fi

Issue: Changes Not Taking Effect

# Restart Window Manager
current_user=$(ls -l /dev/console | awk '/ / { print $3 }')
current_user_uid=$(id -u "$current_user")

launchctl asuser $current_user_uid sudo -iu "$current_user" killall WindowManager
sleep 3

# Verify process restart
if pgrep -x "WindowManager" > /dev/null; then
    echo "✅ Window Manager restarted successfully"
else
    echo "❌ Window Manager failed to restart"
fi

Issue: Permission Denied

# Check user permissions
current_user=$(ls -l /dev/console | awk '/ / { print $3 }')
echo "Current user: $current_user"

# Verify user context
id "$current_user"

# Check if user has necessary permissions
if groups "$current_user" | grep -q "admin"; then
    echo "✅ User has admin privileges"
else
    echo "❌ User does not have admin privileges"
fi

Issue: Settings Not Persisting

# Check preferences file
current_user=$(ls -l /dev/console | awk '/ / { print $3 }')
plist_file="/Users/$current_user/Library/Preferences/com.apple.WindowManager.plist"

if [ -f "$plist_file" ]; then
    echo "✅ Preferences file exists"
    ls -la "$plist_file"
else
    echo "❌ Preferences file not found"
fi

# Force preferences sync
defaults synchronize

Stage Manager Feature Deep Dive

Understanding Stage Manager Components

Stage Manager consists of several key components:

  1. Window Groups: Collections of related windows that appear together
  2. Stage: The main working area where active window groups are displayed
  3. Recent Applications: Sidebar showing recently used applications
  4. External Display Support: Independent Stage Manager operation on external displays

Advanced Configuration Options

#!/bin/bash

# Advanced Stage Manager configuration options
CURRENT_USER=$(ls -l /dev/console | awk '/ / { print $3 }')
CURRENT_USER_UID=$(id -u "$CURRENT_USER")

# Configure Stage Manager for external displays
configure_external_display_stage_manager() {
    local enable_external="$1"
    
    if [ "$enable_external" = "true" ]; then
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager StandardStageStripShowsFullDesktop -bool true
        echo "✅ External display Stage Manager enabled"
    else
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager StandardStageStripShowsFullDesktop -bool false
        echo "❌ External display Stage Manager disabled"
    fi
}

# Configure Stage Manager animation speed
configure_animation_speed() {
    local speed="$1"  # Values: 0.1 to 1.0
    
    if [[ "$speed" =~ ^[0-9]+\.?[0-9]*$ ]] && (( $(echo "$speed >= 0.1" | bc -l) )) && (( $(echo "$speed <= 1.0" | bc -l) )); then
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager StageManagerAnimationSpeed -float "$speed"
        echo "✅ Animation speed set to $speed"
    else
        echo "❌ Invalid animation speed. Use values between 0.1 and 1.0"
    fi
}

# Configure Stage Manager hotkeys
configure_hotkeys() {
    local enable_hotkeys="$1"
    
    if [ "$enable_hotkeys" = "true" ]; then
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager EnableHotKeys -bool true
        echo "✅ Stage Manager hotkeys enabled"
    else
        launchctl asuser $CURRENT_USER_UID sudo -iu "$CURRENT_USER" defaults write com.apple.WindowManager EnableHotKeys -bool false
        echo "❌ Stage Manager hotkeys disabled"
    fi
}

# Example usage
# configure_external_display_stage_manager "true"
# configure_animation_speed "0.5"
# configure_hotkeys "true"

Conclusion

Stage Manager is a powerful productivity feature that can significantly improve window management workflows when properly configured. This comprehensive guide provides:

  • Basic enable/disable functionality for quick deployment
  • Advanced configuration options for customized user experiences
  • Enterprise deployment scripts for large-scale management
  • Monitoring and reporting tools for ongoing management
  • Troubleshooting guides for common issues

Regular implementation of Stage Manager management practices will help ensure your Mac fleet provides an optimal user experience while maintaining organizational standards and productivity goals.

For maximum effectiveness, consider integrating Stage Manager configuration with your existing Mac fleet management tools and user training programs.