Dynamic Konsole Session Tabs/Names for Gentoo

Last time I made a file for Red Hat/Fedora, this time you can use this for Gentoo. I dropped this into /etc/profile.d/konsole-prompt-command.sh and made it executable (chmod 755 /etc/profile.d/konsole-prompt-command.sh). The problem is I have to modify each user's .bashrc because Gentoo decides to put PROMPT_COMMAND into the /etc/skel/.bashrc instead of one central location. Ugh.

# if we're running in bashif [ -n "${BASH_VERSION}" -a -n "${PS1}" -a "${TERM}" = "xterm" ]; then        DEFAULT_COLOR=7692047        SYSTEM_COLOR=10485760        COLOR=        KONSOLE_USER=        # set color to DEFAULT_COLOR for non-system users        if [ `id -u` -gt 99 ]; then                COLOR=$DEFAULT_COLOR                # prefix the username only if the username is different                # from the initial login name (and we're not a system user)                if [ "`stat -c %U \`tty\``" != "`id -un`" ]; then                        KONSOLE_USER="${USER}@"                fi        # set color to SYSTEM_COLOR for system users        else                COLOR=$SYSTEM_COLOR        fi        BASH_DEFAULT='\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007'        BASH_KONSOLE='\e]30;${KONSOLE_USER}${HOSTNAME%%.*}:$(basename ${PWD/#$HOME/~})\a\e[28;${COLOR}t'        PROMPT_COMMAND='echo -ne "'${BASH_DEFAULT}${BASH_KONSOLE}'"'fi# vim: set syntax=sh tabstop=4 :

links

social