summaryrefslogtreecommitdiffstats
path: root/bashrc
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2009-02-28 17:03:14 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2009-02-28 17:03:14 +0100
commita44aa7dc482bf8f5243ebf0691e4c40605b9adaf (patch)
treeb9891a30f6b2aea1c2bbab049312eccb8e4d454b /bashrc
parent917bcbb22e81f453e019a31c52734e172fe5b264 (diff)
downloaddotfiles-a44aa7dc482bf8f5243ebf0691e4c40605b9adaf.tar.gz
dotfiles-a44aa7dc482bf8f5243ebf0691e4c40605b9adaf.tar.xz
dotfiles-a44aa7dc482bf8f5243ebf0691e4c40605b9adaf.zip
added srceen magic
automatic rename of screen window
Diffstat (limited to 'bashrc')
-rw-r--r--bashrc/common/screen.sh19
-rw-r--r--bashrc/main.sh6
2 files changed, 25 insertions, 0 deletions
diff --git a/bashrc/common/screen.sh b/bashrc/common/screen.sh
new file mode 100644
index 0000000..734ccfb
--- /dev/null
+++ b/bashrc/common/screen.sh
@@ -0,0 +1,19 @@
+# screen shelltitle magic
+
+set_screen_title() {
+ # prevent reset_screen_title from calling set_screen_title
+ if [[ $BASH_COMMAND != "reset_screen_title" ]]; then
+ echo -ne "\ek$(id -un)@$(hostname):${BASH_COMMAND/ *}\e\\"
+ fi
+}
+
+reset_screen_title() {
+ echo -ne "\ek$(id -un)@$(hostname)\e\\"
+}
+
+init_preexec_hack() {
+ if [[ $TERM == "screen" ]]; then
+ export PROMPT_COMMAND=reset_screen_title
+ trap set_screen_title DEBUG
+ fi
+}
diff --git a/bashrc/main.sh b/bashrc/main.sh
index aa1c10c..ad922d4 100644
--- a/bashrc/main.sh
+++ b/bashrc/main.sh
@@ -102,6 +102,9 @@ _load common dircolors
# command prompt
#_load common prompt
+# screen shelltitle magic
+_load common screen
+
# bash completion
_load common bashcomp
@@ -110,3 +113,6 @@ _load dist common
# load distribution specific node settings
_load node ${_DISTNAME}
+
+# initialize preexec hack last
+init_preexec_hack