The window bounds are a list of coordinates {left, top, right, bottom}. You probably intended "400" to be the width, but it's the position of the right edge of the window and 400 is to the left of 1105, so you get a minimum width window. Change 400 to 1105 plus the desired width, e.g., 1505.
But before you pursue this further, Terminal has a better solution for this: Window Groups. If you set up a group of windows and save them as a Window Group, each time you open that group it will create windows with the same layout and appearance.
Window > Save Windows as Group…
You can even tell Terminal to open a selected window group at startup:
Terminal > Preferences > Startup > On startup, open: > Window group:
(As a shortcut, when creating a window group there's a checkbox for making it the startup group.)
To automatically run particular commands in those windows, you can create custom settings profiles and specify the command with
Terminal > Preferences > Settings > [profile] > Shell > Startup > Run command:
then create each window with the appropriate profile.
Going further, in Mac OS X Lion 10.7 you can have window groups automatically restore commands without creating custom profiles, by creating the terminals using
Shell > New Command
instead of running the command inside the terminal shell. When creating the window group, you can check "Restore all commands". (By default, it will restore a small set of "safe" commands, but you must explicitly tell it if you want it to re-run all commands when opening the group.)
Moreover, Lion Terminal supports Resume and will automatically restore all your windows each time you open Terminal. It will even restore "safe" commands for terminals created with New Command.
It turns out that preferences are cached in Mavericks (and presumably Yosemite), and therefore copying preference files will not make them immediately available.
A generic cache cleaning tool such as Onyx can be used to clear the caches or if you're happy using the command line the following command will reload the cached preferences:
killall -u <yourusername> cfprefsd
Thanks to the MacOS Hints Forums for this useful gem.
Best Answer
You have to quote the value, remove
-dict-add
, and use for example<key>name</key><string>165x165</string>
instead of<name>165x165</name>
:defaults write com.apple.print.custompapers 165x165 '<dict><key>bottom</key><real>0</real><key>custom</key><true/><key>height</key><real>467.71653555</real><key>id</key><string>165x165</string><key>left</key><real>0</real><key>name</key><string>165x165</string><key>printer</key><string> </string><key>right</key><real>0</real><key>top</key><real>0</real><key>width</key><real>467.71653555</real></dict>'
This checks if the key exists:
if defaults read com.apple.print.custompapers 165x165 &> /dev/null; then echo 'the key exists'; fi