You are not logged in.

#201 2009-04-10 06:49:21

Crooksey
Member
From: UK ~
Registered: 2006-08-14
Posts: 415
Website

Re: Screenshot info grabber - in development!

Opps! Didnt know how that happened neutral


Arch Linux since 2006
Python Web Developer + Sys Admin (Gentoo/BSD)

Offline

#202 2009-04-15 18:35:55

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

Re: Screenshot info grabber - in development!

froli wrote:

Hi guys! I'm using this script below, and I want to know if there's a way to make it show the gtk theme is used even if I'm not using Gnome.

Here's the info.pl

perl.th.png

why after ':' the strings have an offset ?!?!?


+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

#203 2009-04-22 02:34:32

smartboyathome
Member
From: $HOME
Registered: 2007-12-23
Posts: 334
Website

Re: Screenshot info grabber - in development!

This script doesn't work with Enlightenment. It should work fine, but it doesn't detect that Enlightenment is running, nor does it show anything else.

Offline

#204 2009-05-14 15:52:55

kdjtar
Member
From: Brazil
Registered: 2009-05-13
Posts: 13

Re: Screenshot info grabber - in development!

froli wrote:

Hi guys! I'm using this script below, and I want to know if there's a way to make it show the gtk theme is used even if I'm not using Gnome.

Here's the info.pl

I'm trying this but all I get is:

[kdjtar@archfce Desktop]$ perl info.pl 
<Failed>
[kdjtar@archfce Desktop]$

Can someone help me with that?

Offline

#205 2009-06-02 11:40:09

stefanwilkens
Member
From: Enschede, the Netherlands
Registered: 2008-12-10
Posts: 624

Re: Screenshot info grabber - in development!

now that this has been forked into oblivion, is there anybody left actively maintaining this or should we start a new definitive fork

this thread confused the hell out of me version-wise.


Arch i686 on Phenom X4 | GTX760

Offline

#206 2009-06-08 16:29:25

MarcoRosso
Member
Registered: 2009-02-08
Posts: 49

Re: Screenshot info grabber - in development!

I cant get the script to work with the new xfce4 versions. I guess I'll just have to try another one instead. Wish people would post their info.pl files that are up to date.

Offline

#207 2009-07-22 21:10:32

Andrwe
Member
From: Leipzig/Germany
Registered: 2009-06-17
Posts: 322
Website

Re: Screenshot info grabber - in development!

Hi,
very nice script.

Does someone already try to adapt the script for collecting the values on XFCE >= 4.6?

I've tried it but I'm hanging getting the $DE by looking for a process because I haven't found one which doesn't run under XFCE < 4.6.x.

The files for all values are now $HOME/.config/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml for XFCE-theme and $HOME/.config/xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml for Xfwm4-theme.

Does anybody of you have an idea how to get the $DE?


Andrwe

Offline

#208 2009-07-23 06:24:49

Andrwe
Member
From: Leipzig/Germany
Registered: 2009-06-17
Posts: 322
Website

Re: Screenshot info grabber - in development!

Hi,

it's me again.

I found a way to get the correct $DE for XFCE >= 4.6.x by testing for a running xfconfd process.

The script now gives also the name of the background image for XFCE4.6.x.

So here is the modified script which now also supports XFCE4.6.x:

#!/usr/bin/perl
use Switch;
use strict;
use File::Basename;

####################
## Config options ##
####################

## What distro logo to use to use, Available "Archlinux Debian Ubuntu None" ##
my $distro = "Archlinux";
my $myArchVersion = "ArchLinux (Core Dump)";

## what values to display. Use "OS Kernel DE WM win_theme Theme Font Icons" ##
my $display = "OS Kernel DE WM Win_theme Theme Icons Font Background";

## Takes a screen shot if set to 0 ##
my $shot = 0;
## Command to run to take screen shot ##
my $command = "scrot -d 10";

## What colors to use for the variables. ##
my $textcolor = "\e[0m";

## Prints little debugging messages if set to 0 ##
my $quite = 1;



########################
## Script starts here ##
########################
## Define some thing to work with strict ##
my @line = ();
my $found = 0;
my $DE = "NONE";
my $WM = "Beryl";

## Hash of WMs and the process they run ##
my %WMlist = ("Beryl", "beryl",
              "Fluxbox", "fluxbox",
              "Openbox", "openbox",
              "Blackbox", "blackbox",
              "Xfwm4", "xfwm4",
              "Metacity", "metacity",
              "Kwin", "kwin",
              "FVWM", "fvwm",
              "Enlightenment", "enlightenment",
              "IceWM", "icewm",
              "Window Maker", "wmaker",
              "PekWM","pekwm" );

## Hash of DEs and the process they run ##     
my %DElist = ("Gnome", "gnome-session",
              "Xfce4", "xfce-mcs-manage",
          "Xfce4", "xfconfd",
              "KDE", "ksmserver");

## Get Kernel version ##
if ( $display =~ "Kernel"){
  print "\::$textcolor Finding Kernel version\n" unless $quite == 1;
  my $kernel = `uname -r`;
  $kernel =~ s/\s+/ /g;
  $kernel = " Kernel:$textcolor $kernel";
  push(@line, "$kernel");
}

## Find running processes ##
print "\::$textcolor Getting processes \n" unless $quite == 1;
my $processes = `ps -A | awk {'print \$4'}`;

## Find DE ##
while( (my $DEname, my $DEprocess) = each(%DElist) ) {
  print "\::$textcolor Testing $DEname process: $DEprocess \n" unless $quite == 1;
  if ( $processes =~ m/$DEprocess/ ) {
    $DE = $DEname;
    print "\::$textcolor DE found as $DE\n" unless $quite == 1;
    if( $display =~ m/DE/ ) {
      push(@line, " DE:$textcolor $DE");
    }
    last;
  }
}

## Find WM ##
while( (my $WMname, my $WMprocess) = each(%WMlist) ) {
 print "\::$textcolor Testing $WMname process: $WMprocess \n" unless $quite == 1;
  if ( $processes =~ m/$WMprocess/ ) {
    $WM = $WMname;
    print "\::$textcolor WM found as $WM\n" unless $quite == 1;
    if( $display =~ m/WM/ ) {
      push(@line, " WM:$textcolor $WM");
    }
    last;
  }
}

## Find WM theme ##
if ( $display =~ m/Win_theme/ ){
  switch($WM) {
    case "Openbox" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.config/openbox/rc.xml")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) {
        if( /<name>(.+)<\/name>/ ) {
          while ( $found == 0 ) {
            print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
            push(@line, " WM Theme:$textcolor $1");
            $found = 1;
          }
        }
      }
      close(FILE);
    }
    case "Metacity" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      my $gconf = `gconftool-2 -g /apps/metacity/general/theme`;
      print "\::$textcolor $WM theme found as $gconf\n" unless $quite == 1;
      chomp ($gconf);
      push(@line, " WM Theme:$textcolor $gconf");
    }
    case "Fluxbox" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.fluxbox/init")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) {
        if( /session.styleFile:.*\/(.+)/ ) {
          print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
          push(@line, " WM Theme:$textcolor $1");
        }
      }
      close(FILE);
    }
    case "Blackbox" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.blackboxrc")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) {
        if( /session.styleFile:.*\/(.+)/ ) {
          print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
          push(@line, " WM Theme:$textcolor $1");
        }
      }
      close(FILE);
    }
    case "Xfwm4" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.config/xfce4/mcs_settings/xfwm4.xml")
      || open(FILE, "$ENV{HOME}/.config/xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) {
        if( /<option name="Xfwm\/ThemeName" type="string" value="(.+)"\/>/ ) {
          print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
          push(@line, " WM Theme:$textcolor $1");
        }
        if( /<property name="theme" type="string" value="(.+)"\/>/ ) {
          print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
          push(@line, " WM Theme:$textcolor $1");
        }
      } 
      close(FILE);
    }
    case "Kwin" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.kde/share/config/kwinrc")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) {
        if( /PluginLib=kwin3_(.+)/ ) {
          print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
          push(@line, " WM Theme:$textcolor $1");
        }
      }
      close(FILE);
    }
    case "Enlightenment" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      my $remote = `enlightenment_remote -theme-get theme` ;
      if( $remote =~ m/.*FILE="(.+).edj"/ ) {
        print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
        push(@line, " WM Theme:$textcolor $1");
      }     
    }       
    case "IceWM" { 
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.icewm/theme")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) {
        if( /Theme="(.+)\/.*.theme/ ) {
          while( $found == 0 ) {
            print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
            push(@line, " WM Theme:$textcolor $1");
            $found = 1;
          }
        }
      }   
      close(FILE);
    }   
    case "PekWM" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.pekwm/config")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) {
        if( /Theme.*\/(.*)"/ ) {
            print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
            push(@line, " WM Theme:$textcolor $1");
        }
      }
      close(FILE); 
    } 
  }   
}     
      
