-1

I used plutil to edit the plist. then I placed in under /User/<myUsername>/Library/Preferences/com.apple.Terminal.plist. I want it to update the settings without reboot the application. How do I do this? using defaults read com.apple.Terminal doesn't seem to make the changes take effect. I added a terminal profile to the plist and want the changes to take effect.

I tried making an import profile with AppleScript but long story short it's not 100% possible. if you store window 1 so it's the same var in-between delays right after open it errors more times.

on run argv
    set importScript to first item of argv
    set flag to application "Terminal" is not running
    tell application "Terminal"
        open importScript
        delay 1.0E-5
        activate
        if flag then close back window
        do script "exit" in window 1
        delay 0.5
        close window 1
    end tell
end run
jredfox_
  • 19
  • 6

1 Answers1

0

there is no need for editing plists just a simple AppleScript. the limitations of this are you must have _oti_<yourProfileId> in your terminal profile default header and change the title when running your terminal profile to prevent accidental closures when installing the same profile of an already running app

import.applescript

on run argv
    set importScript to first item of argv
    set closeScript to second item of argv
    set profileId to third item of argv
    do shell script "open -a Terminal " & importScript
    do shell script "osascript " & closeScript & " _oti_" & profileId
end run

closeMe.applescript

on run argv
    set c to first item in argv
    tell application "Terminal"
        set wList to every window
        repeat with app_window in wList
            set wname to name of app_window
            if wname contains c then
                do script "exit" in app_window
                delay 0.312
                close app_window
            end if
        end repeat
    end tell
end run

and then you can call the profile using this AppleScript

on run argv
    set flag to application "Terminal" is not running
    set scpt to first item in argv
    set n to second item in argv
    set p to third item in argv
    tell application "Terminal"
        set newTab to do script scpt
        set badFlag to back window is equal to window 1
        if p is not equal to "" then set current settings of newTab to settings set p
        set custom title of newTab to n
        activate
        if flag and (not badFlag) then
            do script "exit" in back window
            delay 0.1
            close back window
        end if
    end tell
end run
jredfox_
  • 19
  • 6