You are not logged in.

#1 2007-03-04 14:40:47

Crazypu
Member
From: Italy
Registered: 2007-02-06
Posts: 70

Info script

I' m trying to use the info script found on this forum, but I' ve some problem..... tongue
This is the script:

#!/usr/bin/perl

# colors
$c1 = "\e[0;34m";
$c2 = "\e[0;36m";
$c3 = "\e[0;m";

#what values to display. Use "OS Kernel DE WM WMTheme Font Icon Theme"
$display = "OS Kernel DE WM WMTheme Theme Icon Font";


use Switch;

@wm = ("fluxbox", "openbox", "blackbox",
       "xfwm", "metacity", "kwin");
@line = ();
%de = ("gnome", "gnome-session",
       "xfce", "xfce",
       "kde", "ksmserver");
$quite = 1; # Prints little debugging messages if set to 0;
$tryWP = 1; # trys to find your wallpaper if set to 0;

## Dont alter after this ##
my $isDE = 0;
my $version = `cat /etc/arch-release`;
my $kernel = `uname -r`;
$version =~ s/\s+/ /g;
$kernel =~ s/\s+/ /g;
$version = "$c1 OS:$c3 $version";
$kernel = "$c1 Kernel:$c3 $kernel";
if ( $display =~ "OS"){
    push(@line, "$version");
}
if ( $display =~ "Kernel"){
    push(@line, "$kernel");
}

parsePS(2);
$isDE == 0 && print "No DE found, not running one?..\n" unless $quite == 1;

if( $isDE == 0 ) {
   if( !open(GTKRC, "<", "$ENV{HOME}/.gtkrc-2.0")  ) {
      print "$ENV{HOME}.gtkrc-2.0 -> $!...\n";
   } else {
      while( <GTKRC> ) {
         if( /include "$ENV{HOME}\/\.themes\/(.+)\/gtk-(1|2)\.0\/gtkrc"/ ){
            $theme = "$c1 Theme:$c3 $1";
            if ( $display =~ m/Theme/ ) {
                push(@line, "$theme");
            }
         }
         if( /gtk-icon-theme-name.*=.*"(.+)"/ ) {
            $icon = "$c1 Icons:$c3 $1";
            if ( $display =~ m/Icon/ ) {
                push(@line, "$icon");
            }
         }
         if( /gtk-font-name.*=.*"(.+)"/ ) {
            $font = "$c1 Font:$c3 $$1";
            if ( $display =~ m/Font/ ) {
                push(@line, "$font");
            }
         }
      }
      close(GTKRC);
   }

   ## Processes First
   parsePS(1);
   
   ## Couldn't find a WM in PS
   $WM =~ /Unknown/ && print "No WM found, yours isn't on the list?...\n" unless $quite == 1;
} else {
   grabDEinfo($DE);
}       


