]> ruderich.org/simon Gitweb - config/dotfiles.git/commitdiff
Xdefaults: Prepare to be terminal emulator independent.
authorSimon Ruderich <simon@ruderich.org>
Sun, 26 Jul 2009 22:29:34 +0000 (00:29 +0200)
committerSimon Ruderich <simon@ruderich.org>
Sun, 26 Jul 2009 22:31:05 +0000 (00:31 +0200)
Also update setup.sh to correctly create Xdefaults from Xdefaults.in.

Xdefaults.in
setup.sh

index 5bd7bab953693b8cd3fbcd2b5ba0773607a6b4a1..b5572a89aba29ff56b02d28aa313c5232aefda18 100644 (file)
@@ -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
index 1feb7ad68dad1fe19aa7a8dfe408f5e125396ac4..25f46843905f0823c507c4500f3dd9364eb5d296 100755 (executable)
--- 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