Writing, publishing, geekdom, and errata.

HOWTO Get Custom Icons With Each New XTerm Terminal Window

No comments
Use Xterm? Want to have custom icons for each instance like this?

Here's how you do it:

1. Alias xterm to

xterm -e "xicons.sh;bash"

Save the script below into your $PATH somewhere (and make it executable):

# icon from http://www.iconfinder.com/icondetails/17547/48/prompt_terminal_icon
# xseticon from http://www.leonerd.org.uk/code/xseticon/
# Solutions from
# http://superuser.com/questions/363614/leave-xterm-open-after-task-is-complete
# http://unix.stackexchange.com/questions/3197/how-to-identify-which-xterm-a-shell-or-process-is-running-in
# http://unix.stackexchange.com/questions/16774/how-to-assign-an-icon-to-a-program-in-openbox

running=$(ps aux | grep "xterm" | grep -v "grep" | grep -c "xterm")

if [ "$running" -gt "7" ];then

snark=$(echo $WINDOWID)
xseticon -id $snark /home/MYUSERNAME/.icons/terms/terminal_prompt$running.png
wmctrl -i -r "$snark" -T "xterm"

And get the icons from here:
http://imgur.com/a/5Q9dn#0 Note that the filenames should be terminal_prompt0.png, terminal_prompt1.png, and so on.


No comments :