-
Notifications
You must be signed in to change notification settings - Fork 1
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
David Aaron Fendley
committed
Aug 16, 2011
0 parents
commit be92d27
Showing
4 changed files
with
94 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,8 @@ | ||
echo "Downloading..." | ||
/usr/bin/env git clone https://github.com/tricon/set-bg.git /tmp/set-bg | ||
|
||
echo "Installing..." | ||
sudo cp /tmp/set-bg/* /usr/bin/ | ||
echo "alias ssh=sshb" >> ~/.zshrc | ||
|
||
echo "Done!" |
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,17 @@ | ||
#!/bin/sh | ||
|
||
current_tty=$(tty) | ||
osascript -e " | ||
tell application \"iTerm\" | ||
repeat with theTerminal in terminals | ||
tell theTerminal | ||
try | ||
tell session id \"$current_tty\" | ||
set background image path to \"$1\" | ||
end tell | ||
on error errmesg number errn | ||
end try | ||
end tell | ||
end repeat | ||
end tell | ||
" |
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,44 @@ | ||
#!/bin/zsh | ||
|
||
function __calculate_iterm_window_dimensions { | ||
applescript="tell application \"iTerm\" | ||
get bounds of window 1 | ||
end tell" | ||
size=($(osascript -e $applescript | tr ',' ' ')) | ||
|
||
x1=${size[1]} y1=${size[2]} x2=${size[3]} y2=${size[4]} | ||
# 15px - scrollbar width | ||
w=$(( $x2 - $x1 )) | ||
# 44px - titlebar + tabs height | ||
h=$(( $y2 - $y1 - 44)) | ||
echo "${w}x${h}" | ||
} | ||
|
||
# Console dimensions | ||
DIMENSIONS=$(__calculate_iterm_window_dimensions) | ||
a=(${(s/x/)DIMENSIONS}) | ||
WIDTH=$(($a[1]-32)) | ||
HEIGHT=$(($a[2]-32)) | ||
|
||
BG_COLOR="#121212" # Background color | ||
FG_COLOR="#454545" # Foreground color | ||
GRAVITY="SouthEast" # Text gravity (NorthWest, North, NorthEast, | ||
FONT_SIZE="20" # Font size in points | ||
FONT="Helvetica-Light" | ||
|
||
OFFSET_X=35 | ||
OFFSET_Y=04 | ||
|
||
HOSTNAME=$(/usr/bin/base-hostname "$@") | ||
DESTFILE="/tmp/iTermBG.$HOSTNAME.png" | ||
|
||
# if [ ! -f /tmp/iTermBG.${HOSTNAME}.png ]; then | ||
convert -crop ${DIMENSIONS}-$WIDTH-$HEIGHT\! ~/Pictures/GeekTool/Apple.png \ | ||
-background "$BG_COLOR" -flatten -quality 100 -gravity "$GRAVITY" -font "$FONT" -pointsize "$FONT_SIZE" -antialias -alpha Off \ | ||
-fill black -annotate +$(($OFFSET_X+1))+$(($OFFSET_Y+1)) "$HOSTNAME" \ | ||
-fill "#323232" -annotate +$(($OFFSET_X-1))+$(($OFFSET_Y-1)) "$HOSTNAME" \ | ||
-fill "#252525" -annotate +$OFFSET_X+$OFFSET_Y "$HOSTNAME" \ | ||
$DESTFILE | ||
# fi | ||
|
||
/usr/bin/set-bg $DESTFILE |
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,25 @@ | ||
#!/bin/sh | ||
|
||
# SSH with host name and IP address in background (only in iTerm.app) | ||
|
||
# First, check to see if we have the correct terminal! | ||
if [ "$(tty)" = 'not a tty' ] || [ "$TERM_PROGRAM" != "iTerm.app" ] ; then | ||
/usr/bin/ssh "$@" | ||
exit $? | ||
fi | ||
|
||
HOSTNAME=$(/usr/bin/base-hostname `hostname`) | ||
|
||
on_exit () { | ||
# if [ ! -f /tmp/iTermBG.empty.png ]; then | ||
# convert -size "$DIMENSIONS" xc:"$BG_COLOR" "/tmp/iTermBG.empty.png" | ||
# fi | ||
/usr/bin/set-bg "/tmp/iTermBG.$HOSTNAME.png" | ||
} | ||
|
||
trap on_exit EXIT | ||
|
||
/usr/bin/set-bg-host "$@" | ||
|
||
# read $tmp | ||
/usr/bin/ssh "$@" |