Een zeer handig tooltje om je sessies automatisch een kleur te geven als je aan remote ssh doet. (Via The Omni Mouth)
Bewaar deze code in een executable scrip ergens in je path
?Download SetTerminalStyle
#!/usr/bin/osascript on run(MySettingsName) set MyTTY to do shell script "/usr/bin/tty" set TTYTab to my find_tab_for_tty(MyTTY) if TTYTab is missing value then return -- Bail if we got confused rather than making it worse end if tell application "Terminal" try set MySettings to settings set named MySettingsName on error return -- bailout -- set MySettings to default settings -- use default settings if the name is bogus end try set current settings of TTYTab to MySettings end tell end on find_tab_for_tty(MyTTY) -- Find the window/tab that has this tty. Could use an application->tab relationship or possibbly a 'find tab by tty' command of some sort. tell application "Terminal" set MyWindowCount to count of windows repeat with MyWindowIndex from 1 to MyWindowCount set MyWindow to window MyWindowIndex try set MyTabCount to count of tabs of MyWindow on error set MyTabCount to 0 -- a non-Terminal window? end try repeat with MyTabIndex from 1 to MyTabCount set MyTab to tab MyTabIndex of MyWindow if MyTTY is (tty of MyTab) then return MyTab end if end repeat end repeat end tell return missing value end find_tab_for_tty |
edit je .bash_profile en voeg de volgende code toe:
# Show remote Terminal sessions with a different style. # TERM_PROGRAM doesn't get set if we are logged in remotely, # but then the originating Terminal could have done this (hopefully). if [ "$TERM_PROGRAM" = "Apple_Terminal" ]; then function ssh { SetTerminalStyle ssh SetTerminalStyle "$@" /usr/bin/ssh "$@" SetTerminalStyle default } fi |
☯