## Find Theme Icon and Font ##
if ( $display =~ m/[Theme, Icons, Font, Background]/) {
  switch($DE) {
    case "Gnome" {
      print "\::$textcolor Finding $DE variables\n" unless $quite == 1;
      if ( $display =~ m/Theme/ ) {
        my $gconf = `gconftool-2 -g /desktop/gnome/interface/gtk_theme`;
        chomp ($gconf);
        print "\::$textcolor GTK Theme found as $1\n" unless $quite == 1;
        push(@line, " GTK Theme:$textcolor $gconf");
      }
      if ( $display =~ m/Icons/ ) {
        my $gconf = `gconftool-2 -g /desktop/gnome/interface/icon_theme`;
        chomp ($gconf);
        push(@line, " Icons:$textcolor $gconf");
      } 
      if ( $display =~ m/Font/ ) {
        my $gconf = `gconftool-2 -g /desktop/gnome/interface/font_name`;
        chomp ($gconf);
        push(@line, " Font:$textcolor $gconf");
      }
      if ( $display =~ m/Background/ ) {
        my $gconf = `gconftool-2 -g /desktop/gnome/background/picture_filename`;
        chomp ($gconf);
        my $bname = basename($gconf);
        push(@line, " Background:$textcolor $bname");
      }

    } 
    case "Xfce4" {
      my @sort = ();
      print "\::$textcolor Finding $DE variables\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.config/xfce4/mcs_settings/gtk.xml")
      || open(FILE, "$ENV{HOME}/.config/xfce4/xfconf/xfce-perchannel-xml/xsettings.xml")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) {
        if ( $display =~ m/Theme/ ) {
          if (/<option name="Net\/ThemeName" type="string" value="(.+)"\/>/ ) {
            print "\::$textcolor GTK Theme found as $1\n" unless $quite == 1;
            unshift(@sort, " GTK Theme:$textcolor $1");
          } 
          if (/<property name="ThemeName" type="string" value="(.+)"\/>/ ) {
            print "\::$textcolor GTK Theme found as $1\n" unless $quite == 1;
            unshift(@sort, " GTK Theme:$textcolor $1");
          } 
        }
        if ( $display =~ m/Icons/ ) {
          if (/<option name="Net\/IconThemeName" type="string" value="(.+)"\/>/ ) {
            print "\::$textcolor Icons found as $1\n" unless $quite == 1;
            unshift(@sort, " Icons:$textcolor $1");
          }
          if (/<property name="IconThemeName" type="string" value="(.+)"\/>/ ) {
            print "\::$textcolor Icons found as $1\n" unless $quite == 1;
            unshift(@sort, " Icons:$textcolor $1");
          }
        }
        if ( $display =~ m/Font/ ) {
          if ( /<option name="Gtk\/FontName" type="string" value="(.+)"\/>/ ) {
            print "\::$textcolor Font found as $1\n" unless $quite == 1;
            unshift(@sort, " Font:$textcolor $1");
          } 
          if ( /<property name="FontName" type="string" value="(.+)"\/>/ ) {
            print "\::$textcolor Font found as $1\n" unless $quite == 1;
            unshift(@sort, " Font:$textcolor $1");
          } 
        }
      }
      close(FILE);
      if ( $display =~ m/Background/ ) {
    open(FILE_BG, "$ENV{HOME}/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-desktop.xml");
        while( <FILE_BG> ) {
          if ( /<property name="image-path" type="string" value="(.+)"\/>/ ) {
            print "\::$textcolor Background found as $1\n" unless $quite == 1;
            my $bname = basename($1);
            unshift(@sort, " Background:$textcolor $bname");
          } 
        }
        close(FILE_BG);
      }
      ## Sort variables so they're ordered "Theme Icon Font" ##
      foreach my $i (@sort) {
        push(@line, "$i");
      }
    } 
    case "KDE" { 
      print "\::$textcolor Finding $DE variables\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.kde/share/config/kdeglobals")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) { 
        if ( $display =~ m/Theme/ ) {
          if ( /widgetStyle=(.+)/  ) {
            print "\::$textcolor Wiget Style found as $1\n" unless $quite == 1;
            push(@line, " Wiget Style:$textcolor $1");
          }
          if (/colorScheme=(.+).kcsrc/ ) {
            print "\::$textcolor Color Scheme found as $1\n" unless $quite == 1;
            push(@line, " Color Scheme:$textcolor $1");
          }
        }
        if ( $display =~ m/Icons/ ) {
          if ( /Theme=(.+)/ ) {
            print "\::$textcolor Icons found as $1\n" unless $quite == 1;
            push(@line, " Icons:$textcolor $1");
          } 
        }   
        if ( $display =~ m/Font/ ) {
          if ( /font=(.+)/ ) {
            my $font = (split/,/, $1)[0];
            print "\::$textcolor Font found as $font\n" unless $quite == 1;
            push(@line, " Font:$textcolor $font");
          }
        }
      }
      close(FILE);
  
    }
    else {
      my @files = ("$ENV{HOME}/.gtkrc-2.0", "$ENV{HOME}/.gtkrc.mine",);
      foreach my $file (@files) {
        if ( -e $file ) {
          print "\::$textcolor Opening $file\n" unless $quite == 1; 
          open(FILE, $file)
          || die "\e[0;31m<Failed>\n";
          while( <FILE> ) {
            if ( $display =~ m/Theme/ ) {
              if( /include ".*themes\/(.+)\/gtk-(1|2)\.0\/gtkrc"/ ){
                print "\::$textcolor GTK theme found as $1\n" unless $quite == 1;
                push(@line, " GTK Theme:$textcolor $1");
              }
            }
            if ( $display =~ m/Icons/ ) {
              if( /.*gtk-icon-theme-name.*"(.+)"/ ) {
                print "\::$textcolor Icons found as $1\n" unless $quite == 1;
                push(@line, " Icons:$textcolor $1");
              }
            }
            if ( $display =~ m/Font/ ) {
              if( /.*gtk-font-name.*"(.+)"/ ) {
                print "\::$textcolor Font found as $1\n" unless $quite == 1;
                push(@line, " Font:$textcolor $1");
             }
            }
          }
          close(FILE);
        }
      }
    }
  }
}

## Display the system info ##

if ( $distro =~ m/Archlinux/ ) {

## Get Archlinux version ##
if ( $display =~ "OS"){
  print "\::$textcolor Finding Archlinux version\n" unless $quite == 1;
  my $version = $myArchVersion;
  $version =~ s/\s+/ /g;
  $version = " OS:$textcolor $version";
  unshift(@line, "$version");
}

my $c1 = "\e[1;36m";
my $c2 = "\e[0;36m";

system("clear");

print "
${c1}                   -`                   
${c1}                  .o+`                  
${c1}                 `ooo/                  
${c1}                `+oooo:                 
${c1}               `+oooooo:
${c1}               -+oooooo+:
${c1}             `/:-:++oooo+:                       $c1@line[0]
${c1}            `/++++/+++++++:                      $c1@line[1]
${c1}           `/++++++++++++++:                     $c1@line[2]
${c1}          `/+++${c2}ooooooooooooo/`                   $c1@line[3]
${c2}         ./ooosssso++osssssso+`                  $c1@line[4]
${c2}        .oossssso-````/ossssss+`                 $c1@line[5]
${c2}       -osssssso.      :ssssssso.                $c1@line[6]
${c2}      :osssssss/        osssso+++.               $c1@line[7]
${c2}     /ossssssss/        +ssssooo/-               $c1@line[8]
${c2}   `/ossssso+/:-        -:/+osssso+-    
${c2}  `+sso+:-`                 `.-/+oso:   
${c2} `++:.                           `-/+/  
${c2} .`                                  ``
${c2} 
\e[0m";
}

system("scrot -d 1");

Maybe I'll find the time to use xfconf to get all values at the moment they are taken from config files.


Have much fun,
Andrwe

Last edited by Andrwe (2009-07-23 06:27:41)

Offline

#209 2009-07-23 07:11:56

Andrwe
Member
From: Leipzig/Germany
Registered: 2009-06-17
Posts: 322
Website

Re: Screenshot info grabber - in development!

Hi,

and it's me again. big_smile

I've modified teh script again.
Now it collects all values using xfconf-query if the $DE is >=Xfce4.6 also the theme of xfwm4.

So here again:

#!/usr/bin/perl
use Switch;
use strict;
use File::Basename;

####################
## Config options ##
####################

## What distro logo to use to use, Available "Archlinux Debian Ubuntu None" ##
my $distro = "Archlinux";
my $myArchVersion = "ArchLinux (Core Dump)";

## what values to display. Use "OS Kernel DE WM win_theme Theme Font Icons" ##
my $display = "OS Kernel DE WM Win_theme Theme Icons Font Background";

## Takes a screen shot if set to 0 ##
my $shot = 0;
## Command to run to take screen shot ##
my $command = "scrot -d 10";

## What colors to use for the variables. ##
my $textcolor = "\e[0m";

## Prints little debugging messages if set to 0 ##
my $quite = 1;



########################
## Script starts here ##
########################
## Define some thing to work with strict ##
my @line = ();
my $found = 0;
my $DE = "NONE";
my $WM = "Beryl";

## Hash of WMs and the process they run ##
my %WMlist = ("Beryl", "beryl",
              "Fluxbox", "fluxbox",
              "Openbox", "openbox",
              "Blackbox", "blackbox",
              "Xfwm4", "xfwm4",
              "Metacity", "metacity",
              "Kwin", "kwin",
              "FVWM", "fvwm",
              "Enlightenment", "enlightenment",
              "IceWM", "icewm",
              "Window Maker", "wmaker",
              "PekWM","pekwm" );

## Hash of DEs and the process they run ##     
my %DElist = ("Gnome", "gnome-session",
              "Xfce4", "xfce-mcs-manage",
          "Xfce4.6", "xfconfd",
              "KDE", "ksmserver");

## Get Kernel version ##
if ( $display =~ "Kernel"){
  print "\::$textcolor Finding Kernel version\n" unless $quite == 1;
  my $kernel = `uname -r`;
  $kernel =~ s/\s+/ /g;
  $kernel = " Kernel:$textcolor $kernel";
  push(@line, "$kernel");
}

## Find running processes ##
print "\::$textcolor Getting processes \n" unless $quite == 1;
my $processes = `ps -A | awk {'print \$4'}`;

## Find DE ##
while( (my $DEname, my $DEprocess) = each(%DElist) ) {
  print "\::$textcolor Testing $DEname process: $DEprocess \n" unless $quite == 1;
  if ( $processes =~ m/$DEprocess/ ) {
    $DE = $DEname;
    print "\::$textcolor DE found as $DE\n" unless $quite == 1;
    if( $display =~ m/DE/ ) {
      push(@line, " DE:$textcolor $DE");
    }
    last;
  }
}

## Find WM ##
while( (my $WMname, my $WMprocess) = each(%WMlist) ) {
 print "\::$textcolor Testing $WMname process: $WMprocess \n" unless $quite == 1;
  if ( $processes =~ m/$WMprocess/ ) {
    $WM = $WMname;
    print "\::$textcolor WM found as $WM\n" unless $quite == 1;
    if( $display =~ m/WM/ ) {
      push(@line, " WM:$textcolor $WM");
    }
    last;
  }
}

## Find WM theme ##
if ( $display =~ m/Win_theme/ ){
  switch($WM) {
    case "Openbox" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.config/openbox/rc.xml")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) {
        if( /<name>(.+)<\/name>/ ) {
          while ( $found == 0 ) {
            print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
            push(@line, " WM Theme:$textcolor $1");
            $found = 1;
          }
        }
      }
      close(FILE);
    }
    case "Metacity" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      my $gconf = `gconftool-2 -g /apps/metacity/general/theme`;
      print "\::$textcolor $WM theme found as $gconf\n" unless $quite == 1;
      chomp ($gconf);
      push(@line, " WM Theme:$textcolor $gconf");
    }
    case "Fluxbox" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.fluxbox/init")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) {
        if( /session.styleFile:.*\/(.+)/ ) {
          print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
          push(@line, " WM Theme:$textcolor $1");
        }
      }
      close(FILE);
    }
    case "Blackbox" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.blackboxrc")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) {
        if( /session.styleFile:.*\/(.+)/ ) {
          print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
          push(@line, " WM Theme:$textcolor $1");
        }
      }
      close(FILE);
    }
    case "Xfwm4" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      switch($DE) {
    case "Xfce4" {
          open(FILE, "$ENV{HOME}/.config/xfce4/mcs_settings/xfwm4.xml")
          || die "\e[0;31m<Failed>\n";
            while( <FILE> ) {
            if( /<option name="Xfwm\/ThemeName" type="string" value="(.+)"\/>/ ) {
              print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
              push(@line, " WM Theme:$textcolor $1");
            }
          }
            close(FILE);
    }
    case "Xfce4.6" {
      my $xfconf = `xfconf-query -c xfwm4 -p /general/theme`;
      chomp($xfconf);
      push(@line, " WM Theme:$textcolor $xfconf");
    }
      }    
    }
    case "Kwin" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.kde/share/config/kwinrc")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) {
        if( /PluginLib=kwin3_(.+)/ ) {
          print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
          push(@line, " WM Theme:$textcolor $1");
        }
      }
      close(FILE);
    }
    case "Enlightenment" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      my $remote = `enlightenment_remote -theme-get theme` ;
      if( $remote =~ m/.*FILE="(.+).edj"/ ) {
        print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
        push(@line, " WM Theme:$textcolor $1");
      }     
    }       
    case "IceWM" { 
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.icewm/theme")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) {
        if( /Theme="(.+)\/.*.theme/ ) {
          while( $found == 0 ) {
            print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
            push(@line, " WM Theme:$textcolor $1");
            $found = 1;
          }
        }
      }   
      close(FILE);
    }   
    case "PekWM" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.pekwm/config")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) {
        if( /Theme.*\/(.*)"/ ) {
            print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
            push(@line, " WM Theme:$textcolor $1");
        }
      }
      close(FILE); 
    } 
  }   
}     
      
## Find Theme Icon and Font ##
if ( $display =~ m/[Theme, Icons, Font, Background]/) {
  switch($DE) {
    case "Gnome" {
      print "\::$textcolor Finding $DE variables\n" unless $quite == 1;
      if ( $display =~ m/Theme/ ) {
        my $gconf = `gconftool-2 -g /desktop/gnome/interface/gtk_theme`;
        chomp ($gconf);
        print "\::$textcolor GTK Theme found as $1\n" unless $quite == 1;
        push(@line, " GTK Theme:$textcolor $gconf");
      }
      if ( $display =~ m/Icons/ ) {
        my $gconf = `gconftool-2 -g /desktop/gnome/interface/icon_theme`;
        chomp ($gconf);
        push(@line, " Icons:$textcolor $gconf");
      } 
      if ( $display =~ m/Font/ ) {
        my $gconf = `gconftool-2 -g /desktop/gnome/interface/font_name`;
        chomp ($gconf);
        push(@line, " Font:$textcolor $gconf");
      }
      if ( $display =~ m/Background/ ) {
        my $gconf = `gconftool-2 -g /desktop/gnome/background/picture_filename`;
        chomp ($gconf);
        my $bname = basename($gconf);
        push(@line, " Background:$textcolor $bname");
      }

    } 
    case "Xfce4" {
      my @sort = ();
      print "\::$textcolor Finding $DE variables\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.config/xfce4/mcs_settings/gtk.xml")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) {
        if ( $display =~ m/Theme/ ) {
          if (/<option name="Net\/ThemeName" type="string" value="(.+)"\/>/ ) {
            print "\::$textcolor GTK Theme found as $1\n" unless $quite == 1;
            unshift(@sort, " GTK Theme:$textcolor $1");
          } 
        }
        if ( $display =~ m/Icons/ ) {
          if (/<option name="Net\/IconThemeName" type="string" value="(.+)"\/>/ ) {
            print "\::$textcolor Icons found as $1\n" unless $quite == 1;
            unshift(@sort, " Icons:$textcolor $1");
          }
        }
        if ( $display =~ m/Font/ ) {
          if ( /<option name="Gtk\/FontName" type="string" value="(.+)"\/>/ ) {
            print "\::$textcolor Font found as $1\n" unless $quite == 1;
            unshift(@sort, " Font:$textcolor $1");
          } 
        }
      }
      close(FILE);
      ## Sort variables so they're ordered "Theme Icon Font" ##
      foreach my $i (@sort) {
        push(@line, "$i");
      }
    } 
    case "Xfce4.6" {
      my @sort = ();
      print "\::$textcolor Finding $DE variables\n" unless $quite == 1;
        if ( $display =~ m/Theme/ ) {
        my $xfconf = `xfconf-query -c xsettings -p /Net/ThemeName`;
        chomp($xfconf);
            push(@line, " GTK Theme:$textcolor $xfconf");
        }
        if ( $display =~ m/Icons/ ) {
        my $xfconf = `xfconf-query -c xsettings -p /Net/IconThemeName`;
        chomp($xfconf);
            push(@line, " Icons:$textcolor $xfconf");
        }
        if ( $display =~ m/Font/ ) {
        my $xfconf = `xfconf-query -c xsettings -p /Gtk/FontName`;
        chomp($xfconf);
            push(@line, " Font:$textcolor $xfconf");
        }
      if ( $display =~ m/Background/ ) {
        my $xfconf = `xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path`;
        chomp($xfconf);
        my $bname = basename($xfconf);
            push(@line, " Background:$textcolor $bname");
      }
    } 
    case "KDE" { 
      print "\::$textcolor Finding $DE variables\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.kde/share/config/kdeglobals")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) { 
        if ( $display =~ m/Theme/ ) {
          if ( /widgetStyle=(.+)/  ) {
            print "\::$textcolor Wiget Style found as $1\n" unless $quite == 1;
            push(@line, " Wiget Style:$textcolor $1");
          }
          if (/colorScheme=(.+).kcsrc/ ) {
            print "\::$textcolor Color Scheme found as $1\n" unless $quite == 1;
            push(@line, " Color Scheme:$textcolor $1");
          }
        }
        if ( $display =~ m/Icons/ ) {
          if ( /Theme=(.+)/ ) {
            print "\::$textcolor Icons found as $1\n" unless $quite == 1;
            push(@line, " Icons:$textcolor $1");
          } 
        }   
        if ( $display =~ m/Font/ ) {
          if ( /font=(.+)/ ) {
            my $font = (split/,/, $1)[0];
            print "\::$textcolor Font found as $font\n" unless $quite == 1;
            push(@line, " Font:$textcolor $font");
          }
        }
      }
      close(FILE);
  
    }
    else {
      my @files = ("$ENV{HOME}/.gtkrc-2.0", "$ENV{HOME}/.gtkrc.mine",);
      foreach my $file (@files) {
        if ( -e $file ) {
          print "\::$textcolor Opening $file\n" unless $quite == 1; 
          open(FILE, $file)
          || die "\e[0;31m<Failed>\n";
          while( <FILE> ) {
            if ( $display =~ m/Theme/ ) {
              if( /include ".*themes\/(.+)\/gtk-(1|2)\.0\/gtkrc"/ ){
                print "\::$textcolor GTK theme found as $1\n" unless $quite == 1;
                push(@line, " GTK Theme:$textcolor $1");
              }
            }
            if ( $display =~ m/Icons/ ) {
              if( /.*gtk-icon-theme-name.*"(.+)"/ ) {
                print "\::$textcolor Icons found as $1\n" unless $quite == 1;
                push(@line, " Icons:$textcolor $1");
              }
            }
            if ( $display =~ m/Font/ ) {
              if( /.*gtk-font-name.*"(.+)"/ ) {
                print "\::$textcolor Font found as $1\n" unless $quite == 1;
                push(@line, " Font:$textcolor $1");
             }
            }
          }
          close(FILE);
        }
      }
    }
  }
}

## Display the system info ##

if ( $distro =~ m/Archlinux/ ) {

## Get Archlinux version ##
if ( $display =~ "OS"){
  print "\::$textcolor Finding Archlinux version\n" unless $quite == 1;
  my $version = $myArchVersion;
  $version =~ s/\s+/ /g;
  $version = " OS:$textcolor $version";
  unshift(@line, "$version");
}

my $c1 = "\e[1;36m";
my $c2 = "\e[0;36m";

system("clear");

print "
${c1}                   -`                   
${c1}                  .o+`                  
${c1}                 `ooo/                  
${c1}                `+oooo:                 
${c1}               `+oooooo:
${c1}               -+oooooo+:
${c1}             `/:-:++oooo+:                       $c1@line[0]
${c1}            `/++++/+++++++:                      $c1@line[1]
${c1}           `/++++++++++++++:                     $c1@line[2]
${c1}          `/+++${c2}ooooooooooooo/`                   $c1@line[3]
${c2}         ./ooosssso++osssssso+`                  $c1@line[4]
${c2}        .oossssso-````/ossssss+`                 $c1@line[5]
${c2}       -osssssso.      :ssssssso.                $c1@line[6]
${c2}      :osssssss/        osssso+++.               $c1@line[7]
${c2}     /ossssssss/        +ssssooo/-               $c1@line[8]
${c2}   `/ossssso+/:-        -:/+osssso+-    
${c2}  `+sso+:-`                 `.-/+oso:   
${c2} `++:.                           `-/+/  
${c2} .`                                  ``
${c2} 
\e[0m";
}

system("scrot -d 1");

Have much fun,
Andrwe

Offline

#210 2009-07-23 15:20:01

seiichiro0185
Member
From: Leipzig/Germany
Registered: 2009-04-09
Posts: 226
Website

Re: Screenshot info grabber - in development!

just tested it on xfce 4.6, works like a charm!


My System: Dell XPS 13 | i7-7560U | 16GB RAM | 512GB SSD | FHD Screen | Arch Linux
My Workstation/Server: Supermicro X11SSZ-F | Xeon E3-1245 v6 | 64GB RAM | 1TB SSD Raid 1 + 6TB HDD ZFS Raid Z1 | Proxmox VE
My Stuff at Github: github
My Homepage: Seiichiros HP

Offline

#211 2009-07-23 15:43:01

Boris Bolgradov
Member
From: Bulgaria
Registered: 2008-07-27
Posts: 185

Re: Screenshot info grabber - in development!

Seems to work fine on fluxbox

Offline

#212 2009-08-01 20:52:28

cryticfarm
Member
Registered: 2009-07-27
Posts: 47

Re: Screenshot info grabber - in development!

How do I use this script?

Offline

#213 2009-08-01 21:42:37

steevols
Member
From: US - SC
Registered: 2009-05-27
Posts: 26
Website

Re: Screenshot info grabber - in development!

It's a perl script; copy all the code from one of the numerous versions in this thread in to a file (say, info.perl) and then run it in a prompt with "perl info.perl" and it should output to your terminal.

Offline

#214 2009-08-12 19:23:00

tlhl28
Member
From: Shenzhen, Guangdong, China
Registered: 2008-12-29
Posts: 13
Website

Re: Screenshot info grabber - in development!

camphor wrote:
karabaja4 wrote:

I made a new Arch ascii logo (tbh I didn't made it myself, used an ascii art tool).

Full script: http://karabaja.pondi.hr/scripts/info.pl
(I edited the scripts from DARKGuy's links, thanks wink)

I hope you like it big_smile

Thanks!

thanks too. I like it!


Simple Core

Offline

#215 2009-08-19 15:50:07

Cbeck527
Member
From: USA
Registered: 2009-05-25
Posts: 7
Website

Re: Screenshot info grabber - in development!

EDIT: I'm a mess, posted in the wrong thread. smile

Last edited by Cbeck527 (2009-08-19 18:31:20)


Dell Vostro A90 | 2GB RAM | 16GB Runcore SSD

Offline

#216 2009-08-19 16:12:01

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: Screenshot info grabber - in development!

not only have you got your clean and dirty backwards, but i think you might be in the wrong thread. big_smile

Offline

#217 2009-09-01 12:09:53

rab
Member
Registered: 2006-06-15
Posts: 185

Re: Screenshot info grabber - in development!

This script is still alive? Hrm.. I thought somebody would have made a better version by now.


rawr

Offline

#218 2009-10-10 11:59:10

virusso80
Member
From: Italy
Registered: 2007-03-09
Posts: 325

Re: Screenshot info grabber - in development!

Berseker wrote:

hi guys.. today i've discovered this great script, but i was wondering why my colors are messed up.. look by yourself

http://img504.imageshack.us/img504/4923 … va9.th.jpg

Hi How did you create that kmenu? i tried but it's resized to the small (standard) size! I'm using kdemod 4.3, but i guess would be the same in the vannilla kde.

Thanks  in advance

Offline

#219 2009-10-13 02:39:40

drsjlazar
Member
From: Kasama
Registered: 2009-10-01
Posts: 133
Website

Re: Screenshot info grabber - in development!

Don't know if it's been said before but if you are using KDEmod, it will not work. Linking ~/.kde to ~/.kdemod4 fixes it.

Offline

#220 2009-10-15 02:59:12

melik
Member
Registered: 2009-10-11
Posts: 108

Re: Screenshot info grabber - in development!

I wrote a small bit for a battery for laptops (You need acpi), here it is:

Type 1 (Displays percentage left):

if ( $display =~ "battery"){
   my $battery = `acpi | cut -d , -f2`;
   $battery =~/\s+/ /g;
   $battery = " Battery:$textcolor $battery";
   push(@line, "$battery";
}

Type 2 (Displays time left):

if ( $display =~ "battery"){
   my $battery = `acpi | cut -d , -f3`;
   $battery =~/\s+/ /g;
   $battery = " Battery:$textcolor $battery";
   push(@line, "$battery";
}

_____

Just add that bit anywhere and also don't forget to add 'battery' to the following line

my $display = "OS Kernel DE WM Win_theme Theme Icons Font Background battery";

Example of both outputs: http://omploader.org/vMmpwcQ

Last edited by melik (2009-10-15 03:05:57)

Offline

#221 2009-10-17 23:49:04

Kooothor
Member
From: Paname
Registered: 2008-08-02
Posts: 226

Re: Screenshot info grabber - in development!

Andrwe wrote:

Hi,

and it's me again. big_smile

I've modified teh script again.
Now it collects all values using xfconf-query if the $DE is >=Xfce4.6 also the theme of xfwm4.

So here again:

#!/usr/bin/perl
use Switch;
use strict;
use File::Basename;

####################
## Config options ##
####################

## What distro logo to use to use, Available "Archlinux Debian Ubuntu None" ##
my $distro = "Archlinux";
my $myArchVersion = "ArchLinux (Core Dump)";

## what values to display. Use "OS Kernel DE WM win_theme Theme Font Icons" ##
my $display = "OS Kernel DE WM Win_theme Theme Icons Font Background";

## Takes a screen shot if set to 0 ##
my $shot = 0;
## Command to run to take screen shot ##
my $command = "scrot -d 10";

## What colors to use for the variables. ##
my $textcolor = "\e[0m";

## Prints little debugging messages if set to 0 ##
my $quite = 1;



########################
## Script starts here ##
########################
## Define some thing to work with strict ##
my @line = ();
my $found = 0;
my $DE = "NONE";
my $WM = "Beryl";

## Hash of WMs and the process they run ##
my %WMlist = ("Beryl", "beryl",
              "Fluxbox", "fluxbox",
              "Openbox", "openbox",
              "Blackbox", "blackbox",
              "Xfwm4", "xfwm4",
              "Metacity", "metacity",
              "Kwin", "kwin",
              "FVWM", "fvwm",
              "Enlightenment", "enlightenment",
              "IceWM", "icewm",
              "Window Maker", "wmaker",
              "PekWM","pekwm" );

## Hash of DEs and the process they run ##     
my %DElist = ("Gnome", "gnome-session",
              "Xfce4", "xfce-mcs-manage",
          "Xfce4.6", "xfconfd",
              "KDE", "ksmserver");

## Get Kernel version ##
if ( $display =~ "Kernel"){
  print "\::$textcolor Finding Kernel version\n" unless $quite == 1;
  my $kernel = `uname -r`;
  $kernel =~ s/\s+/ /g;
  $kernel = " Kernel:$textcolor $kernel";
  push(@line, "$kernel");
}

## Find running processes ##
print "\::$textcolor Getting processes \n" unless $quite == 1;
my $processes = `ps -A | awk {'print \$4'}`;

## Find DE ##
while( (my $DEname, my $DEprocess) = each(%DElist) ) {
  print "\::$textcolor Testing $DEname process: $DEprocess \n" unless $quite == 1;
  if ( $processes =~ m/$DEprocess/ ) {
    $DE = $DEname;
    print "\::$textcolor DE found as $DE\n" unless $quite == 1;
    if( $display =~ m/DE/ ) {
      push(@line, " DE:$textcolor $DE");
    }
    last;
  }
}

## Find WM ##
while( (my $WMname, my $WMprocess) = each(%WMlist) ) {
 print "\::$textcolor Testing $WMname process: $WMprocess \n" unless $quite == 1;
  if ( $processes =~ m/$WMprocess/ ) {
    $WM = $WMname;
    print "\::$textcolor WM found as $WM\n" unless $quite == 1;
    if( $display =~ m/WM/ ) {
      push(@line, " WM:$textcolor $WM");
    }
    last;
  }
}

## Find WM theme ##
if ( $display =~ m/Win_theme/ ){
  switch($WM) {
    case "Openbox" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.config/openbox/rc.xml")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) {
        if( /<name>(.+)<\/name>/ ) {
          while ( $found == 0 ) {
            print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
            push(@line, " WM Theme:$textcolor $1");
            $found = 1;
          }
        }
      }
      close(FILE);
    }
    case "Metacity" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      my $gconf = `gconftool-2 -g /apps/metacity/general/theme`;
      print "\::$textcolor $WM theme found as $gconf\n" unless $quite == 1;
      chomp ($gconf);
      push(@line, " WM Theme:$textcolor $gconf");
    }
    case "Fluxbox" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.fluxbox/init")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) {
        if( /session.styleFile:.*\/(.+)/ ) {
          print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
          push(@line, " WM Theme:$textcolor $1");
        }
      }
      close(FILE);
    }
    case "Blackbox" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.blackboxrc")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) {
        if( /session.styleFile:.*\/(.+)/ ) {
          print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
          push(@line, " WM Theme:$textcolor $1");
        }
      }
      close(FILE);
    }
    case "Xfwm4" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      switch($DE) {
    case "Xfce4" {
          open(FILE, "$ENV{HOME}/.config/xfce4/mcs_settings/xfwm4.xml")
          || die "\e[0;31m<Failed>\n";
            while( <FILE> ) {
            if( /<option name="Xfwm\/ThemeName" type="string" value="(.+)"\/>/ ) {
              print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
              push(@line, " WM Theme:$textcolor $1");
            }
          }
            close(FILE);
    }
    case "Xfce4.6" {
      my $xfconf = `xfconf-query -c xfwm4 -p /general/theme`;
      chomp($xfconf);
      push(@line, " WM Theme:$textcolor $xfconf");
    }
      }    
    }
    case "Kwin" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.kde/share/config/kwinrc")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) {
        if( /PluginLib=kwin3_(.+)/ ) {
          print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
          push(@line, " WM Theme:$textcolor $1");
        }
      }
      close(FILE);
    }
    case "Enlightenment" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      my $remote = `enlightenment_remote -theme-get theme` ;
      if( $remote =~ m/.*FILE="(.+).edj"/ ) {
        print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
        push(@line, " WM Theme:$textcolor $1");
      }     
    }       
    case "IceWM" { 
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.icewm/theme")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) {
        if( /Theme="(.+)\/.*.theme/ ) {
          while( $found == 0 ) {
            print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
            push(@line, " WM Theme:$textcolor $1");
            $found = 1;
          }
        }
      }   
      close(FILE);
    }   
    case "PekWM" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.pekwm/config")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) {
        if( /Theme.*\/(.*)"/ ) {
            print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
            push(@line, " WM Theme:$textcolor $1");
        }
      }
      close(FILE); 
    } 
  }   
}     
      
## Find Theme Icon and Font ##
if ( $display =~ m/[Theme, Icons, Font, Background]/) {
  switch($DE) {
    case "Gnome" {
      print "\::$textcolor Finding $DE variables\n" unless $quite == 1;
      if ( $display =~ m/Theme/ ) {
        my $gconf = `gconftool-2 -g /desktop/gnome/interface/gtk_theme`;
        chomp ($gconf);
        print "\::$textcolor GTK Theme found as $1\n" unless $quite == 1;
        push(@line, " GTK Theme:$textcolor $gconf");
      }
      if ( $display =~ m/Icons/ ) {
        my $gconf = `gconftool-2 -g /desktop/gnome/interface/icon_theme`;
        chomp ($gconf);
        push(@line, " Icons:$textcolor $gconf");
      } 
      if ( $display =~ m/Font/ ) {
        my $gconf = `gconftool-2 -g /desktop/gnome/interface/font_name`;
        chomp ($gconf);
        push(@line, " Font:$textcolor $gconf");
      }
      if ( $display =~ m/Background/ ) {
        my $gconf = `gconftool-2 -g /desktop/gnome/background/picture_filename`;
        chomp ($gconf);
        my $bname = basename($gconf);
        push(@line, " Background:$textcolor $bname");
      }

    } 
    case "Xfce4" {
      my @sort = ();
      print "\::$textcolor Finding $DE variables\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.config/xfce4/mcs_settings/gtk.xml")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) {
        if ( $display =~ m/Theme/ ) {
          if (/<option name="Net\/ThemeName" type="string" value="(.+)"\/>/ ) {
            print "\::$textcolor GTK Theme found as $1\n" unless $quite == 1;
            unshift(@sort, " GTK Theme:$textcolor $1");
          } 
        }
        if ( $display =~ m/Icons/ ) {
          if (/<option name="Net\/IconThemeName" type="string" value="(.+)"\/>/ ) {
            print "\::$textcolor Icons found as $1\n" unless $quite == 1;
            unshift(@sort, " Icons:$textcolor $1");
          }
        }
        if ( $display =~ m/Font/ ) {
          if ( /<option name="Gtk\/FontName" type="string" value="(.+)"\/>/ ) {
            print "\::$textcolor Font found as $1\n" unless $quite == 1;
            unshift(@sort, " Font:$textcolor $1");
          } 
        }
      }
      close(FILE);
      ## Sort variables so they're ordered "Theme Icon Font" ##
      foreach my $i (@sort) {
        push(@line, "$i");
      }
    } 
    case "Xfce4.6" {
      my @sort = ();
      print "\::$textcolor Finding $DE variables\n" unless $quite == 1;
        if ( $display =~ m/Theme/ ) {
        my $xfconf = `xfconf-query -c xsettings -p /Net/ThemeName`;
        chomp($xfconf);
            push(@line, " GTK Theme:$textcolor $xfconf");
        }
        if ( $display =~ m/Icons/ ) {
        my $xfconf = `xfconf-query -c xsettings -p /Net/IconThemeName`;
        chomp($xfconf);
            push(@line, " Icons:$textcolor $xfconf");
        }
        if ( $display =~ m/Font/ ) {
        my $xfconf = `xfconf-query -c xsettings -p /Gtk/FontName`;
        chomp($xfconf);
            push(@line, " Font:$textcolor $xfconf");
        }
      if ( $display =~ m/Background/ ) {
        my $xfconf = `xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path`;
        chomp($xfconf);
        my $bname = basename($xfconf);
            push(@line, " Background:$textcolor $bname");
      }
    } 
    case "KDE" { 
      print "\::$textcolor Finding $DE variables\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.kde/share/config/kdeglobals")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) { 
        if ( $display =~ m/Theme/ ) {
          if ( /widgetStyle=(.+)/  ) {
            print "\::$textcolor Wiget Style found as $1\n" unless $quite == 1;
            push(@line, " Wiget Style:$textcolor $1");
          }
          if (/colorScheme=(.+).kcsrc/ ) {
            print "\::$textcolor Color Scheme found as $1\n" unless $quite == 1;
            push(@line, " Color Scheme:$textcolor $1");
          }
        }
        if ( $display =~ m/Icons/ ) {
          if ( /Theme=(.+)/ ) {
            print "\::$textcolor Icons found as $1\n" unless $quite == 1;
            push(@line, " Icons:$textcolor $1");
          } 
        }   
        if ( $display =~ m/Font/ ) {
          if ( /font=(.+)/ ) {
            my $font = (split/,/, $1)[0];
            print "\::$textcolor Font found as $font\n" unless $quite == 1;
            push(@line, " Font:$textcolor $font");
          }
        }
      }
      close(FILE);
  
    }
    else {
      my @files = ("$ENV{HOME}/.gtkrc-2.0", "$ENV{HOME}/.gtkrc.mine",);
      foreach my $file (@files) {
        if ( -e $file ) {
          print "\::$textcolor Opening $file\n" unless $quite == 1; 
          open(FILE, $file)
          || die "\e[0;31m<Failed>\n";
          while( <FILE> ) {
            if ( $display =~ m/Theme/ ) {
              if( /include ".*themes\/(.+)\/gtk-(1|2)\.0\/gtkrc"/ ){
                print "\::$textcolor GTK theme found as $1\n" unless $quite == 1;
                push(@line, " GTK Theme:$textcolor $1");
              }
            }
            if ( $display =~ m/Icons/ ) {
              if( /.*gtk-icon-theme-name.*"(.+)"/ ) {
                print "\::$textcolor Icons found as $1\n" unless $quite == 1;
                push(@line, " Icons:$textcolor $1");
              }
            }
            if ( $display =~ m/Font/ ) {
              if( /.*gtk-font-name.*"(.+)"/ ) {
                print "\::$textcolor Font found as $1\n" unless $quite == 1;
                push(@line, " Font:$textcolor $1");
             }
            }
          }
          close(FILE);
        }
      }
    }
  }
}

