Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Command to set background?' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Command to set background?
Authored by: lullabud on Feb 02, '05 11:11:45AM

Wow, that's really cool! Is there a command to set the terminal background? I think it would be cool to have you .bashrc load up a random image when you open a new terminal window to help distinguish quickly between different windows when you open up several at once.



[ Reply to This | # ]
Command to set background?
Authored by: adrianm on Feb 02, '05 01:53:55PM

Sadly, Terminal's applescript dictionary doesn't permit changing the background graphic, but you can change colour and transparency.



[ Reply to This | # ]
Command to set background?
Authored by: Bemopolis on Feb 02, '05 05:10:33PM
well, I'm not sure how to pull a random image from a folder in UNIX, but you can set the background image from the Terminal with the command

defaults write com.apple.Terminal BackgroundImagePath -string path-to-file.

The next terminal that opens will use the specified background image. You can of course
undo the "damage" with

defaults delete com.apple.Terminal BackgroundImagePath

for the next terminal window.
Now, I don't think I'm comfortable monkeying around with the pref file X times a day,
though, so this may not be an optimal solution. The real trick is to find how the
option-drag assigns the picture to only that window for that session. But as a
terminal-picture-of-the-day sort of thing, sure. Maybe someone more clever than I
can figure that out, as well as the way to choose a random file from a folder.

Bemopolis

[ Reply to This | # ]
random backgrounds
Authored by: caesurae on Feb 06, '05 04:15:30PM
Considering that it's possible to create .term files to launch a session that can include a background image...

I have created a script that can be executed from a .term file or an rc file (.bashrc, .tcshrc, etc.). The script inserts the path of an image file randomly selected from ~/Library/Desktop Pictures/ into a .term file's "BackgroundImagePath" setting. This avoids "monkeying around with the pref file X times a day" as Bemopolis put it, but requires that you create the directory ~/Library/Application Support/Terminal/ to keep the .term file and script in.

You could edit the script to change ~/Library/Desktop Pictures/ to some other directory.

Get the script here.

[ Reply to This | # ]