Skip to content

Instantly share code, notes, and snippets.

@lg0
Last active January 11, 2018 02:51
Show Gist options
  • Star 24 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save lg0/5377685 to your computer and use it in GitHub Desktop.
Save lg0/5377685 to your computer and use it in GitHub Desktop.
show/hide iTerm2 Dock icon
# toggle iTerm Dock icon
# add this to your .bash_profile or .zshrc
function toggleiTerm() {
pb='/usr/libexec/PlistBuddy'
iTerm='/Applications/iTerm.app/Contents/Info.plist'
echo "Do you wish to hide iTerm in Dock?"
select ync in "Hide" "Show" "Cancel"; do
case $ync in
'Hide' )
$pb -c "Add :LSUIElement bool true" $iTerm
echo "relaunch iTerm to take effectives"
break
;;
'Show' )
$pb -c "Delete :LSUIElement" $iTerm
echo "run killall 'iTerm' to exit, and then relaunch it"
break
;;
'Cancel' )
break
;;
esac
done
}
@Daikonbuubuu
Copy link

Once Added to my .bash_profile, how do I go about toggling the icon?

@erik-jenkins
Copy link

@Daikonbuubuu, to toggle the icon, just run toggleiTerm in the terminal

@akaHeimdall
Copy link

Any help on why this isn't working? I'm actually trying to get iTerm to show in the dock. I've also tried to add in the LSUIElement by hand with a false and still cannot get iTerm to show.
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment