You are not logged in.
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
Hi,
and it's me again.
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
Offline
Andrwe wrote:Hi,
and it's me again.
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,
AndrweTHX
But Awesome is missing
## 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
Wrong thread.
Last edited by Reasons (2009-10-19 02:59:15)
Offline
Click for big.
Um, I think you are looking for this thread: http://bbs.archlinux.org/viewtopic.php?id=81283
Offline
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
why can I not get this script to work?
http://pastie.org/685061
Offline
Great project!
I just want to say one thing: in order to avoid scrot taking screenshot every time you run the script, editing the configuration part of the script (change a value from 0 to 1), simply does not work for me.
Anyways, I've just commented out the very last row of the script to avoid screeenshoting and this works.
Can you confirm this "bug"?
Another thing: it would be useful and much appreciated to have a simple table with all the colour codes available: this way one can easily change colours in the output and edit them in order to best fit his desktop colors!
Thank you!
rent0n@deviantART | rent0n@bitbucket | rent0n@identi.ca | LRU #337812
aspire: Acer Aspire 5920 Arch Linux x86_64 | beetle: Gericom Beetle G733 Arch Linux i686
Offline
if ( $display =~ "uptime"){
my $uptime = `uptime | sed -e 's/^.*up //' -e 's/, *[0-9]*.users.*//'`;
$uptime =~ s/\s+/ /g;
$uptime = " Uptime:$textcolor $uptime";
push(@line, "$uptime");
}
Here's a small bit to display uptime; if you'd like to add it to the script. (I just figured it could make a good addition)
Example: http://omploader.org/vMnIyaw
Last edited by melik (2009-11-12 07:41:33)
Offline
So, any idea WHY info.pl gives me nothing but errors??
Offline
A friend and I ported part of the script to python, its still not done yet. In my opinion, the script is a lot cleaner, also you can easily switch color schemes to match your theme. Let me know if there are any problems.
#!/usr/bin/env python
import commands
# Define colors
clear = "\x1b[0m"
# color = "\x1b[1;30m" # black
# color2 = "\x1b[0;30m" # black
# color = "\x1b[1;31m" # red
# color2 = "\x1b[0;30m" # red
# color = "\x1b[1;32m" # green
# color2 = "\x1b[0;32m" # green
# color = "\x1b[1;33m" # yellow
# color2 = "\x1b[0;33m" # yellow
color = "\x1b[1;34m" # blue
color2 = "\x1b[0;34m" # blue
# color = "\x1b[1;35m" # magenta
# color2 = "\x1b[0;35m" # magenta
# color = "\x1b[1;36m" # cyan
# color2 = "\x1b[0;36m" # cyan
# color = "\x1b[1;37m" # white
# color2 = "\x1b[0;37m" # white
# Define arrays containing values.
list = []
blank = [ '', '', '', '', '', '', '', '', '' ]
# Find running processes
processes = commands.getoutput("ps -A | awk {'print $4'}").split("\n")
# Print coloured key with normal value.
def output(key, value):
output = "%s%s:%s %s" % (color, key, clear, value)
list.append(output)
def distro_display():
distro = "Arch Linux"
output('Distro', distro)
def kernel_display():
kernel = commands.getoutput("uname -r")
output ('Kernel', kernel)
def uptime_display():
uptime = commands.getoutput('uptime | sed -e \'s/^.*up //\' -e \'s/, *[0-9]*.users.*//\'')
output ('Uptime', uptime)
def battery_display():
battery = commands.getoutput('acpi | sed \'s/.*, //\'')
output ('Battery', battery)
def de_display():
dict = {'gnome-session': 'GNOME',
'ksmserver': 'KDE',
'xfce-mcs-manager': 'Xfce'}
de = 'None found'
for key in dict.keys():
if key in processes: de = dict[key]
output ('DE', de)
def wm_display():
dict = {'awesome': 'Awesome',
'beryl': 'Beryl',
'blackbox': 'Blackbox',
'dwm': 'DWM',
'enlightenment': 'Enlightenment',
'fluxbox': 'Fluxbox',
'fvwm': 'FVWM',
'icewm': 'icewm',
'kwin': 'kwin',
'metacity': 'Metacity',
'openbox': 'Openbox',
'wmaker': 'Window Maker',
'xfwm4': 'Xfwm',
'xmonad': 'Xmonad'}
wm = 'None found'
for key in dict.keys():
if key in processes: wm = dict[key]
output ('WM', wm)
# Values to display.
# Possible options: kernel, uptime, battery, distro, de, wm, wmtheme, theme, font, icons.
display = [ 'distro', 'kernel', 'uptime', 'battery', 'de', 'wm' ]
for x in display:
funcname=x+"_display"
func=locals()[funcname]
func()
list.extend(blank)
# Result
print """%s
%s +
%s #
%s ### %s
%s ##### %s
%s ###### %s
%s ; #####; %s
%s +##.##### %s
%s +########## %s
%s ######%s#####%s##; %s
%s ###%s############%s+ %s
%s #%s###### ####### %s
%s .######; ;###;`\". %s
%s .#######; ;#####.
%s #########. .########`
%s ######' '######
%s ;#### ####;
%s ##' '##
%s #' `# %s
""" % (color, color, color, color, list[0], color, list[1], color, list[2], color, list[3], color, list[4], color, list[5], color, color2, color, list[6], color, color2, color, list[7], color, color2, list[8], color2, list[9], color2, color2, color2, color2, color2, color2, clear)
Also here it is in action: http://omploader.org/vMnhmeg
Note: If you are on a desktop, you can simply remove 'battery' from the line:
display = [ 'distro', 'kernel', 'uptime', 'battery', 'de', 'wm' ]
Last edited by melik (2009-12-06 22:25:55)
Offline
getting errors when runnign the code.
[ender@Null ~ ]$ perl script.pl
String found where operator expected at script.pl line 31, near "if( /gtk-icon-theme-name.*=.*""
(Might be a runaway multi-line "" string starting on line 28)
(Missing semicolon on previous line?)
String found where operator expected at script.pl line 34, near "if( /gtk-font-name.*=.*""
(Might be a runaway multi-line "" string starting on line 31)
(Missing semicolon on previous line?)
String found where operator expected at script.pl line 45, near "$WM =~ /Unknown/ && print ""
(Might be a runaway multi-line "" string starting on line 34)
(Missing semicolon on previous line?)
String found where operator expected at script.pl line 51, near "print ""
(Might be a runaway multi-line "" string starting on line 45)
(Missing semicolon on previous line?)
syntax error at script.pl line 28, near "(."
Search pattern not terminated at script.pl line 51.
[ender@Null ~ ]$
Proud Arch i686 & x86_64 User
Share your knowledge!
Arch Linux Forum Etiquette
Offline
getting errors when runnign the code.
[ender@Null ~ ]$ perl script.pl String found where operator expected at script.pl line 31, near "if( /gtk-icon-theme-name.*=.*"" (Might be a runaway multi-line "" string starting on line 28) (Missing semicolon on previous line?) String found where operator expected at script.pl line 34, near "if( /gtk-font-name.*=.*"" (Might be a runaway multi-line "" string starting on line 31) (Missing semicolon on previous line?) String found where operator expected at script.pl line 45, near "$WM =~ /Unknown/ && print "" (Might be a runaway multi-line "" string starting on line 34) (Missing semicolon on previous line?) String found where operator expected at script.pl line 51, near "print "" (Might be a runaway multi-line "" string starting on line 45) (Missing semicolon on previous line?) syntax error at script.pl line 28, near "(." Search pattern not terminated at script.pl line 51. [ender@Null ~ ]$
The perl script is quite buggy, try the python version.
Last edited by melik (2009-12-07 08:34:10)
Offline
try the python version.
http://pastebin.ca/1705285
Nice! Works well.
(altho do remove the battery as the default display option, since it "crashes" the script when not found)
Thanks
Offline
melik wrote:try the python version.
http://pastebin.ca/1705285Nice! Works well.
(altho do remove the battery as the default display option, since it "crashes" the script when not found)Thanks
Good idea, done, and your welcome
Latest version: http://github.com/djmelik/archey/blob/master/archey.py
Last edited by melik (2009-12-07 12:38:26)
Offline
3nd3r wrote:getting errors when runnign the code.
[ender@Null ~ ]$ perl script.pl String found where operator expected at script.pl line 31, near "if( /gtk-icon-theme-name.*=.*"" (Might be a runaway multi-line "" string starting on line 28) (Missing semicolon on previous line?) String found where operator expected at script.pl line 34, near "if( /gtk-font-name.*=.*"" (Might be a runaway multi-line "" string starting on line 31) (Missing semicolon on previous line?) String found where operator expected at script.pl line 45, near "$WM =~ /Unknown/ && print "" (Might be a runaway multi-line "" string starting on line 34) (Missing semicolon on previous line?) String found where operator expected at script.pl line 51, near "print "" (Might be a runaway multi-line "" string starting on line 45) (Missing semicolon on previous line?) syntax error at script.pl line 28, near "(." Search pattern not terminated at script.pl line 51. [ender@Null ~ ]$
The perl script is quite buggy, try the python version.
[ender@Null ~ ]$ python script.py
File "script.py", line 86
if key in processes: wm = dict[key]
^
IndentationError: expected an indented block
[ender@Null ~ ]$
=\
Proud Arch i686 & x86_64 User
Share your knowledge!
Arch Linux Forum Etiquette
Offline
melik wrote:3nd3r wrote:getting errors when runnign the code.
[ender@Null ~ ]$ perl script.pl String found where operator expected at script.pl line 31, near "if( /gtk-icon-theme-name.*=.*"" (Might be a runaway multi-line "" string starting on line 28) (Missing semicolon on previous line?) String found where operator expected at script.pl line 34, near "if( /gtk-font-name.*=.*"" (Might be a runaway multi-line "" string starting on line 31) (Missing semicolon on previous line?) String found where operator expected at script.pl line 45, near "$WM =~ /Unknown/ && print "" (Might be a runaway multi-line "" string starting on line 34) (Missing semicolon on previous line?) String found where operator expected at script.pl line 51, near "print "" (Might be a runaway multi-line "" string starting on line 45) (Missing semicolon on previous line?) syntax error at script.pl line 28, near "(." Search pattern not terminated at script.pl line 51. [ender@Null ~ ]$
The perl script is quite buggy, try the python version.
[ender@Null ~ ]$ python script.py File "script.py", line 86 if key in processes: wm = dict[key] ^ IndentationError: expected an indented block [ender@Null ~ ]$
=\
Umm..
wget http://github.com/djmelik/archey/raw/master/archey.py
python archey.py
run those commands.
Last edited by melik (2009-12-07 12:43:15)
Offline
3nd3r wrote:melik wrote:The perl script is quite buggy, try the python version.
[ender@Null ~ ]$ python script.py File "script.py", line 86 if key in processes: wm = dict[key] ^ IndentationError: expected an indented block [ender@Null ~ ]$
=\
Umm..
wget http://github.com/djmelik/archey/raw/master/archey.py python archey.py
run those commands.
yay
[ender@Null ~ ]$ python archey.py
+
#
### OS: Arch Linux
##### Kernel: 2.6.31-ARCH
###### Uptime: 1:47
; #####; DE: KDE
+##.##### WM: kwin
+########## Packages: 854
#############; Root: 5.2G / 19G
###############+
####### #######
.######; ;###;`".
.#######; ;#####.
#########. .########`
######' '######
;#### ####;
##' '##
#' `#
[ender@Null ~ ]$
Proud Arch i686 & x86_64 User
Share your knowledge!
Arch Linux Forum Etiquette
Offline
script can now be found in the AUR:
Offline
Hello,
Here a little patch for archey to add Xfce4.6 support as a DE(no xfce-mcs-manager anymore) :
--- /usr/bin/archey 2009-12-27 20:12:22.000000000 +0100
+++ archey 2009-12-27 20:15:17.000000000 +0100
@@ -99,7 +99,8 @@
def de_display():
dict = {'gnome-session': 'GNOME',
'ksmserver': 'KDE',
- 'xfce-mcs-manager': 'Xfce'}
+ 'xfce-mcs-manager': 'Xfce 4',
+ 'xfconfd': 'Xfce 4.6'}
de = 'None found'
for key in dict.keys():
if key in processes: de = dict[key]
There is an other script (in perl) which i take in this thread, 'archinfo', here the aur package: http://aur.archlinux.org/packages.php?ID=30517
Offline
Hello,
Here a little patch for archey to add Xfce4.6 support as a DE(no xfce-mcs-manager anymore) :
--- /usr/bin/archey 2009-12-27 20:12:22.000000000 +0100 +++ archey 2009-12-27 20:15:17.000000000 +0100 @@ -99,7 +99,8 @@ def de_display(): dict = {'gnome-session': 'GNOME', 'ksmserver': 'KDE', - 'xfce-mcs-manager': 'Xfce'} + 'xfce-mcs-manager': 'Xfce 4', + 'xfconfd': 'Xfce 4.6'} de = 'None found' for key in dict.keys(): if key in processes: de = dict[key]
There is an other script (in perl) which i take in this thread, 'archinfo', here the aur package: http://aur.archlinux.org/packages.php?ID=30517
Thanks, I'll push it to github right now. I also improved the fs_display function.
I'm also looking for any suggestions for new features to add to archey.
Last edited by melik (2009-12-28 03:28:34)
Offline
Skunnyk wrote:Hello,
Here a little patch for archey to add Xfce4.6 support as a DE(no xfce-mcs-manager anymore) :
--- /usr/bin/archey 2009-12-27 20:12:22.000000000 +0100 +++ archey 2009-12-27 20:15:17.000000000 +0100 @@ -99,7 +99,8 @@ def de_display(): dict = {'gnome-session': 'GNOME', 'ksmserver': 'KDE', - 'xfce-mcs-manager': 'Xfce'} + 'xfce-mcs-manager': 'Xfce 4', + 'xfconfd': 'Xfce 4.6'} de = 'None found' for key in dict.keys(): if key in processes: de = dict[key]
There is an other script (in perl) which i take in this thread, 'archinfo', here the aur package: http://aur.archlinux.org/packages.php?ID=30517
Thanks, I'll push it to github right now. I also improved the fs_display function.
I'm also looking for any suggestions for new features to add to archey.
wmii was missing from the wm_display function, too.
I alternate between wmii and KDE (and xmonad on occasion), and I don't really want KWin displayed when I'm in KDE or "none found" displayed for my DE when I'm in wmii. I think it'd be handy to have a function that displays your DE if you're using one and falls back to your WM otherwise. I added a de_or_wm option that does just that (and added wmii to the WM dict); all my changes are at github, so feel free to pull whatever you like!
If you're masochistic, you could try adding theme support like in one of the Perl versions. Anyway, thanks for archey! I have to agree that the code is a bit nicer on the eyes than the Perl versions.
Arch x86_64 on a {ThinkPad T61p, Cr-48}; XFCE.
my code; silly things I've written.
Offline
i finally got my own now as well Thanks guys!
Registered Linux user :#500622
"être fort pour être utile" (be strong to be useful) —Georges Hébert
"There is only Good people and Bad people, we should not be judged by Race, religion or sex but we should be judged by our deeds or actions." - Lindsey Irving
Xenokite aka Lycan
Offline
melik wrote:Skunnyk wrote:Hello,
Here a little patch for archey to add Xfce4.6 support as a DE(no xfce-mcs-manager anymore) :
--- /usr/bin/archey 2009-12-27 20:12:22.000000000 +0100 +++ archey 2009-12-27 20:15:17.000000000 +0100 @@ -99,7 +99,8 @@ def de_display(): dict = {'gnome-session': 'GNOME', 'ksmserver': 'KDE', - 'xfce-mcs-manager': 'Xfce'} + 'xfce-mcs-manager': 'Xfce 4', + 'xfconfd': 'Xfce 4.6'} de = 'None found' for key in dict.keys(): if key in processes: de = dict[key]
There is an other script (in perl) which i take in this thread, 'archinfo', here the aur package: http://aur.archlinux.org/packages.php?ID=30517
Thanks, I'll push it to github right now. I also improved the fs_display function.
I'm also looking for any suggestions for new features to add to archey.
wmii was missing from the wm_display function, too.
I alternate between wmii and KDE (and xmonad on occasion), and I don't really want KWin displayed when I'm in KDE or "none found" displayed for my DE when I'm in wmii. I think it'd be handy to have a function that displays your DE if you're using one and falls back to your WM otherwise. I added a de_or_wm option that does just that (and added wmii to the WM dict); all my changes are at github, so feel free to pull whatever you like!
If you're masochistic, you could try adding theme support like in one of the Perl versions. Anyway, thanks for archey! I have to agree that the code is a bit nicer on the eyes than the Perl versions.
Hey thanks, I'll be pushing your code to the official rep right now .
Also I'll be adding GPU/CPU/RAM info tonight.
Last edited by melik (2009-12-28 21:17:01)
Offline