ChangeLog entry for previous commits.
[fvwm-themes.git] / bin / fvwm-themes-xrdb.in
blobcd4672edc953799747e3a72a51ec16476e5eb111
1 #!@PERL@ -w
3 my $font = "-*-lucidabright-medium-r-*-*-14-*-*-*-*-*-*-*";
4 my %fore = ();
5 my %back = ();
7 my @colorsetNames = qw(
8         default          inactivewindow   activewindow     inactivemenuitem
9         activemenuitem   greyedmenuitem   defaultmodule    swallowedwindow
10         hilight          balloons         special          iconmanstandard
11         iconmanactive    iconmaniconified form             formitem
12         defaultpager     ident            scroll           dummy
13         term             term-root        term-special     term-remote
14         term-reserved    
17 my $prefix = '@prefix@';
18 my $ROOT_PREFIX = '@ROOT_PREFIX@';
19 $ROOT_PREFIX = $ENV{'DESTDIR'} if $ENV{'DESTDIR'};
21 my $userHome = $ENV{'HOME'} || "./.";
22 my $config = "@bindir@/fvwm-themes-config";
23 my $file = `$config --component colors --show-value read-file`;
24 chomp($file);
25 open(INFILE, "$file");
26 my @lines = <INFILE>;
27 close(INFILE);
29 foreach (@lines) {
30         if (/^\*FvwmTheme:?\s*Colorset\s+(\d+)\s+(.*)$/) {
31                 my $cs = $colorsetNames[$1] || '*unknown*';
32                 my $options = $2;
33                 $fore{$cs} = $2 if $options =~ /(fg|foreground)\s+([^\s,]+)/;
34                 $back{$cs} = $2 if $options =~ /(bg|background)\s+([^\s,]+)/;
35         }
38 $xresources = qq{
39 *Menu*background:              $back{form}
40 rxvt*background:               $back{term}
41 rxvt*foreground:               $fore{term}
42 *term*background:              $back{term}
43 *term*foreground:              $fore{term}
44 *text*background:              $back{term}
45 *list*background:              $back{term}
46 *Text*background:              $back{term}
47 *List*background:              $back{term}
48 *Scrollbar*foreground:         $fore{inactivewindow}
49 *foreground:                   $fore{form}
50 *background:                   $back{form}
51 OpenWindows*WindowColor:       $back{form}
52 Window.Color.background:       $back{form}
53 netscape*background:           $back{form}
54 netscape*foreground:           $fore{form}
55 Netscape*background:           $back{form}
56 Netscape*foreground:           $fore{form}
57 .netscape*background:          $back{form}
58 .netscape*foreground:          $back{form}
59 Ddd*background:                $back{term}
60 Emacs*background:              $back{term}
61 Emacs*backgroundToolBarColor:  $back{term}
62 *fontList:                     $font
63 Netscape*fontList:             $font
64 .netscape*fontList:            $font
67 open(XRDB, "|xrdb -merge -");
68 #open(XRDB, "|cat -");  # for testing
69 print XRDB $xresources;
70 close(XRDB);
72 # It is not very good to write to ~/.gtkrc & ~/.xresources without back uping.
73 # GNOME gtk engines create ~/.gtkrc, which includes ~/.gtkrc.mine if exists.
75 open(OUTFILE, ">$userHome/.xresources");
76 print OUTFILE $xresources;
77 close(OUTFILE);
79 open(OUTFILE, ">$userHome/.gtkrc.mine");
80 print OUTFILE qq{
81 style "process"
83   font              = "$font"
84   fg[NORMAL]        = "$fore{form}"
85   text[NORMAL]      = "$fore{form}"
86   fg[ACTIVE]        = "$fore{form}"
87   text[ACTIVE]      = "$fore{form}"
88   fg[PRELIGHT]      = "$fore{form}"
89   text[PRELIGHT]    = "$fore{form}"
90   fg[SELECTED]      = "$back{form}"
91   text[SELECTED]    = "$back{form}"
92   fg[INSENSITIVE]   = "$fore{form}"
93   text[INSENSITIVE] = "$fore{form}"
94   bg[NORMAL]        = "$back{form}"
95   base[NORMAL]      = "$back{form}"
96   bg[ACTIVE]        = "$back{form}"
97   base[ACTIVE]      = "$back{form}"
98   bg[PRELIGHT]      = "$back{form}"
99   base[PRELIGHT]    = "$back{form}"
100   bg[SELECTED]      = "$fore{form}"
101   base[SELECTED]    = "$fore{form}"
102   bg[INSENSITIVE]   = "$back{form}"
103   base[INSENSITIVE] = "$back{form}"
105 style "tooltips-style" {
106   bg[NORMAL] = "#ffffc0"
107   fg[NORMAL] = "#000000"
108   bg_pixmap[NORMAL] = "<none>"
111 widget_class "*GtkProgress*" style "process"
112 widget_class "*Gtk*List*"    style "process"
113 widget_class "*Gtk*Tree*"    style "process"
114 widget_class "*GtkText*"     style "process"
115 widget_class "*GtkEntry*"    style "process"
116 widget_class "*"             style "process"
117 widget       "gtk-tooltips"  style "tooltips-style"
119 close(OUTFILE);