From 0bea503b99cd203c9ababb23651abfaf3fb6ccc6 Mon Sep 17 00:00:00 2001 From: Sebastian Reichel Date: Sun, 6 Dec 2015 10:53:08 +0100 Subject: modify terminal icon based on running command --- zshrc | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/zshrc b/zshrc index 7d7b624..a6c3633 100644 --- a/zshrc +++ b/zshrc @@ -155,6 +155,47 @@ chpwd_functions=( ${chpwd_functions} chpwd_profiles ) function precmd { vcs_info title "%n@%m %~" + + if [ $TMUX ] ; then + export `tmux showenv WINDOWID` + fi + + if [[ "x$WINDOWID" != "x" ]] ; then + xseticon -id $WINDOWID "/usr/share/pixmaps/terminal-tango.png" + fi +} + +function preexec { + title "$1" + if [ "x$WINDOWID" = "x" ] ; then + return 0 + fi + + if [[ "$1" == "mutt" ]] ; then + xseticon -id $WINDOWID "/usr/share/icons/Tango/22x22/apps/email.png" + elif [[ `echo "$1" | grep "vim"` != "" ]] ; then + xseticon -id $WINDOWID "/usr/share/pixmaps/vim-32.png" + elif [[ `echo "$1" | grep "ssh"` != "" ]] ; then + xseticon -id $WINDOWID "/usr/share/pixmaps/openssh.png" + elif [[ `echo "$1" | grep "apt-get "` != "" ]] ; then + xseticon -id $WINDOWID "/usr/share/icons/Tango/22x22/apps/system-installer.png" + elif [[ `echo "$1" | grep "mpv"` != "" ]] ; then + xseticon -id $WINDOWID "/usr/share/icons/hicolor/32x32/apps/mpv.png" + elif [[ `echo "$1" | grep "mpa "` != "" ]] ; then + xseticon -id $WINDOWID "/usr/share/icons/hicolor/32x32/apps/mpv.png" + elif [[ "$1" == "htop" ]] ; then + xseticon -id $WINDOWID "/usr/share/pixmaps/htop.png" + elif [[ `echo "$1" | grep "make"` != "" ]] ; then + xseticon -id $WINDOWID "/usr/share/icons/gnome/24x24/categories/package_development.png" + elif [[ `echo "$1" | grep "git-pbuilder"` != "" ]] ; then + xseticon -id $WINDOWID "/usr/share/icons/gnome/24x24/categories/package_development.png" + elif [[ `echo "$1" | grep "gbp buildpackage"` != "" ]] ; then + xseticon -id $WINDOWID "/usr/share/icons/gnome/24x24/categories/package_development.png" + elif [[ `echo "$1" | grep "git "` != "" ]] ; then + xseticon -id $WINDOWID "/usr/share/pixmaps/git.png" + elif [[ "$1" == "cusb" ]] ; then + xseticon -id $WINDOWID "/usr/share/pixmaps/serial.png" + fi } # menus for mutt and less -- cgit v1.2.3