AkurAI Build
Menu

cosmic-mobile

public

Latest change fd9056d1c42bbccd30f9ad79f356ed3b96f145be - Add apps workspace during config upgrade without duplicates by AkurAI Build

"""Upgrade the known shell rule without replacing device-specific config."""
import re


def upgrade(text):
    # ponytail: supports current flat shell rule only; reject other shapes.
    pattern = r'(match app-id="\^cosmic-mobile\$"[^{}]*?open-fullscreen )(?:false|true)(?=\s|;)'
    result, count = re.subn(pattern, r'\g<1>true', text)
    if count != 1:
        raise ValueError('Expected exactly one explicit shell fullscreen rule')
    if 'workspace "apps"' not in result:
        result = result.replace('workspace "home"\n', 'workspace "home"\nworkspace "apps"\n', 1)
    return result