更换背景图片 :(两种方式)
- 打开apple script
tell application "iTerm"
tell current session of current window
set background image to "图片的位置"
end tell
end tell
直接执行即可.
- 创建一个以
.scpt
为后缀的文件 eg:bg_change.scpt
tell application "iTerm"
tell current session of current window
set background image to "图片的位置"
end tell
end tell
将以上的内容写入你创建的文件中
创建一个.sh
文件 eg:change_bg.sh
写入以下内容,路径需要存储你脚本的路径
#!/bin/bash
osascript
/usr/local/opt/bg_change.scpt
chmod 755 change_bg.sh
执行./change_bg.sh
即可看到你的命令行界面图片变了
ssh后高亮
sudo touch ssh-background
里面写入以下内容
set_color() {
local HEX_FG=$1
local HEX_BG=$2
local OPACITY=$3
local FG_R=`echo $HEX_FG | sed 's/../0x&,/g' | awk -F "," '{printf("%d",$1 * 257)}'`
local FG_G=`echo $HEX_FG | sed 's/../0x&,/g' | awk -F "," '{printf("%d",$2 * 257)}'`
local FG_B=`echo $HEX_FG | sed 's/../0x&,/g' | awk -F "," '{printf("%d",$3 * 257)}'`
local BG_R=`echo $HEX_BG | sed 's/../0x&,/g' | awk -F "," '{printf("%d",$1 * 257)}'`
local BG_G=`echo $HEX_BG | sed 's/../0x&,/g' | awk -F "," '{printf("%d",$2 * 257)}'`
local BG_B=`echo $HEX_BG | sed 's/../0x&,/g' | awk -F "," '{printf("%d",$3 * 257)}'`
/usr/bin/osascript <<EOF
tell application "iTerm"
tell current session of current terminal
set foreground color to {$FG_R, $FG_G, $FG_B}
set background color to {$BG_R, $BG_G, $BG_B}
set transparency to "$OPACITY"
end tell
end tell
EOF
}
if [[ "$@" =~ host0.example.com ]]; then
set_color ffffff 330000 0.2
elif [[ "$@" =~ host1.example.com ]]; then
set_color ffffff 000033 0.2
fi
ssh $@
set_color ffffff 000000 0.2
chmod 755 /path/ssh-background
alias ssh=/path/bin/ssh-background
接下来ssh即可