From c7c1641b81359f269d6ca303edaec89416458fc9 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Mon, 27 Jul 2009 00:29:34 +0200 Subject: [PATCH] Xdefaults: Prepare to be terminal emulator independent. Also update setup.sh to correctly create Xdefaults from Xdefaults.in. --- Xdefaults.in | 46 ++++++++++++++++++++++++++-------------------- setup.sh | 17 ++++++++++++++--- 2 files changed, 40 insertions(+), 23 deletions(-) diff --git a/Xdefaults.in b/Xdefaults.in index 5bd7bab..b5572a8 100644 --- a/Xdefaults.in +++ b/Xdefaults.in @@ -1,10 +1,16 @@ ! Configuration file for X11 programs. +! +! It is designed to work with xterm (and its unicode variant). +! +! "Term" is an alias for all supported terminal emulators; it is automatically +! replaced by setup.sh. -! Use gray on black with a light yellow cursor in XTerm. -XTerm*foreground: #cccccc -XTerm*background: black -XTerm*cursorColor: #ffff66 +! Use gray on black with a light yellow cursor in terminals. +Term*foreground: #cccccc +Term*background: black +Term*cursorColor: #ffff66 + ! Use the meta-key as expected by emacs/irssi. XTerm*metaSendsEscape: true ! Make sure XTerm allows send events. Necessary for stumpWM so Ctrl-t t can @@ -16,22 +22,22 @@ XTerm*metaSendsEscape: true XTerm.termName: xterm-256color ! Main console colors. -XTerm*color0: #000000 -XTerm*color1: #ff0000 -XTerm*color2: #00ff00 -XTerm*color3: #ffff00 -XTerm*color4: #0000ff -XTerm*color5: #ff00ff -XTerm*color6: #00ffff -XTerm*color7: #ffffff +Term*color0: #000000 +Term*color1: #ff0000 +Term*color2: #00ff00 +Term*color3: #ffff00 +Term*color4: #0000ff +Term*color5: #ff00ff +Term*color6: #00ffff +Term*color7: #ffffff ! Bold console colors. -XTerm*color8: #404040 -XTerm*color9: #ff4040 -XTerm*color10: #40ff40 -XTerm*color11: #ffff40 -XTerm*color12: #4040ff -XTerm*color13: #ff40ff -XTerm*color14: #40ffff -XTerm*color15: #cccccc +Term*color8: #404040 +Term*color9: #ff4040 +Term*color10: #40ff40 +Term*color11: #ffff40 +Term*color12: #4040ff +Term*color13: #ff40ff +Term*color14: #40ffff +Term*color15: #cccccc ! vim: ft=xdefaults diff --git a/setup.sh b/setup.sh index 1feb7ad..25f4684 100755 --- a/setup.sh +++ b/setup.sh @@ -13,9 +13,20 @@ if installed xmonad; then fi if installed X; then - # Use settings for XTerm also for UXTerm. This prevents code duplication. - generate awk Xdefaults \ - '{ print ; if ( /^XTerm/ ) { print "U" $0 } }' + # Prevent code duplication. Term* rules are for all terminals; XTerm rules + # are for XTerm and UXTerm. At the moment XTerm and UXTerm are supported. + generate perl Xdefaults -ne \ + 'if (/^Term/) { + s/^Term//; + print "XTerm", $_; + print "UXTerm", $_; + } elsif (/^XTerm/) { + print $_; + s/^XTerm//; + print "UXTerm", $_; + } else { + print $_; + }' # Xdefaults uses ! as comment instead of #. tmp file necessary because of # different implementations of `sed -i`. sed 's/^#/!/' Xdefaults > Xdefaults.tmp -- 2.44.1