How to reload iterm plist file?

0

I want to change my iterm background photo in every 10 mins.

So I tried to use cmd /usr/libexec/PlistBuddy to change the config file com.googlecode.iterm2.plist.

And here is my command:

/usr/libexec/PlistBuddy -c 'Set :"New Bookmarks":0:"Background Image Location" "/Users/boy/imgs/'$(( $RANDOM % 100 ))'.jpg"' ~/Library/Preferences/com.googlecode.iterm2.plist

But it did not work immediately. I have to quit my iterm and reopen it, and then the photo changed.

It just seems that the plist file is not loaded immediately after I changed it.

So my question is how to reload the plist file to make my change work immediately?

ggeh

Posted 2019-07-20T16:34:57.813

Reputation: 3

You've already discovered how & when plists are loaded - at launch. – Tetsujin – 2019-07-20T16:58:11.517

1I want to change my background photo every 10 mins. So I am wondering is there a way to reload the config file once I change it. – ggeh – 2019-07-21T02:32:37.837

Answers

0

You may use the Dynamic Profiles to reload your profiles in time.

  1. Add Property List Json

You can create a json file in ~/Library/Application Support/iTerm2/DynamicProfiles folder. For example, your file is named profile.json.

  1. Modify the json file.

Use Dynamic Profile Parent Name to extends your settings and just modify specified attribution.

{
    "Profiles": [
        {
            "Name": "the name of new profile",
            "Guid": "a unique string",
            "Dynamic Profile Parent Name": "Default",
            "Background Image Location": "location of your image"
        }
    ]
}

After that, you can see the change of your background image at once.

陈阳阳

Posted 2019-07-20T16:34:57.813

Reputation: 16

This solution solved my problem perfectly. Iterm may not support reloading plist file immediately once it changed. And this is a good way to do it. – ggeh – 2019-07-22T08:23:33.343