## Display the system info ##

if ( $distro =~ m/Archlinux/ ) {

## Get Archlinux version ##
if ( $display =~ "OS"){
  print "\::$textcolor Finding Archlinux version\n" unless $quite == 1;
  my $version = $myArchVersion;
  $version =~ s/\s+/ /g;
  $version = " OS:$textcolor $version";
  unshift(@line, "$version");
}

my $c1 = "\e[1;36m";
my $c2 = "\e[0;36m";

system("clear");

print "
${c1}                   -`                   
${c1}                  .o+`                  
${c1}                 `ooo/                  
${c1}                `+oooo:                 
${c1}               `+oooooo:
${c1}               -+oooooo+:
${c1}             `/:-:++oooo+:                       $c1@line[0]
${c1}            `/++++/+++++++:                      $c1@line[1]
${c1}           `/++++++++++++++:                     $c1@line[2]
${c1}          `/+++${c2}ooooooooooooo/`                   $c1@line[3]
${c2}         ./ooosssso++osssssso+`                  $c1@line[4]
${c2}        .oossssso-````/ossssss+`                 $c1@line[5]
${c2}       -osssssso.      :ssssssso.                $c1@line[6]
${c2}      :osssssss/        osssso+++.               $c1@line[7]
${c2}     /ossssssss/        +ssssooo/-               $c1@line[8]
${c2}   `/ossssso+/:-        -:/+osssso+-    
${c2}  `+sso+:-`                 `.-/+oso:   
${c2} `++:.                           `-/+/  
${c2} .`                                  ``
${c2} 
\e[0m";
}

system("scrot -d 1");

Have much fun,
Andrwe

THX

But Awesome is missing smile


ktr

Offline

#222 2009-10-19 02:39:51

melik
Member
Registered: 2009-10-11
Posts: 108

Re: Screenshot info grabber - in development!

Kooothor wrote:
Andrwe wrote:

Hi,

and it's me again. big_smile

I've modified teh script again.
Now it collects all values using xfconf-query if the $DE is >=Xfce4.6 also the theme of xfwm4.

So here again:

#!/usr/bin/perl
use Switch;
use strict;
use File::Basename;

####################
## Config options ##
####################

## What distro logo to use to use, Available "Archlinux Debian Ubuntu None" ##
my $distro = "Archlinux";
my $myArchVersion = "ArchLinux (Core Dump)";

## what values to display. Use "OS Kernel DE WM win_theme Theme Font Icons" ##
my $display = "OS Kernel DE WM Win_theme Theme Icons Font Background";

## Takes a screen shot if set to 0 ##
my $shot = 0;
## Command to run to take screen shot ##
my $command = "scrot -d 10";

## What colors to use for the variables. ##
my $textcolor = "\e[0m";

## Prints little debugging messages if set to 0 ##
my $quite = 1;



########################
## Script starts here ##
########################
## Define some thing to work with strict ##
my @line = ();
my $found = 0;
my $DE = "NONE";
my $WM = "Beryl";

## Hash of WMs and the process they run ##
my %WMlist = ("Beryl", "beryl",
              "Fluxbox", "fluxbox",
              "Openbox", "openbox",
              "Blackbox", "blackbox",
              "Xfwm4", "xfwm4",
              "Metacity", "metacity",
              "Kwin", "kwin",
              "FVWM", "fvwm",
              "Enlightenment", "enlightenment",
              "IceWM", "icewm",
              "Window Maker", "wmaker",
              "PekWM","pekwm" );

## Hash of DEs and the process they run ##     
my %DElist = ("Gnome", "gnome-session",
              "Xfce4", "xfce-mcs-manage",
          "Xfce4.6", "xfconfd",
              "KDE", "ksmserver");

## Get Kernel version ##
if ( $display =~ "Kernel"){
  print "\::$textcolor Finding Kernel version\n" unless $quite == 1;
  my $kernel = `uname -r`;
  $kernel =~ s/\s+/ /g;
  $kernel = " Kernel:$textcolor $kernel";
  push(@line, "$kernel");
}

## Find running processes ##
print "\::$textcolor Getting processes \n" unless $quite == 1;
my $processes = `ps -A | awk {'print \$4'}`;

## Find DE ##
while( (my $DEname, my $DEprocess) = each(%DElist) ) {
  print "\::$textcolor Testing $DEname process: $DEprocess \n" unless $quite == 1;
  if ( $processes =~ m/$DEprocess/ ) {
    $DE = $DEname;
    print "\::$textcolor DE found as $DE\n" unless $quite == 1;
    if( $display =~ m/DE/ ) {
      push(@line, " DE:$textcolor $DE");
    }
    last;
  }
}

## Find WM ##
while( (my $WMname, my $WMprocess) = each(%WMlist) ) {
 print "\::$textcolor Testing $WMname process: $WMprocess \n" unless $quite == 1;
  if ( $processes =~ m/$WMprocess/ ) {
    $WM = $WMname;
    print "\::$textcolor WM found as $WM\n" unless $quite == 1;
    if( $display =~ m/WM/ ) {
      push(@line, " WM:$textcolor $WM");
    }
    last;
  }
}

## Find WM theme ##
if ( $display =~ m/Win_theme/ ){
  switch($WM) {
    case "Openbox" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.config/openbox/rc.xml")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) {
        if( /<name>(.+)<\/name>/ ) {
          while ( $found == 0 ) {
            print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
            push(@line, " WM Theme:$textcolor $1");
            $found = 1;
          }
        }
      }
      close(FILE);
    }
    case "Metacity" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      my $gconf = `gconftool-2 -g /apps/metacity/general/theme`;
      print "\::$textcolor $WM theme found as $gconf\n" unless $quite == 1;
      chomp ($gconf);
      push(@line, " WM Theme:$textcolor $gconf");
    }
    case "Fluxbox" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.fluxbox/init")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) {
        if( /session.styleFile:.*\/(.+)/ ) {
          print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
          push(@line, " WM Theme:$textcolor $1");
        }
      }
      close(FILE);
    }
    case "Blackbox" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.blackboxrc")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) {
        if( /session.styleFile:.*\/(.+)/ ) {
          print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
          push(@line, " WM Theme:$textcolor $1");
        }
      }
      close(FILE);
    }
    case "Xfwm4" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      switch($DE) {
    case "Xfce4" {
          open(FILE, "$ENV{HOME}/.config/xfce4/mcs_settings/xfwm4.xml")
          || die "\e[0;31m<Failed>\n";
            while( <FILE> ) {
            if( /<option name="Xfwm\/ThemeName" type="string" value="(.+)"\/>/ ) {
              print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
              push(@line, " WM Theme:$textcolor $1");
            }
          }
            close(FILE);
    }
    case "Xfce4.6" {
      my $xfconf = `xfconf-query -c xfwm4 -p /general/theme`;
      chomp($xfconf);
      push(@line, " WM Theme:$textcolor $xfconf");
    }
      }    
    }
    case "Kwin" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.kde/share/config/kwinrc")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) {
        if( /PluginLib=kwin3_(.+)/ ) {
          print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
          push(@line, " WM Theme:$textcolor $1");
        }
      }
      close(FILE);
    }
    case "Enlightenment" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      my $remote = `enlightenment_remote -theme-get theme` ;
      if( $remote =~ m/.*FILE="(.+).edj"/ ) {
        print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
        push(@line, " WM Theme:$textcolor $1");
      }     
    }       
    case "IceWM" { 
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.icewm/theme")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) {
        if( /Theme="(.+)\/.*.theme/ ) {
          while( $found == 0 ) {
            print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
            push(@line, " WM Theme:$textcolor $1");
            $found = 1;
          }
        }
      }   
      close(FILE);
    }   
    case "PekWM" {
      print "\::$textcolor Finding $WM theme\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.pekwm/config")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) {
        if( /Theme.*\/(.*)"/ ) {
            print "\::$textcolor $WM theme found as $1\n" unless $quite == 1;
            push(@line, " WM Theme:$textcolor $1");
        }
      }
      close(FILE); 
    } 
  }   
}     
      
## Find Theme Icon and Font ##
if ( $display =~ m/[Theme, Icons, Font, Background]/) {
  switch($DE) {
    case "Gnome" {
      print "\::$textcolor Finding $DE variables\n" unless $quite == 1;
      if ( $display =~ m/Theme/ ) {
        my $gconf = `gconftool-2 -g /desktop/gnome/interface/gtk_theme`;
        chomp ($gconf);
        print "\::$textcolor GTK Theme found as $1\n" unless $quite == 1;
        push(@line, " GTK Theme:$textcolor $gconf");
      }
      if ( $display =~ m/Icons/ ) {
        my $gconf = `gconftool-2 -g /desktop/gnome/interface/icon_theme`;
        chomp ($gconf);
        push(@line, " Icons:$textcolor $gconf");
      } 
      if ( $display =~ m/Font/ ) {
        my $gconf = `gconftool-2 -g /desktop/gnome/interface/font_name`;
        chomp ($gconf);
        push(@line, " Font:$textcolor $gconf");
      }
      if ( $display =~ m/Background/ ) {
        my $gconf = `gconftool-2 -g /desktop/gnome/background/picture_filename`;
        chomp ($gconf);
        my $bname = basename($gconf);
        push(@line, " Background:$textcolor $bname");
      }

    } 
    case "Xfce4" {
      my @sort = ();
      print "\::$textcolor Finding $DE variables\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.config/xfce4/mcs_settings/gtk.xml")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) {
        if ( $display =~ m/Theme/ ) {
          if (/<option name="Net\/ThemeName" type="string" value="(.+)"\/>/ ) {
            print "\::$textcolor GTK Theme found as $1\n" unless $quite == 1;
            unshift(@sort, " GTK Theme:$textcolor $1");
          } 
        }
        if ( $display =~ m/Icons/ ) {
          if (/<option name="Net\/IconThemeName" type="string" value="(.+)"\/>/ ) {
            print "\::$textcolor Icons found as $1\n" unless $quite == 1;
            unshift(@sort, " Icons:$textcolor $1");
          }
        }
        if ( $display =~ m/Font/ ) {
          if ( /<option name="Gtk\/FontName" type="string" value="(.+)"\/>/ ) {
            print "\::$textcolor Font found as $1\n" unless $quite == 1;
            unshift(@sort, " Font:$textcolor $1");
          } 
        }
      }
      close(FILE);
      ## Sort variables so they're ordered "Theme Icon Font" ##
      foreach my $i (@sort) {
        push(@line, "$i");
      }
    } 
    case "Xfce4.6" {
      my @sort = ();
      print "\::$textcolor Finding $DE variables\n" unless $quite == 1;
        if ( $display =~ m/Theme/ ) {
        my $xfconf = `xfconf-query -c xsettings -p /Net/ThemeName`;
        chomp($xfconf);
            push(@line, " GTK Theme:$textcolor $xfconf");
        }
        if ( $display =~ m/Icons/ ) {
        my $xfconf = `xfconf-query -c xsettings -p /Net/IconThemeName`;
        chomp($xfconf);
            push(@line, " Icons:$textcolor $xfconf");
        }
        if ( $display =~ m/Font/ ) {
        my $xfconf = `xfconf-query -c xsettings -p /Gtk/FontName`;
        chomp($xfconf);
            push(@line, " Font:$textcolor $xfconf");
        }
      if ( $display =~ m/Background/ ) {
        my $xfconf = `xfconf-query -c xfce4-desktop -p /backdrop/screen0/monitor0/image-path`;
        chomp($xfconf);
        my $bname = basename($xfconf);
            push(@line, " Background:$textcolor $bname");
      }
    } 
    case "KDE" { 
      print "\::$textcolor Finding $DE variables\n" unless $quite == 1;
      open(FILE, "$ENV{HOME}/.kde/share/config/kdeglobals")
      || die "\e[0;31m<Failed>\n";
      while( <FILE> ) { 
        if ( $display =~ m/Theme/ ) {
          if ( /widgetStyle=(.+)/  ) {
            print "\::$textcolor Wiget Style found as $1\n" unless $quite == 1;
            push(@line, " Wiget Style:$textcolor $1");
          }
          if (/colorScheme=(.+).kcsrc/ ) {
            print "\::$textcolor Color Scheme found as $1\n" unless $quite == 1;
            push(@line, " Color Scheme:$textcolor $1");
          }
        }
        if ( $display =~ m/Icons/ ) {
          if ( /Theme=(.+)/ ) {
            print "\::$textcolor Icons found as $1\n" unless $quite == 1;
            push(@line, " Icons:$textcolor $1");
          } 
        }   
        if ( $display =~ m/Font/ ) {
          if ( /font=(.+)/ ) {
            my $font = (split/,/, $1)[0];
            print "\::$textcolor Font found as $font\n" unless $quite == 1;
            push(@line, " Font:$textcolor $font");
          }
        }
      }
      close(FILE);
  
    }
    else {
      my @files = ("$ENV{HOME}/.gtkrc-2.0", "$ENV{HOME}/.gtkrc.mine",);
      foreach my $file (@files) {
        if ( -e $file ) {
          print "\::$textcolor Opening $file\n" unless $quite == 1; 
          open(FILE, $file)
          || die "\e[0;31m<Failed>\n";
          while( <FILE> ) {
            if ( $display =~ m/Theme/ ) {
              if( /include ".*themes\/(.+)\/gtk-(1|2)\.0\/gtkrc"/ ){
                print "\::$textcolor GTK theme found as $1\n" unless $quite == 1;
                push(@line, " GTK Theme:$textcolor $1");
              }
            }
            if ( $display =~ m/Icons/ ) {
              if( /.*gtk-icon-theme-name.*"(.+)"/ ) {
                print "\::$textcolor Icons found as $1\n" unless $quite == 1;
                push(@line, " Icons:$textcolor $1");
              }
            }
            if ( $display =~ m/Font/ ) {
              if( /.*gtk-font-name.*"(.+)"/ ) {
                print "\::$textcolor Font found as $1\n" unless $quite == 1;
                push(@line, " Font:$textcolor $1");
             }
            }
          }
          close(FILE);
        }
      }
    }
  }
}

## Display the system info ##

if ( $distro =~ m/Archlinux/ ) {

## Get Archlinux version ##
if ( $display =~ "OS"){
  print "\::$textcolor Finding Archlinux version\n" unless $quite == 1;
  my $version = $myArchVersion;
  $version =~ s/\s+/ /g;
  $version = " OS:$textcolor $version";
  unshift(@line, "$version");
}

my $c1 = "\e[1;36m";
my $c2 = "\e[0;36m";

system("clear");

print "
${c1}                   -`                   
${c1}                  .o+`                  
${c1}                 `ooo/                  
${c1}                `+oooo:                 
${c1}               `+oooooo:
${c1}               -+oooooo+:
${c1}             `/:-:++oooo+:                       $c1@line[0]
${c1}            `/++++/+++++++:                      $c1@line[1]
${c1}           `/++++++++++++++:                     $c1@line[2]
${c1}          `/+++${c2}ooooooooooooo/`                   $c1@line[3]
${c2}         ./ooosssso++osssssso+`                  $c1@line[4]
${c2}        .oossssso-````/ossssss+`                 $c1@line[5]
${c2}       -osssssso.      :ssssssso.                $c1@line[6]
${c2}      :osssssss/        osssso+++.               $c1@line[7]
${c2}     /ossssssss/        +ssssooo/-               $c1@line[8]
${c2}   `/ossssso+/:-        -:/+osssso+-    
${c2}  `+sso+:-`                 `.-/+oso:   
${c2} `++:.                           `-/+/  
${c2} .`                                  ``
${c2} 
\e[0m";
}

system("scrot -d 1");

Have much fun,
Andrwe

THX

But Awesome is missing smile

## Hash of WMs and the process they run ##
my %WMlist = ("Beryl", "beryl",
              "Awesome", "awesome",
              "Fluxbox", "fluxbox",
              "Openbox", "openbox",
              "Blackbox", "blackbox",
              "Xfwm4", "xfwm4",
              "Metacity", "metacity",
              "Kwin", "kwin",
              "FVWM", "fvwm",
              "Enlightenment", "enlightenment",
              "IceWM", "icewm",
              "Window Maker", "wmaker",
              "PekWM","pekwm" );

Offline

#223 2009-10-19 02:43:36

Reasons
Member
From: Washington
Registered: 2007-11-04
Posts: 572

Re: Screenshot info grabber - in development!

Wrong thread.

Last edited by Reasons (2009-10-19 02:59:15)

Offline

#224 2009-10-19 02:48:38

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: Screenshot info grabber - in development!

Reasons wrote:

Click for big.

Um, I think you are looking for this thread: http://bbs.archlinux.org/viewtopic.php?id=81283


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#225 2009-10-19 02:59:07

Reasons
Member
From: Washington
Registered: 2007-11-04
Posts: 572

Re: Screenshot info grabber - in development!

jasonwryan wrote:
Reasons wrote:

Click for big.

Um, I think you are looking for this thread: http://bbs.archlinux.org/viewtopic.php?id=81283

I am, always just clicked the first sticky without reading. It got me this time, lol.

Offline

Board footer

Powered by FluxBB