print "
$c1              __
$c1          _=(SDGJT=_
$c1        _GTDJHGGFCVS)                @line[0]
$c1       ,GTDJGGDTDFBGX0               @line[1]
$c1      JDJDIJHRORVFSBSVL$c2-=+=,_        @line[2]
$c1     IJFDUFHJNXIXCDXDSV,$c2  \"DEBL      @line[3]
$c1    |LKDSDJTDU=OUSCSBFLD.$c2   '?ZWX,   @line[4]
$c1    LMDSDSWH'    \`?DCBOSI$c2     DRDS], @line[5]
$c1   SDDFDFH'        \`0YEWD,$c2   )HDROD  @line[6]
$c1  !KMDOCG            &GSU|$c2\_GFHRGO'   @line[7]
$c1  HKLSGP'$c2           __$c1\TKM0$c2\GHRBV)'
$c1 JSNRVW'$c2       __+MNAEC$c1\IOI,$c2\BN'
$c1 HELK['$c2    __,=OFFXCBGHC$c1\FD)
$c1 ?KGHE $c2\_-#DASDFLSV='$c1    'EF
$c1 'EHTI                   !H
$c1  \`0F'                   '!
";

sub parsePS {
   my $x = 0;
   my $y = 0;
   my $found = 0;
   my $psl = `ps -A | awk {'print \$4'}`;
   @psl = split(/\n/, $psl);

   switch (shift @_) {
      case 1 {
         $WM = "Unknown";
         while( $x < @wm && $found == 0 ) {
            while( $y < @psl ) {
               print "Testing '$psl[$y]' with '$wm[$x]'\n" unless $quite == 1;
               if( $psl[$y] =~ /$wm[$x]/ ) {
                  $WM = $wm[$x];
                  if ( $display =~ m/WM/ ) {
                  push(@line, "$c1 WM:$c3 $WM");
                  }
                  print "WM found as $WM\n" unless $quite == 1;
                  getWMtheme();
                  $found = 1;
                  last;
               }
               $y++;
            }
            $y = 0;
            $x++;
            $found == 1 && last;
         }
      }
      case 2 {
         $isDE = 0;
         $DE = "None";
         while( ($dev, $devid) = each(%de) ) {
            while( $x < @psl ) {
               print "Testing '$psl[$x]' with '$devid'\n" unless $quite == 1;
               if( $psl[$x] =~ /$devid/ ) {
                  $DE = $dev;
                  print "DE found as $DE\n" unless $quite == 1;
                  $found = 1;
                  $isDE = 1;
                  if ( $display =~ m/DE/ ) {
                      push(@line, "$c1 DE:$c3 $DE");
                  }
                  last;
               }
               $x++;
            }
            $x = 0;
            $found == 1 && last;
         }
      }
   }
}

sub getWMtheme {

   switch($WM) {
      case "openbox" {
         open(FILE, "<", "$ENV{HOME}/.config/openbox/rc.xml")
            || die("$!\nFailed to open OpenBox rc.xml...\n");
         while( <FILE> ) {
            if( /<name>(.+)<\/name>/ ) {
               print "OB Theme found as $1\n" unless $quite == 1;
               $WMTHEME = $1;
               $wmtheme = "$c1 WM Theme:$c3 $WMTHEME";
               if ( $display =~ m/WMTheme/ ) {
                   push(@line, "$wmtheme");
               }
               last;
                }
              }
         close(FILE);
      }
      case "metacity" {
         $WMTHEME = `gconftool-2 -g /apps/metacity/general/theme`;
         $wmtheme = "$c1 WM Theme:$c3 $WMTHEME";
         if ( $display =~ m/WMTheme/ ) {
             push(@line, "$wmtheme");
         }
      }
      case "fluxbox" {
         open(FILE, "<", "$ENV{HOME}/.fluxbox/init")
            || die("$!\nFailed to open Fluxbox init file...\n");
         while( <FILE> ) {
            if( /session.styleFile: \/.+\/(.+)$/ ) {
               print "FB Theme found as $1\n";
               $WMTHEME = $1;
               $wmtheme = "$c1 WM Theme:$c3 $WMTHEME";
               if ( $display =~ m/WMTheme/ ) {
                   push(@line, "$wmtheme");
               }
               last;
            }
         }
         close(FILE);
      }
      case "blackbox" {
         open(FILE, "<", "$ENV{HOME}/.blackboxrc")   
            || die("$!\nFailed to open Blackbox .blackboxrc file...\n");
                        while( <FILE> ) {
                                if( /session.styleFile: \/.+\/(.+)$/ ) {
                                        print "BB Theme found as $1\n";
               $WMTHEME = $1;
               $wmtheme = "$c1 WM Theme:$c3 $WMTHEME";
               if ( $display =~ m/WMTheme/ ) {
               push(@line, "$wmtheme");
               }
               last;
            }
         }
         close(FILE);
      }
      case "xfwm" {
         open(FILE, "<", "$ENV{HOME}/.config/xfce4/mcs_settings/xfwm4.xml")
            || die("XFCE4 -> $!...\n");
         while( <FILE> ) {
            if( /<option name="Xfwm\/ThemeName" type="string" value="(.+)"\/>/ ) {
               $WMTHEME = $1;
               $wmtheme = "$c1 WM Theme:$c3 $WMTHEME";
               if ( $display =~ m/WMTheme/ ) {
                   push(@line, "$wmtheme");
                        }
            }
         }
         close(FILE);
      }
      case "kwin" {
        open(FILE, "<", "$ENV{HOME}./kde/share/config/kwinrc")
          || die("\nFailed to open kwin config file \n");
        while( <FILE> ) {
          if( /PluginLib=(.+)/ ) {
            $WMTHEME = $1;
            $wmtheme = "$c1 WM Theme:$c3 $WMTHEME";
            if ( $display =~ m/WMTheme/ ) {
              push(@line, "$wmtheme");
            }
          }
         }
         close(FILE);
     }
   }
}

sub grabDEinfo {

   switch(shift @_) {
      case "gnome" {
         parsePS(1);
         if ( $display =~ m/Theme/ ) {
             $THEME = `gconftool-2 -g /desktop/gnome/interface/gtk_theme`;
             $theme = "$c1 Theme:$c3 $THEME";
             push(@line, "$theme");
         }
         if ( $display =~ m/Icon/ ) {
             $ICON = `gconftool-2 -g /desktop/gnome/interface/icon_theme`;
             $icon = "$c1 Icon:$c3 $Icon";
             push(@line, "$icon");
         }
         if ( $display =~ m/Font/ ) {
            $FONT = `gconftool-2 -g /desktop/gnome/interface/font_name`;
            $font = "$c1 Font:$c3 $FONT";
            push(@line, "$font");
         }
      }
      case "xfce" {
         parsePS(1);
         open(FILE, "<", "$ENV{HOME}/.config/xfce4/mcs_settings/gtk.xml")
            || die("XFCE4 GTK -> $!...\n");
         while( <FILE> ) {
            if( /<option name="Net\/ThemeName" type="string" value="(.+)"\/>/ ) {
               $THEME = $1;
               $theme = "$c1 Theme:$c3 $THEME";
               if ( $display =~ m/Theme/ ) {
                   unshift(@xfce, "$theme");
               }
            }
            if( /<option name="Net\/IconThemeName" type="string" value="(.+)"\/>/ ) {
               $ICON = $1;
               $icon = "$c1 Icon:$c3 $ICON";
               if ( $display =~ m/Icon/ ) {
                   unshift(@xfce, "$icon");
               }
            }
            if( /<option name="Gtk\/FontName" type="string" value="(.+)"\/>/ ) {
               $FONT = $1;
               $font = "$c1 Font:$c3 $FONT";
               if ( $display =~ m/Font/ ) {
                   unshift(@xfce, "$font");
               }
            }
         }
         close(FILE);
            foreach $i (@xfce) {
               push(@line, "$i");
            }
      }
      case "kde" {
        prasePS(1);
        open(FILE, "<", "$ENV{HOME}/.kde/share/config/kdeglobals")
          || die("\nFailed to open kwin config file \n");
        while( <FILE> ) {
          if( /Theme=(.+)/ ) {
            $ICON = $1;
            $icon = "$c1 Icon:$c3 $ICON";
               if ( $display =~ m/Icon/ ) {
                 push(@line, $icon);
               }
          }
          if( /widgetStyle(.+)/ ) {
            $THEME = $1;
            $theme = "$c1 Theme:$c3 $THEME";
              if ( $display =~ m/Theme/ ) {
                push(@line, $icon);
              }
          }
          if( /font=(.+),.*/ ) {
            $FONT = $1;
            $font = "$c1 Font:$c3 $FONT";
              if ( $display =~ m/Icon/ ) {
                push(@line, $font);
              }
          }
        }
      }
   }
}

and this is the result:
screenshot1vv0.png
What' s wrong?

Offline

#2 2007-03-04 16:08:55

TomE
Member
Registered: 2005-08-06
Posts: 164

Re: Info script

That is an old version try this one

Offline

#3 2007-03-04 17:12:19

shen
Member
Registered: 2003-09-05
Posts: 272
Website

Re: Info script

This may sound weird but how the heck do you run this script?

Offline

#4 2007-03-04 17:42:26

dolby
Member
From: 1992
Registered: 2006-08-08
Posts: 1,581

Re: Info script

perl filename.pl

err the last one is b0rked

i use http://pastebin.archlinux.org/1784

Last edited by dolby (2007-03-04 17:50:09)


There shouldn't be any reason to learn more editor types than emacs or vi -- mg (1)
[You learn that sarcasm does not often work well in international forums.  That is why we avoid it. -- ewaller (arch linux forum moderator)

Offline

#5 2007-03-04 17:51:12

shen
Member
Registered: 2003-09-05
Posts: 272
Website

Re: Info script

well that script does nothing but spit out errors./..I just assumed doing perl scriptname was wrong..

Offline

#6 2007-03-04 17:56:30

TomE
Member
Registered: 2005-08-06
Posts: 164

Re: Info script

I middle clicked twice yikes
try this

Last edited by TomE (2007-03-04 17:57:03)

Offline

#7 2007-03-04 18:10:04

shen
Member
Registered: 2003-09-05
Posts: 272
Website

Re: Info script

Ok works perfect ...Now the ASCII arch symbol where it should be light blue on the right side the smaller boomerang looking thing shows as the text color instead of light blue...:) Sorry just letting you know.

Offline

#8 2007-03-04 18:13:02

TomE
Member
Registered: 2005-08-06
Posts: 164

Re: Info script

shen wrote:

Ok works perfect ...Now the ASCII arch symbol where it should be light blue on the right side the smaller boomerang looking thing shows as the text color instead of light blue...:) Sorry just letting you know.

change line 334 to

my $c2 = "\e[1;34m";

Offline

#9 2007-03-04 18:19:06

Crazypu
Member
From: Italy
Registered: 2007-02-06
Posts: 70

Re: Info script

TomE wrote:

I middle clicked twice yikes
try this

No chance with it......
screenshot1rn0.png

Offline

#10 2007-03-04 18:23:08

TomE
Member
Registered: 2005-08-06
Posts: 164

Re: Info script

Hmm.. what term are you using?
try it in an xterm

Offline

#11 2007-03-04 18:26:02

Crazypu
Member
From: Italy
Registered: 2007-02-06
Posts: 70

Re: Info script

It' s the gnome terminal roll

Offline

#12 2007-03-04 18:31:15

Crazypu
Member
From: Italy
Registered: 2007-02-06
Posts: 70

Re: Info script

Some problem with aterm too.....
screenshot1xg3.png

Offline

#13 2007-03-04 18:39:24

dolby
Member
From: 1992
Registered: 2006-08-08
Posts: 1,581

Re: Info script

in urxvt it works great it doesnt detect the gtk theme tho. maybe cause i aint got gnome installed


There shouldn't be any reason to learn more editor types than emacs or vi -- mg (1)
[You learn that sarcasm does not often work well in international forums.  That is why we avoid it. -- ewaller (arch linux forum moderator)

Offline

#14 2007-03-04 18:39:35

shen
Member
Registered: 2003-09-05
Posts: 272
Website

Re: Info script

I am using Eterm and it aligns right just don't like the color combos

Offline

#15 2007-03-04 18:39:39

TomE
Member
Registered: 2005-08-06
Posts: 164

Re: Info script

looks like VTE does not like how the colors are set.
\e[0;m needs changing to \e[0m

run this:

sed -i -e 's/\\e\[0;m/\\e\[0m/g' ./info.pl

Offline

#16 2007-03-04 18:41:09

TomE
Member
Registered: 2005-08-06
Posts: 164

Re: Info script

dolby wrote:

in urxvt it works great it doesnt detect the gtk theme tho. maybe cause i aint got gnome installed

how do you set your gtk theme?

Offline

#17 2007-03-04 18:41:29

shen
Member
Registered: 2003-09-05
Posts: 272
Website

Re: Info script

Ok fixed the colors after playing around abit..:)

Thanks for the script..:)

Last edited by shen (2007-03-04 18:42:30)

Offline

#18 2007-03-04 18:44:56

dolby
Member
From: 1992
Registered: 2006-08-08
Posts: 1,581

Re: Info script

TomE wrote:
dolby wrote:

in urxvt it works great it doesnt detect the gtk theme tho. maybe cause i aint got gnome installed

how do you set your gtk theme?

with gtk-theme-switch2


There shouldn't be any reason to learn more editor types than emacs or vi -- mg (1)
[You learn that sarcasm does not often work well in international forums.  That is why we avoid it. -- ewaller (arch linux forum moderator)

Offline

#19 2007-03-04 18:51:42

TomE
Member
Registered: 2005-08-06
Posts: 164

Re: Info script

It works here using gtk-theme-switch2.
Do you have gnome-session, xfce-mcs-manage or ksmserver running?

Can you change lie 24 to

my $quite = 0;

and post the out put

Last edited by TomE (2007-03-04 18:58:33)

Offline

#20 2007-03-04 19:03:39

dolby
Member
From: 1992
Registered: 2006-08-08
Posts: 1,581

Re: Info script

no it still doesnt work. ive got a plain openbox. no gnome/xfce/kde/*

:: Finding Kernel version
:: Getting processes 
:: Testing KDE process: ksmserver 
:: Testing Gnome process: gnome-session 
:: Testing Xfce4 process: xfce-mcs-manage 
:: Testing PekWM process: pekwm 
:: Testing Fluxbox process: fluxbox 
:: Testing FVWM process: fvwm 
:: Testing Blackbox process: blackbox 
:: Testing IceWM process: icewm 
:: Testing Enlightenment process: enlightenment 
:: Testing Openbox process: openbox 
:: WM found as Openbox
:: Finding Openbox theme
:: Openbox theme found as DarkGraph
:: Opening /home/dou/.gtkrc-2.0
:: Opening /home/dou/.gtkrc.mine
:: Icons found as Tango
:: Font found as Sans 9
:: Finding Archlinux version
              __
          _=(SDGJT=_
        _GTDJHGGFCVS)                 OS: Arch Linux 0.8 (Voodoo) 
       ,GTDJGGDTDFBGX0                Kernel: 2.6.20-ARCH 
      JDJDIJHRORVFSBSVL-=+=,_         WM: Openbox
     IJFDUFHJNXIXCDXDSV,  "DEBL       WM Theme: DarkGraph
    [LKDSDJTDU=OUSCSBFLD.   '?ZWX,    Icons: Tango
   ,LMDSDSWH'     `DCBOSI     DRDS],  Font: Sans 9
   SDDFDFH'         !YEWD,   )HDROD  
  !KMDOCG            &GSU|_GFHRGO'   
  HKLSGP'           __TKM0GHRBV)'    
 JSNRVW'       __+MNAECIOI,BN'
 HELK['    __,=OFFXCBGHCFD)
 ?KGHE _-#DASDFLSV='    'EF
 'EHTI                   !H
  `0F'                   '!

while the one i used before (link posted above)

OS: Arch Linux 0.8 (Voodoo)
Kernel: 2.6.20-ARCH
Gtk Theme: Murrina-Black
Gtk Icons: Tango
Gtk Font: Sans 9
WM: Openbox
Openbox Theme: DarkGraph

There shouldn't be any reason to learn more editor types than emacs or vi -- mg (1)
[You learn that sarcasm does not often work well in international forums.  That is why we avoid it. -- ewaller (arch linux forum moderator)

Offline

#21 2007-03-04 19:12:11

TomE
Member
Registered: 2005-08-06
Posts: 164

Re: Info script

OK I see what's goin on, murrine-black is in /usr/share/themes I was only looking in ~/.themes

try this

Offline

#22 2007-03-04 19:21:52

dolby
Member
From: 1992
Registered: 2006-08-08
Posts: 1,581

Re: Info script

yeap works like a charm now. thanks's smile


There shouldn't be any reason to learn more editor types than emacs or vi -- mg (1)
[You learn that sarcasm does not often work well in international forums.  That is why we avoid it. -- ewaller (arch linux forum moderator)

Offline

#23 2007-03-04 19:54:05

heathen
Member
From: depends on the day...
Registered: 2007-01-31
Posts: 45

Re: Info script

works great for me in Aterm..  thanks, I've been trying to get this working for a while now..


insanity happens...

Offline

#24 2007-03-04 23:21:39

Crazypu
Member
From: Italy
Registered: 2007-02-06
Posts: 70

Re: Info script

TomE wrote:

OK I see what's goin on, murrine-black is in /usr/share/themes I was only looking in ~/.themes

try this

This one is better.... but not 100% correct:
screenshot1pi8.png

Offline

#25 2007-03-04 23:56:10

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Re: Info script

dolby wrote:

no it still doesnt work. ive got a plain openbox. no gnome/xfce/kde/*

:: Finding Kernel version
:: Getting processes 
:: Testing KDE process: ksmserver 
:: Testing Gnome process: gnome-session 
:: Testing Xfce4 process: xfce-mcs-manage 
:: Testing PekWM process: pekwm 
:: Testing Fluxbox process: fluxbox 
:: Testing FVWM process: fvwm 
:: Testing Blackbox process: blackbox 
:: Testing IceWM process: icewm 
:: Testing Enlightenment process: enlightenment 
:: Testing Openbox process: openbox 
:: WM found as Openbox
:: Finding Openbox theme
:: Openbox theme found as DarkGraph
:: Opening /home/dou/.gtkrc-2.0
:: Opening /home/dou/.gtkrc.mine
:: Icons found as Tango
:: Font found as Sans 9
:: Finding Archlinux version
              __
          _=(SDGJT=_
        _GTDJHGGFCVS)                 OS: Arch Linux 0.8 (Voodoo) 
       ,GTDJGGDTDFBGX0                Kernel: 2.6.20-ARCH 
      JDJDIJHRORVFSBSVL-=+=,_         WM: Openbox
     IJFDUFHJNXIXCDXDSV,  "DEBL       WM Theme: DarkGraph
    [LKDSDJTDU=OUSCSBFLD.   '?ZWX,    Icons: Tango
   ,LMDSDSWH'     `DCBOSI     DRDS],  Font: Sans 9
   SDDFDFH'         !YEWD,   )HDROD  
  !KMDOCG            &GSU|_GFHRGO'   
  HKLSGP'           __TKM0GHRBV)'    
 JSNRVW'       __+MNAECIOI,BN'
 HELK['    __,=OFFXCBGHCFD)
 ?KGHE _-#DASDFLSV='    'EF
 'EHTI                   !H
  `0F'                   '!

while the one i used before (link posted above)

OS: Arch Linux 0.8 (Voodoo)
Kernel: 2.6.20-ARCH
Gtk Theme: Murrina-Black
Gtk Icons: Tango
Gtk Font: Sans 9
WM: Openbox
Openbox Theme: DarkGraph

Your arch data should perhaps have....."voodoo Arch Linux" thruout the simulation!!!!!!!


Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

Board footer

Powered by FluxBB