diff --git a/Scripts/renameTitle.pl b/Scripts/renameTitle.pl index e6595a8..7646289 100755 --- a/Scripts/renameTitle.pl +++ b/Scripts/renameTitle.pl @@ -1,4 +1,25 @@ -#!/usr/bin/perl +#!/bin/bash + #dcop $KONSOLE_DCOP_SESSION renameSession "$@" -print "\033]30;".join(" ",@ARGV)."\007"; + +#!/usr/bin/perl +#print "\033]30;".join(" ",@ARGV)."\007"; + +# Set terminal title +# @param string $1 Tab/window title +# @param string $2 (optional) Separate window title +# The latest version of this software can be obtained here: +# See: http://fvue.nl/wiki/NameTerminal +function nameTerminal() { + [ "${TERM:0:5}" = "xterm" ] && local ansiNrTab=0 + [ "$TERM" = "rxvt" ] && local ansiNrTab=61 + [ "$TERM" = "konsole" ] && local ansiNrTab=30 ansiNrWindow=0 + # Change tab title + [ $ansiNrTab ] && echo -n $'\e'"]$ansiNrTab;$1"$'\a' + # If terminal support separate window title, change window title as well + [ $ansiNrWindow -a "$2" ] && echo -n $'\e'"]$ansiNrWindow;$2"$'\a' +} # nameTerminal() + +nameTerminal $1 $2 +