[ #51 ] OSX Terminal Setup Permalink

OSX Added nearly two years ago

I have a little Applescript (that I'm sure is poorly done, since it's my first and only Applescript) that sets up some Terminal.app instances in a nice way. Here it is:

copy 1280 to _width
copy 800 to _height
copy 70 to _dockheight
copy 120 to _paddingright
copy 3 to _paddingtop
copy 5 to _paddingmiddle
copy 30 to _titlebarheight

tell application "Terminal"
    activate
    do script "clear"
    do script "clear"
    tell window 1
            set background color to "Black"
            set normal text color to "White"
            set bold text color to "White"
            set cursor color to "Green"
            set size to {(_width / 2), (_height - _dockheight)}
            set position to {0, _paddingtop}
    end tell
    tell window 2
            set background color to {5051, 0, 0}
            set normal text color to "White"
            set bold text color to "White"
            set cursor color to "Green"
            set size to {(_width / 2) - _paddingright, ((_height - _dockheight) / 2) - (_titlebarheight / 2)}
            set position to {(_width / 2) + _paddingmiddle, _paddingtop}
    end tell
    tell window 3
            set background color to {0, 0, 5051}
            set normal text color to "White"
            set bold text color to "White"
            set cursor color to "Green"
            set size to {(_width / 2) - _paddingright, ((_height - _dockheight) / 2) - (_titlebarheight / 2)}
            set position to {(_width / 2) + _paddingmiddle, ((_height - _dockheight) / 2) + _paddingtop + (_titlebarheight / 2)}
    end tell
    do script "clear" in window 1
    do script "clear" in window 2
    do script "clear" in window 3
end tell

There is most likely a way to get the current screen height and width, but until I learn it I will have to stick with the hard-coded values above.

Colophon

Django Python 960.gs Git Vim NetBSD Nginx

The Author

This is the blog of Brad Willis, a software engineer living in Brisbane.

Meta

Help
Latest entries

*BSD Agile Apache Apple apt Athletics Best-Practice Censorship Chrome Comedy Cool Crosswords Deployment Django English Exim Firefox Git Hardcore Health irssi Javascript Jira Languages Linux Makefile Mathematics Mobile Broadband Mutt MySQL NetBSD nginx Nokia OpenVZ OSX Perl Postfix Privacy Python Rant Requirements rsync Ruby Shell Slackware SQL SQLite SSH Standards Subversion Television Testing ThisBlog Vim VMWare (Fusion) VPN X zsh

Recent Entries

gvim - Always open new files as new tabs
crontab - escape % (percentage)
OSX Google Chrome - start in incognito mode
SQLite date arithmetic
Postfix - delete message in mailq
Checking for exceptions in doctests
Homer's Curling Speech
retry in Python
Vim Makefile tabs
Centos (or RH) IPTables
Converting ssh2 public keys to openssh
Vim comment hints
Context managers in Perl
Dish rotation
Git - fixing commit user
apt stuff
Using shell variables in AWK
Linux - Too many open files
Tell gvim to save and quit... remotely
Vim - automatically remove whitespace at EOL
Python - relative paths from within modules
TV Aspect Ratios
Git - Which commits are in your branch only?
Subversion setup cheat sheet
Force detach a screen session
Modify sudo's use of environment variables
Install all Perl modules
Mutt - delete old messages
OpenVZ VPS and swap space
fail2ban on NetBSD for ssh
NetBSD - Using sup
Python - testing for a sys.exit
Python Best Practice Link Dump
Python script names
Perl - Using an expensive module
Speed of git clone
Perl Modules with Custom Prefix
Perl: tr vs. s
Brilliant sysadmin Reference
Why is GRUB better than LILO?

Links

ChoppingBoard, DaveMisc, Project365, RageQuit