Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3d396fd
Showing
2 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
iterm_title is a bash shell script that sets the Name for the current tab in iTerm2 (http://www.iterm2.com) on Mac OS X | ||
|
||
|
||
It uses Applescript called from the UNIX command line | ||
|
||
|
||
iTerm2 (http://www.iterm2.com) by George Nachman is an excellent terminal emulator for Mac OS X that is highly | ||
configurable. I it prefer over the system Terminal application. | ||
|
||
This script lets you set the title for the current session (tab) from the UNIX command line in that session. This makes it | ||
much easier to identify the correct tabs when you have several of them open in a single terminal | ||
|
||
To Install, copy it to /usr/local/bin and 'chmod a+x iterm_title' to make it executable | ||
|
||
To Run type the command followed byt the title | ||
|
||
$ iterm_title 'Your title' | ||
|
||
You can have multiple words in the title and the quotes are optional, unless the title has internal quotes. | ||
|
||
Note that the tab width does not expand to fit your text. About 25 characters is a reasonable maximum. | ||
|
||
This script could be easily modified to change session colors, etc from the command line - take a look at the iTerm2 docs. | ||
|
||
|
||
By default iTerm will show the current foreground process, such as bash, in the tab title. I find this distracting. | ||
You can prevent it by going to Preferences -> Appearance and unchecking 'Show current job name' in the 'Window and Tab Titles' section. | ||
|
||
|
||
The script was written by Robert Jones (jones@craic.com) of Craic Computing LLC and is freely distributed under the terms of the MIT license. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/bash | ||
|
||
# iterm_title | ||
|
||
# This script set the Name for the current tab in iTerm2 (http://www.iterm2.com) on Mac OS X | ||
# It uses Applescript called from the UNIX command line | ||
# | ||
# Robert Jones Craic Computing LLC 2012 jones@craic.com | ||
# | ||
# Freely distributed under the terms of the MIT license | ||
|
||
# iTerm2 (http://www.iterm2.com) by George Nachman is an excellent terminal emulator for Mac OS X that is highly | ||
# configurable. I it prefer over the system Terminal application. | ||
|
||
# This script lets you set the title for the current session (tab) from the UNIX command line in that session | ||
|
||
# You run it like this: | ||
# $ iterm_title 'My title' | ||
# You can have multiple words and the quotes are optional | ||
|
||
# Note that the tab width does not expand to fit your text - about 25 characters is a reasonable maximum | ||
|
||
# This script could be easily modified to change session colors, etc from the command line - Take a look at the iTerm2 docs | ||
|
||
# To install, copy it to /usr/local/bin and 'chmod a+x iterm_title' to make it executable | ||
|
||
# By default iTerm will show the current foreground process, such as bash, in the tab title. | ||
# You can prevent this by going to Preferences -> Appearance and unchecking 'Show current job name' in the 'Window and Tab Titles' section | ||
|
||
# if no title is supplied then just exit | ||
if [ $# -eq 0 ]; then | ||
exit 1 | ||
fi | ||
|
||
# osascript is a system application that runs Applescript from the Unix command line | ||
# Here I pass it the Applescript as a HERE document | ||
# The user-defined title is passed in as $* in quotes | ||
/usr/bin/osascript - "$*" <<- EOF | ||
on run argv | ||
tell application "iTerm" | ||
activate | ||
set myterm to (current terminal) | ||
tell myterm | ||
set mysession to (current session) | ||
tell mysession | ||
set name to (item 1 of argv) | ||
end tell | ||
end tell | ||
end tell | ||
end run | ||
EOF |