--- lib/PXElator/x11.pm 2009/08/12 01:29:11 202 +++ lib/PXElator/x11.pm 2009/08/16 21:27:39 228 @@ -12,7 +12,7 @@ open(my $rgb, '<', '/etc/X11/rgb.txt'); while(<$rgb>) { chomp; - my (undef,$col) = split(/\s\s+/,$_,2); + my $col = $1 if m{(\S+)\s*$}; next unless $col =~ m{Light}; push @cols, $col if $last_col ne $col; $last_col = $col; @@ -22,6 +22,7 @@ sub xterm { my ( $name, $cmd ) = @_; + $name =~ s{\s+}{-}g; my $screenrc = "/tmp/$name.screenrc"; my ($autodetach,$detach) = $ENV{DISPLAY} ? ('off','') : ( 'on', 'detach' ); @@ -47,8 +48,11 @@ my $exec; if ( $ENV{DISPLAY} ) { - my $fg = $cols[ unpack('C*', $name) % $#cols ]; + my $hash; + $hash += ord($_) foreach ( split //, $name ); + my $fg = $cols[ $hash % $#cols ]; $exec = "xterm -fg $fg -T '$name' -n '$name' -e '$screen'"; +warn "XXXX $exec"; } else { warn "system $screen"; system $screen;