├── Makefile.PL ├── README ├── ascii ├── arch ├── arch-new ├── arch-old ├── bsd ├── debian ├── fedora ├── gentoo ├── pedobear ├── sabayon ├── tux ├── windows └── windows-8 ├── screenfo └── screenfo.conf /Makefile.PL: -------------------------------------------------------------------------------- 1 | use strict; 2 | use warnings; 3 | use ExtUtils::MakeMaker; 4 | 5 | WriteMakefile( 6 | NAME => 'screenfo', 7 | AUTHOR => q{Magnus Woldrich }, 8 | VERSION_FROM => './screenfo', 9 | ($ExtUtils::MakeMaker::VERSION >= 6.3002 10 | ? ('LICENSE'=> 'perl') 11 | : ()), 12 | PL_FILES => {}, 13 | EXE_FILES => ['./screenfo'], 14 | PREREQ_PM => { 15 | 'Test::More' => 0, 16 | 'Audio::MPD' => 0, 17 | 'Term::ExtendedColor' => 0.16, 18 | }, 19 | MAN1PODS => { 20 | 'screenfo' => 'blib/man1/screenfo.1', 21 | }, 22 | dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, 23 | clean => { FILES => 'screenfo-*' }, 24 | ); 25 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | NAME 2 | screenfo - screenshot information tool for nerds 3 | 4 | SYNOPSIS 5 | screenfo [OPTION]... 6 | 7 | DESCRIPTION 8 | Everybody likes 'The monthly screenshot thread' where one is supposed to 9 | show off their latest setup. 10 | 11 | Nobody likes screenshots that look awesome, but where there's no 12 | information at all available. 13 | 14 | screenfo outputs a load of system information, including the running 15 | window manager, GTK theme, icons, fonts, shell, terminal emulator, and 16 | much more, while taking the screenshot. 17 | 18 | OPTIONS 19 | -c, --color specify colorscheme to use 20 | -l, --list list available colorschemes 21 | -a, --ascii specify ascii art to use 22 | -r, --random randomize the colors 23 | -s, --shot take screenshot 24 | -d, --debug show debug info 25 | 26 | -h, --help show help and exit 27 | -v, --version show version info and exit 28 | 29 | ENVIRONMENT 30 | 31 | The configuration file is searched for in the following places: 32 | 33 | $XDG_CONFIG_HOME/screenfo/screenfo.conf 34 | $HOME/.config/screenfo/screenfo.conf 35 | $HOME/.screenfo.conf 36 | $HOME/screenfo.conf 37 | ./screenfo.conf 38 | /etc/screenfo.conf 39 | 40 | The files in the ascii/ directory is searched for in in the following 41 | places: 42 | 43 | $XDG_DATA_HOME/screenfo/ascii 44 | $HOME/.local/share/screenfo/ascii 45 | $HOME/.screenfo/ascii 46 | ./ascii 47 | /usr/share/screenfo/ascii 48 | 49 | REQUIREMENTS 50 | Perl => 5.10 51 | 52 | Term::ExtendedColor, available from the CPAN: 53 | 54 | cpan Term::ExtendedColor 55 | 56 | and github: http://github.com/trapd00r/Term-ExtendedColor 57 | 58 | Some standard UNIX tools 59 | 60 | scrot for taking the actual screenshot 61 | 62 | AUTHOR 63 | Written by Magnus Woldrich 64 | 65 | REPORTING BUGS 66 | Report bugs to trapd00r\@trapd00r.se or use the issue tracker located at 67 | 68 | 69 | screenfo homepage: 70 | 71 | COPYRIGHT 72 | Copyright (C) 2010 Magnus Woldrich 73 | 74 | License: GPLv2 75 | 76 | HISTORY 77 | Lets quote the Arch Linux user dtw from a post on the BBS, late 2006: 78 | 79 | OK, all the time in the screenshots thread we get "What gtk theme is that?", 80 | "What is that in the corner?", blah blah blah. 81 | Now, while we try to encourage people to post that with their screenie why 82 | don't we make a simple script that grabs info from from the gtkrc's, .xinitrc, 83 | etc, and outputs into a nice cowsay-like soundbite? 84 | 85 | Couple days later, user rab made the first Perl version simply named 86 | 'info.pl'. There were a lot of people in the community helping out, 87 | making it better, bigger, more complicated and virtually unmaintainable 88 | since absolutely no modularization or subroutines were used. 89 | 90 | People realized this and started to make their own versions in Bash and 91 | Python. 92 | 93 | My intent was to fork the original project, clean it up and make it 94 | maintainable, but that was no fun. Therefore, screenfo was born. 95 | 96 | THANKS 97 | I'd like to thank the Archlinux community for being awesome, kittykatt 98 | for providing some ASCII art that I stole without asking, and slush- for 99 | coming up with this awesome name. 100 | 101 | SEE ALSO 102 | The original post: 103 | 104 | 105 | screenFetch: 106 | 107 | archey: 108 | 109 | -------------------------------------------------------------------------------- /ascii/arch: -------------------------------------------------------------------------------- 1 | + 2 | # 3 | ### 4 | ##### 5 | ###### 6 | ; #####; 7 | +##.##### 8 | +########## 9 | #############; 10 | ###############+ 11 | ####### ####### 12 | .######; ;###;`". 13 | .#######; ;#####. 14 | #########. .########` 15 | ######' '###### 16 | ;#### ####; 17 | ##' '## 18 | #' `# 19 | ' ` 20 | -------------------------------------------------------------------------------- /ascii/arch-new: -------------------------------------------------------------------------------- 1 | -` 2 | .o+` 3 | `ooo/ 4 | `+oooo: 5 | `+oooooo: 6 | -+oooooo+ : 7 | `/:-:++oooo+: 8 | `/++++/+++++++: 9 | `/++++++++++++++: 10 | `/+++ooooooooooooo/` 11 | ./ooosssso++osssssso+` 12 | .oossssso-````/ossssss+` 13 | -osssssso. :ssssssso. 14 | :osssssss/ osssso+++. 15 | /ossssssss/ +ssssooo/- 16 | `/ossssso+/:- -:/+osssso+ 17 | `+sso+:-` `.-/+oso: 18 | `++:. `-/+/ 19 | 20 | -------------------------------------------------------------------------------- /ascii/arch-old: -------------------------------------------------------------------------------- 1 | __ 2 | _=(PERLT=_ 3 | _RTELHRRFCVP) 4 | ,RTELRRDTDFBRX0 5 | LEJDIHORORVFPBPVL-=+=,_ 6 | ILFEUFHJNXIXCDXDPV, "REPL 7 | [LKEPDLTDU=OUPCPBFLD. '?ZWX, 8 | ,LMEPDPWH' `DCBOPI DRDP], 9 | PEDFDFH' !YEWD, )HDROD 10 | !KMEOCR &RPU|\_RFHRRO\' 11 | HKLPRP' __\TTL0\RHRBV)' 12 | LPNRVW' __+MNAEC\IOI,\BN' 13 | HELK[' __,=OFFXCBRHC\FE) 14 | ?KRHE \_-#EA[]EFLPV=' 'EF 15 | 'EHTI !H 16 | `0F' '! 17 | -------------------------------------------------------------------------------- /ascii/bsd: -------------------------------------------------------------------------------- 1 | , , 2 | /( )` 3 | \ \___ / | 4 | /- _ `-/ ' 5 | (/\/ \ \ /\ 6 | / / | ` \ 7 | O O ) / | 8 | `-^--'`< ' 9 | (_.) _ ) / 10 | `.___/` / 11 | `-----' / 12 | <----. __/ __ \ 13 | <----|====O)))==) \) \/==== 14 | <----' `--' `.__,' \ 15 | | | 16 | \ / /\ 17 | ______( (_ / \______/ 18 | ,' ,-----' | 19 | `--{__________) 20 | 21 | -------------------------------------------------------------------------------- /ascii/debian: -------------------------------------------------------------------------------- 1 | _,met$$$$$gg. 2 | ,g$$$$$$$$$$$$$$$P. 3 | ,g$$P"" """Y$$.". 4 | ,$$P' `$$$. 5 | ',$$P ,ggs. `$$b: 6 | `d$$' ,$P"\' . $$$ 7 | $$P d$\' , $$P 8 | $$: $$. - ,d$$' 9 | $$\; Y$b._ _,d$P' 10 | Y$$. `.`"Y$$$$P"' 11 | `$$b "-.__ 12 | `Y$$ 13 | `Y$$. 14 | `$$b. 15 | `Y$$b. 16 | `"Y$b._ 17 | `"""" 18 | 19 | -------------------------------------------------------------------------------- /ascii/fedora: -------------------------------------------------------------------------------- 1 | :/------------:// 2 | :------------------:// 3 | :-----------/shhdhyo/-:// 4 | /-----------omMMMNNNMMMd/-:/ 5 | :-----------sMMMdo:/ -:/ 6 | :-----------:MMMd------- --:/ 7 | /-----------:MMMy------- ---/ 8 | :------ --/+MMMh/-- ---: 9 | :--- oNMMMMMMMMMNho -----: 10 | :-- +shhhMMMmhhy++ ------: 11 | :- -----:MMMy--------------/ 12 | :- ------/MMMy-------------: 13 | :- ----/hMMM+------------: 14 | :--:dMMNdhhdNMMNo-----------: 15 | :---:sdNMMMMNds:----------: 16 | :------:://:-----------:// 17 | :--------------------:// 18 | 19 | -------------------------------------------------------------------------------- /ascii/gentoo: -------------------------------------------------------------------------------- 1 | -/oyddmdhs+:. 2 | -odNMMMMMMMMNNmhy+-\` 3 | -yNMMMMMMMMMMMNNNmmdhy+- 4 | \`omMMMMMMMMMMMMNmdmmmmddhhy/\` 5 | omMMMMMMMMMMMNhhyyyohmdddhhhdo\` 6 | .ydMMMMMMMMMMdhs++so/smdddhhhhdm+\` 7 | oyhdmNMMMMMMMNdyooydmddddhhhhyhNd. 8 | :oyhhdNNMMMMMMMNNNmmdddhhhhhyymMh 9 | .:+sydNMMMMMNNNmmmdddhhhhhhmMmy 10 | /mMMMMMMNNNmmmdddhhhhhmMNhs: 11 | \`oNMMMMMMMNNNmmmddddhhdmMNhs+\` 12 | \`sNMMMMMMMMNNNmmmdddddmNMmhs/. 13 | /NMMMMMMMMNNNNmmmdddmNMNdso:\` 14 | +MMMMMMMNNNNNmmmmdmNMNdso/- 15 | yMMNNNNNNNmmmmmNNMmhs+/-\` 16 | /hMMNNNNNNNNMNdhs++/-\` 17 | \`/ohdmmddhys+++/:.\` 18 | \`-//////:--. 19 | 20 | -------------------------------------------------------------------------------- /ascii/pedobear: -------------------------------------------------------------------------------- 1 | ∩___∩ 2 | | ノ ヽ 3 | / ● ● | 4 | | ( _●_) ミ 5 | 彡、 |∪| 、`\ 6 | / __ ヽノ /´> ) 7 | (___) / (_/ 8 | | / 9 | | /\ \ 10 | | / ) ) 11 | ∪ ( \ 12 | \_) 13 | -------------------------------------------------------------------------------- /ascii/sabayon: -------------------------------------------------------------------------------- 1 | 7 2 | ?7 3 | 7 4 | ?7 5 | 777 6 | ?777 7 | 7777? 8 | IIII? 9 | IIII? ? 10 | =I IIII? III 11 | ?I? IIII+ +III 12 | ?????? ????= ????? 13 | ?++++++++++++++++++++ 14 | ~++++++++++++++++ 15 | =========== 16 | ~~~~~~= 17 | 18 | 19 | -------------------------------------------------------------------------------- /ascii/tux: -------------------------------------------------------------------------------- 1 | _nnnn_ 2 | dGGGGMMb 3 | @p~qp~~qMb 4 | M|@||@) M| 5 | @,----.JM| 6 | JS^\__/ qKL 7 | dZP qKRb 8 | dZP qKKb 9 | fZP SMMb 10 | HZM MMMM 11 | FqM MMMM 12 | __| ". |\dS"qML 13 | | `. | `' \Zq 14 | _) \.___.,| .' 15 | \____ )MMMMMP| .' 16 | `-' `--' hjm 17 | -------------------------------------------------------------------------------- /ascii/windows: -------------------------------------------------------------------------------- 1 | ,.=:^!^!t3Z3z., 2 | :tt:::tt333EE3 3 | Et:::ztt33EEE @Ee., .., 4 | ;tt:::tt333EE7 ;EEEEEEttttt33# 5 | :Et:::zt333EEQ. SEEEEEttttt33QL 6 | it::::tt333EEF @EEEEEEttttt33F 7 | ;3=*^```'*4EEV :EEEEEEttttt33@. 8 | ,.=::::it=., ` @EEEEEEtttz33QF 9 | ;::::::::zt33) '4EEEtttji3P* 10 | :t::::::::tt33.:Z3z.. `` ,..g. 11 | i::::::::zt33F AEEEtttt::::ztF 12 | ;:::::::::t33V ;EEEttttt::::t3 13 | E::::::::zt33L @EEEtttt::::z3F 14 | {3=*^```'*4E3) ;EEEtttt:::::tZ` 15 | ` :EEEEtttt::::z7 16 | 'VEzjt:;;z>*` 17 | -------------------------------------------------------------------------------- /ascii/windows-8: -------------------------------------------------------------------------------- 1 | ####### 2 | ############### 3 | ####################### 4 | ###### ####################### 5 | ############## ####################### 6 | ############## ####################### 7 | ############## ####################### 8 | ############## ####################### 9 | ############## ####################### 10 | ############## ####################### 11 | ############## ####################### 12 | ############## ####################### 13 | ############## ####################### 14 | 15 | ############## ####################### 16 | ############## ####################### 17 | ############## ####################### 18 | ############## ####################### 19 | ############## ####################### 20 | ############## ####################### 21 | ############## ####################### 22 | ############## ####################### 23 | ############## ####################### 24 | ###### ####################### 25 | ####################### 26 | ############### 27 | ####### 28 | -------------------------------------------------------------------------------- /screenfo: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | my $APP = 'screenfo'; 3 | use vars qw($VERSION); 4 | $VERSION = '0.298'; 5 | 6 | use strict; 7 | use List::Util qw(shuffle); 8 | use Getopt::Long; 9 | use Pod::Usage; 10 | 11 | use Term::ExtendedColor qw(fg bg); 12 | 13 | my $DEBUG = $ENV{DEBUG}; 14 | 15 | # imported from configuration file 16 | our($now_playing, $default_colorscheme, %colorschemes, $default_logo, 17 | $color_support); 18 | our($opt_shot) = undef; 19 | our($randomize_colors); # 0 disables the randomizing (default) 20 | our(@df_exclude); 21 | 22 | config_init(); 23 | 24 | GetOptions( 25 | 'a|ascii:s' => \$default_logo, 26 | 'c|color:s' => \$default_colorscheme, 27 | 'l|list' => \&available_colorschemes, 28 | 'r|random' => \$randomize_colors, 29 | 's|shot' => \$opt_shot, 30 | 'd|debug' => \$DEBUG, 31 | 'h|help' => sub { pod2usage(verbose => 1) and exit(0); }, 32 | 'm|man' => sub { pod2usage(verbose => 3) and exit(0); }, 33 | 'v|version' => sub { printf("%s v%s\n", $APP, $VERSION); exit(0); }, 34 | ); 35 | 36 | logo_init($default_logo); 37 | 38 | if(not defined($default_logo)) { 39 | $default_logo = logo_init('arch'); 40 | } 41 | 42 | get_color_support(); 43 | 44 | sub logo_init { 45 | my $logo = shift; 46 | 47 | if(-f "$ENV{XDG_DATA_HOME}/screenfo/ascii/$logo") { 48 | $default_logo = "$ENV{XDG_DATA_HOME}/screenfo/ascii/$logo"; 49 | } 50 | elsif(-f "$ENV{HOME}/.local/share/screenfo/ascii/$logo") { 51 | $default_logo = "$ENV{HOME}/.local/share/screenfo/ascii/$logo"; 52 | } 53 | elsif(-f "$ENV{XDG_CONFIG_HOME}/screenfo/ascii/$logo") { 54 | $default_logo = "$ENV{XDG_CONFIG_HOME}/screenfo/ascii/$logo"; 55 | } 56 | elsif(-f "$ENV{HOME}/.screenfo/ascii/$logo") { 57 | $default_logo = "$ENV{HOME}/.screenfo/ascii/$logo"; 58 | } 59 | elsif(-f "./ascii/$logo") { 60 | $default_logo = "./ascii/$logo"; 61 | } 62 | elsif(-f "/usr/share/screenfo/ascii/$logo") { 63 | $default_logo = "/usr/share/screenfo/ascii/$logo"; 64 | } 65 | else { 66 | $default_logo = undef; 67 | } 68 | } 69 | 70 | sub config_init { 71 | my $config; 72 | if(-f "$ENV{XDG_CONFIG_HOME}/screenfo/screenfo.conf") { 73 | $config = "$ENV{XDG_CONFIG_HOME}/screenfo/screenfo.conf"; 74 | } 75 | elsif(-f "$ENV{HOME}/.config/screenfo/screenfo.conf") { 76 | $config = "$ENV{HOME}/.config/screenfo/screenfo.conf"; 77 | } 78 | elsif(-f "$ENV{HOME}/.screenfo.conf") { 79 | $config = "$ENV{HOME}/.screenfo.conf"; 80 | } 81 | elsif(-f "$ENV{HOME}/screenfo.conf") { 82 | $config = "$ENV{HOME}/screenfo.conf"; 83 | } 84 | elsif(-f './screenfo.conf') { 85 | $config = './screenfo.conf'; 86 | } 87 | elsif(-f '/etc/screenfo.conf') { 88 | $config = '/etc/screenfo.conf'; 89 | } 90 | else { 91 | warn "No configuration file found.\n"; 92 | warn "See docs/screenfo.conf.example for an example configuration file.\n"; 93 | exit 1; 94 | } 95 | print "Config found: $config\n" if $DEBUG; 96 | 97 | require($config); 98 | warn $@ if $@; 99 | } 100 | sub longest { 101 | return unless(my @strings = @_); 102 | chomp(@strings); 103 | 104 | my %len_map = (); 105 | 106 | map{ $len_map{length($_)} = $_ } @strings; 107 | 108 | for my $k(sort{$b <=> $a} keys(%len_map)) { 109 | return $k; 110 | } 111 | } 112 | 113 | 114 | 115 | sub get_color_support { 116 | my $colors = 16; 117 | if( 118 | $ENV{TERM} eq 'xterm' 119 | or($ENV{TERM} eq 'rxvt-256-color') 120 | or($ENV{TERM} =~ /screen-256/) 121 | or($ENV{TERM} eq 'Eterm-256color') 122 | or($ENV{TERM} eq 'gnome-256color') 123 | or($ENV{TERM} eq 'konsole-256color') 124 | or($ENV{TERM} eq 'putty-256color') 125 | or($ENV{TERM} =~ /u?rxvt-256color/) 126 | ) { 127 | $colors = 256; 128 | } 129 | elsif($ENV{TERM} eq 'rxvt-unicode') { 130 | $colors = 88; 131 | } 132 | elsif($ENV{TERM} eq 'screen') { 133 | $colors = 16; 134 | } 135 | else { 136 | chomp($colors = `tput colors`); # fail silently 137 | } 138 | 139 | if(!defined($colors) or($colors < 88)) { # man 7 urxvt 140 | # mm, maintaince mayhem 141 | %colorschemes = ( 142 | all => [0..15], 143 | ansi => [0..15], # obviously the same thing here 144 | grey => [0,8,7,15], # black, bright black, white, bright white 145 | red => [1,9], # red, bright red 146 | green => [2,10], # green, bright green 147 | white => [7,15], # white, bright white 148 | blue => [4,12], # blue, bright blue 149 | pink => [5,13], # magenta, bright magenta 150 | yellow => [3,11], # yellow, bright yellow (' brown ') 151 | fire => [1,11,9,3], # red, bright yellow, bright red, yellow 152 | pinkgrey => [0,13,7,15,5,8], # black, bright magenta, white, 153 | # bright white, magenta, bright black 154 | orangegrey => [1,0,8,7,11,9,15,3],# red, black, bright black, white, bright 155 | # yellow, bright red, bright white, yellow 156 | ); 157 | } 158 | elsif($colors == 88) { 159 | %colorschemes = ( 160 | all => [0..87], 161 | ansi => [0..15], 162 | grey => [0,8,7,15], 163 | red => [52,88], 164 | green => [22,28,34,40,46,70,76], 165 | white => [7,15], 166 | blue => [17..21,24..27,32,33,37..39], 167 | pink => [53..57,60..63], 168 | yellow => [3,11], 169 | fire => [3,11,88,52], 170 | pinkgrey => [8,0,53..57,60..63,15,7], 171 | orangegrey => [1,0,8,7,11,9,15,3], 172 | ); 173 | } 174 | } 175 | 176 | if($DEBUG) { 177 | chomp(my $host = `hostname`); 178 | printf("\e[31;1m%13s \e[0mver \e[32;1m%s\e[0m\n", 'screenfo', $VERSION); 179 | printf("%13s -=> \e[1m%s\e[0m\n", 'Perl', $^V); 180 | printf("%13s -=> \e[1m%s\e[0m (from ENV)\n", 'User', $ENV{USER}); 181 | printf("%13s -=> \e[1m%s\e[0m (from hostname bin)\n", 'Host', $host); 182 | printf("%13s -=> \e[1m%s\e[0m\n",'OS', get_os()); 183 | printf("%13s -=> \e[1m%s\e[0m\n",'WM', get_wm()); 184 | printf("%13s -=> \e[1m%s\e[0m (from /proc/version)\n",'Kernel', get_kernel()); 185 | printf("%13s -=> \e[1m%s\e[0m\n",'GTK Theme', get_gtk_info('theme')); 186 | printf("%13s -=> \e[1m%s\e[0m\n",'GTK Icons', get_gtk_info('icons')); 187 | printf("%13s -=> \e[1m%s\e[0m\n",'GTK Font', get_gtk_info('font')); 188 | printf("%13s -=> \e[1m%s\e[0m\n",'GTK Toolbar', get_gtk_info('toolbar')); 189 | printf("%13s -=> %s \e[1mused\e[0m out of %s (%s \e[1mfree\e[0m - that is %s)\n", 190 | 'Disk', get_disk_total('used'), get_disk_total('size'), 191 | get_disk_total('avail'), get_disk_total('percent') 192 | ); 193 | printf("%13s -=> %d\n", 'Processes', get_no_proc()); 194 | printf("%13s -=> %s \e[1mused\e[0m out of %s (%s \e[1mfree\e[0m)\n", 'RAM', 195 | get_mem('used'), get_mem('total'), get_mem('avail') 196 | ); 197 | printf("%13s -=> %s \e[1mdays\e[0m, %s \e[1mmins\e[0m\n", 198 | 'Uptime', get_uptime('days'), get_uptime('mins') 199 | ); 200 | printf("%13s -=> \e[1m%s\e[0m\n",'Users', get_no_users()); 201 | printf("%13s -=> \e[1m%s\e[0m (from ENV)\n",'Shell', get_shell()); 202 | printf("%13s -=> \e[1m%s\e[0m (from ENV)\n",'Terminal', get_terminal()); 203 | printf("%13s -=> \e[1m%s\e[0m (from uname or /proc/cpuinfo)\n", 204 | 'CPU', get_cpu() 205 | ); 206 | 207 | if(-f '/etc/screenfo.conf') { 208 | printf("%13s -=> \e[33m%s\e[0m (/etc/screenfo.conf)\n", 209 | 'Config', 'Found' 210 | ); 211 | } 212 | else { 213 | printf("%13s -=> \e[31m%s\e[0m (/etc/screenfo.conf)\n", 214 | 'Config', 'NOT found' 215 | ); 216 | } 217 | printf("%13s -=> \e[1m%s\e[0m\n", 'Colorscheme', $default_colorscheme); 218 | 219 | if(-f $default_logo) { 220 | printf("%13s -=> \e[1m%s\e[0m (\e[33mfound\e[0m)\n", 221 | 'ASCII Art', $default_logo, 222 | ); 223 | } 224 | else { 225 | printf("%13s -=> \e[1m%s\e[0m (\e[31;1mNOT found\e[0m)\n", 226 | 'ASCII Art', $default_logo, 227 | ); 228 | } 229 | 230 | if(ref($now_playing) eq 'CODE') { 231 | printf("%13s -=> \e[1m%s\e[0m\n", 232 | 'Now Playing', "\e[33mValid\e[0m CODEREF", 233 | ); 234 | printf("%s \e[1m%s\e[0m\n", 235 | "\t\t \t'-->", $now_playing->(), 236 | ); 237 | } 238 | else { 239 | printf("%13s -=> \e[1m%s\e[0m\n", 240 | 'Now Playing', "\e[31;1mINVALID\e[0m CODEREF", 241 | ); 242 | } 243 | 244 | printf("%13s -=> \e[1m%s\e[0m (\e[1m%s\e[0m)\n", 245 | 'Color support', $color_support, $ENV{TERM}, 246 | ); 247 | exit(0); 248 | } 249 | 250 | sub get_kernel { 251 | if($^O =~ /bsd$/) { 252 | return(`uname -r`); 253 | } 254 | else { 255 | open(my $fh, '<', '/proc/version') or warn($!); 256 | my $version = <$fh>; 257 | # extended to match kernels [1-4] 258 | my ($kernel) = $version =~ /([1-4][.][0-9][.0-9\S]+)/; 259 | return($kernel); 260 | } 261 | } 262 | 263 | sub get_no_proc { 264 | opendir(my $dh, '/proc') or warn($!); 265 | my @processes = grep{/^[0-9]+/} readdir($dh); # PIDs 266 | return(scalar(@processes)); 267 | } 268 | 269 | sub get_gtk_info { 270 | my $wanted = shift; 271 | if(!defined($wanted)) { 272 | $wanted = 'theme'; 273 | } 274 | my ($gtk_theme,$gtk_font,$gtk_icons,$gtk_toolbar) = 275 | (fg(242,'Unknown')) x 4; 276 | 277 | my $gtk_rc = "$ENV{HOME}/.gtkrc.mine"; 278 | if(-f $gtk_rc) { 279 | # all good 280 | } 281 | elsif(-f "$ENV{HOME}/.gtkrc-2.0") { 282 | $gtk_rc = "$ENV{HOME}/.gtkrc-2.0"; 283 | } 284 | 285 | open(my $fh, '<', $gtk_rc); #fail silently 286 | while(<$fh>) { 287 | if(/gtk-theme-name\s*=\s*"(.+)"/) { 288 | $gtk_theme = $1; 289 | } 290 | elsif(/include\s*".+themes\/(.+)\/.+\/gtkrc/) { 291 | $gtk_theme = $1; 292 | } 293 | if(/gtk-icon-theme-name\s*=\s*"(.+)"/) { 294 | $gtk_icons = $1; 295 | } 296 | if(/gtk-font-name\s*=\s*"(.+)"/) { 297 | $gtk_font = $1; 298 | } 299 | if(/gtk-toolbar-style\s*=\s*([0-9]+)/) { 300 | $gtk_toolbar = $1; 301 | } 302 | } 303 | return($gtk_theme) if($wanted eq 'theme'); 304 | return($gtk_icons) if($wanted eq 'icons'); 305 | return($gtk_font) if($wanted eq 'font'); 306 | return($gtk_toolbar) if($wanted eq 'toolbar'); 307 | return(-1); 308 | } 309 | 310 | sub get_disk_total { 311 | my $wanted = shift; 312 | if(!defined($wanted)) { 313 | $wanted = 'size'; 314 | } 315 | my $exclude; 316 | foreach(@df_exclude) { 317 | $exclude .= "-x $_ "; 318 | } 319 | my $df; 320 | if($^O =~ /.*bsd$/) { 321 | open($df, '-|', 'df -h -c') or warn($!); 322 | } 323 | elsif($^O eq 'cygwin') { 324 | open($df, '-|', 'df '.$exclude.' -h --total /cygdrive/*') or warn($!); 325 | } 326 | else { 327 | open($df, '-|', 'df '.$exclude.' -h --total') or warn($!); 328 | } 329 | my($size,$used,$avail,$percent); 330 | while(<$df>) { 331 | if(/^total\s+([0-9.,MGTP]+)\s+([0-9.,MGTP]+)\s+([0-9.,MGTP]+)\s+([0-9]+%)/) { 332 | ($size,$used,$avail,$percent) = ($1,$2,$3,$4); 333 | $percent =~ s/\%//; 334 | 335 | if($percent >= 90) { 336 | $percent = sprintf("%s%%", fg(188, $percent)); 337 | } 338 | else { 339 | $percent = sprintf("%s%%", fg(172, fg('bold', $percent))); 340 | } 341 | 342 | for(($size,$used,$avail)) { 343 | #FIXME Make this a callable function 344 | s/([A-Z])//; 345 | my $notation = $1; 346 | next if(!defined($notation)); 347 | 348 | if($notation eq 'M') { 349 | $_ = sprintf("%s%s", $_, fg(45, $notation)); 350 | } 351 | elsif($notation eq 'G') { 352 | $_ = sprintf("%s%s", $_, fg(35, $notation)); 353 | } 354 | elsif($notation eq 'T') { 355 | $_ = sprintf("%s%s", $_, fg(71, $notation)); 356 | } 357 | } 358 | } 359 | } 360 | return($size) if($wanted eq 'size'); 361 | return($used) if($wanted eq 'used'); 362 | return($avail) if($wanted eq 'avail'); 363 | return($percent) if($wanted eq 'percent'); 364 | return(-1); 365 | } 366 | 367 | sub get_mem { 368 | my $wanted = shift; 369 | my ($total,$free,$buffers,$cached) = undef; 370 | if(!defined($wanted)) { 371 | $wanted = 'free'; 372 | } 373 | if($^O =~ /.*bsd$/) { 374 | open(my $un, '-|', 'sysctl -a') or warn($!); 375 | while(<$un>) { 376 | if(/^hw.realmem:\s+([0-9]+)/) { 377 | $total = to_mb($1/1024); 378 | } 379 | elsif(/^hw.usermem:\s+([0-9]+)/) { 380 | $free = to_mb($1/1024); 381 | } 382 | } 383 | } 384 | else { 385 | open(my $fh, '<', '/proc/meminfo') or warn($!); 386 | while(<$fh>) { 387 | if(/^MemTotal:\s+([0-9]+)\s+/) { 388 | $total = to_mb($1); 389 | } 390 | elsif(/^MemFree:\s+([0-9]+)\s+/) { 391 | $free = to_mb($1); 392 | } 393 | elsif(/^Buffers:\s+([0-9]+)\s+/) { 394 | $buffers = to_mb($1); 395 | } 396 | elsif(/^Cached:\s+([0-9]+)/) { 397 | $cached = to_mb($1); 398 | } 399 | } 400 | } 401 | my $avail = $free + ($buffers + $cached); 402 | my $used = $total - $avail; 403 | return($avail) if($wanted eq 'avail'); 404 | return($used) if($wanted eq 'used'); 405 | return($total) if($wanted eq 'total'); 406 | } 407 | 408 | sub to_mb { 409 | my $kb = shift; 410 | return(sprintf("%d",$kb/1024)); 411 | } 412 | 413 | sub get_uptime { 414 | if(-e '/proc/uptime') { 415 | return &get_uptime_procfs; 416 | } 417 | else { 418 | return &get_uptime_uptime; 419 | } 420 | } 421 | 422 | sub get_uptime_uptime { 423 | my $wanted = shift; 424 | if(!defined($wanted)) { 425 | $wanted = 'days'; 426 | } 427 | chomp(my $uptime = `uptime`); 428 | #my $uptime = ' 20:27:42 up 14:52, 2 users, load average: 0.07, 0.11'; 429 | $uptime =~ s/.+ up //; 430 | 431 | my ($days,$mins) = split(/,/, $uptime, 3); 432 | if($days =~ /min/) { # no days 433 | $mins = $days; 434 | $days = 0; 435 | } 436 | 437 | #FIXME 438 | $days =~ s/^\s+//; 439 | $days =~ s/\s+\S+//; # remove 'days' 440 | $mins =~ s/^\s+//; # really HH::MM 441 | 442 | 443 | if($days =~ /:/) { # no days 444 | $mins = $days; 445 | $days = 0; 446 | } 447 | 448 | my ($hours) = $mins =~ m/(\d+):/; 449 | $hours = 0 unless(defined($hours)); 450 | 451 | # NOTE needs more testing 452 | if(defined($hours)) { 453 | $mins =~ s/$hours://; # ugly 454 | } 455 | 456 | $mins =~ s/\smins//; 457 | 458 | return($days) if($wanted eq 'days'); 459 | return($hours) if($wanted eq 'hours'); 460 | return($mins) if($wanted eq 'mins'); 461 | } 462 | 463 | sub get_uptime_procfs { 464 | my ($up, $idle); 465 | open(FILE, ') { 467 | chomp; 468 | ($up, $idle) = split('\s'); 469 | } 470 | close(FILE); 471 | my $return = sprintf('%d days, %d hours, %d mins, %d secs', 472 | int($up/(24*60*60)), 473 | ($up/(60*60))%24, 474 | ($up/60)%60, 475 | ($up%60) 476 | ); 477 | 478 | my $days = int($up/(24*60*60)); 479 | my $hours = ($up/(60*60))%24; 480 | my $mins = ($up/60)%60; 481 | my $secs = $up%60; 482 | 483 | my $wanted = shift; 484 | if(!defined($wanted)) { 485 | $wanted = 'days'; 486 | } 487 | 488 | return($days) if($wanted eq 'days'); 489 | return($hours) if($wanted eq 'hours'); 490 | return($mins) if($wanted eq 'mins'); 491 | } 492 | 493 | sub get_no_users { 494 | my %users; 495 | 496 | my $u = ''; 497 | if($^O eq 'cygwin') { 498 | # Only XP Pro and later 499 | chomp($u = `cmd /c wmic ComputerSystem Get UserName | grep -v UserName | head -1`); 500 | } 501 | else { 502 | chomp($u = `users`); 503 | } 504 | map { $users{$_}++ } split(/ /, $u); 505 | 506 | my @output; 507 | for my $who(sort{ $users{$b} <=> $users{$a} } keys(%users)) { 508 | push(@output, sprintf("%s (%s)", 509 | ($who eq $ENV{USER}) 510 | ? fg('orange2', fg('bold', $who)) 511 | : $who 512 | , fg('blue4', $users{$who}), 513 | )); 514 | } 515 | return join(', ', @output); 516 | } 517 | 518 | sub get_shell { 519 | my $shell = $ENV{SHELL}; 520 | return(-1) unless(defined($shell)); 521 | $shell =~ s;.+/(.+)$;$1;; 522 | return($shell); 523 | } 524 | 525 | sub get_terminal { return($ENV{TERM}); } 526 | 527 | sub get_cpu { 528 | my $cpu = undef; 529 | if($^O =~ /.*bsd$/) { 530 | chomp($cpu = `sysctl -a | grep hw.model`); 531 | $cpu =~ s/^hw.model:\s//; 532 | $cpu =~ s/\s{2,}/ /; 533 | } 534 | else { 535 | chomp($cpu = `uname -p`); 536 | } 537 | if(!defined($cpu) or($cpu eq 'unknown')) { # ARMs seems to be 'unknown' 538 | open(my $fh, '<', '/proc/cpuinfo') or die($!); 539 | my @cpuinfo = <$fh>; 540 | close($fh); 541 | 542 | for(@cpuinfo) { 543 | if(/^Processor\s+:\s+(.+)/ or /^model\sname\s+:\s+(.+)/) { 544 | $cpu = $1; 545 | last; 546 | } 547 | } 548 | } 549 | return($cpu); 550 | } 551 | 552 | sub print_out { 553 | my $color = $default_colorscheme; 554 | my $logo = $default_logo; 555 | 556 | open(my $fh, '<', $logo) or return(["No logo found, tried '$logo': $!"]); 557 | my @logo = <$fh>; 558 | close($fh); 559 | 560 | if(exists($colorschemes{$color})) { 561 | $color = $colorschemes{$color}; 562 | } 563 | else { 564 | $color = $colorschemes{ansi}; 565 | } 566 | 567 | @$color = shuffle(@$color) if($randomize_colors); 568 | 569 | #FIXME 570 | my $f = join('', @logo); 571 | @logo = split(/\n/, $f); 572 | #FIXME 573 | 574 | return(\@logo); 575 | } 576 | 577 | sub colorme { 578 | my @foo = @_; 579 | my $f = join('', @foo); 580 | my @data = split(//, $f); 581 | my @toreturn; 582 | 583 | my $colorizer = undef; 584 | if(exists($colorschemes{$default_colorscheme})) { 585 | $colorizer = $colorschemes{$default_colorscheme}; 586 | } 587 | else { 588 | $colorizer = $colorschemes{ansi}; 589 | } 590 | 591 | @$colorizer = shuffle(@$colorizer) if($randomize_colors); 592 | 593 | my $i = 0; 594 | for(@data) { 595 | if($i == scalar(@$colorizer)-1) { 596 | $i = 0; 597 | } 598 | if($_ eq '') { 599 | push(@toreturn, "$_"); 600 | } 601 | else { 602 | push(@toreturn, "\e[38;5;@$colorizer[$i]" . 'm' . $_ . "\e[0m"); 603 | } 604 | $i++; 605 | } 606 | return(@toreturn); 607 | } 608 | 609 | sub get_wm { 610 | my $active_wm = 'Unknown'; 611 | my %wm_list = ( 612 | ratpoison => 'Ratpoison', 613 | catpoison => 'Catpoison', 614 | stumpwm => 'StumpWM', 615 | 'stumpwm.bin' => 'StumpWM', 616 | dwm => 'dwm', 617 | wmii => 'wmii', 618 | i3 => 'i3', 619 | openbox => 'Openbox', 620 | fluxbox => 'Fluxbox', 621 | blackbox => 'Blackbox', 622 | fvwm => 'FVWM', 623 | enlightenment => 'Enlightenment', 624 | icewm => 'IceWM', 625 | pekwm => 'PekWM', 626 | musca => 'Musca', 627 | wmaker => 'WindowMaker', 628 | metacity => 'Metacity', 629 | kwin => 'Kwin', 630 | xfwm4 => 'Xfwm4', 631 | beryl => 'beryl', 632 | compiz => 'Compiz', 633 | 'hildon-desktop' => 'Matchbox', 634 | WMFS => 'WMFS', 635 | 'xfce4-session' => 'Xfce', 636 | ksmserver => 'KDE', 637 | 'gnome-session-b' => 'GNOME', 638 | sawfish => 'Sawfish', 639 | ion3 => 'Ion3', 640 | notion => 'Notion', 641 | herbstluftwm => 'Herbstluft', 642 | monsterwm => 'monsterwm', 643 | 'xmonad-x86_64-l' => 'Xmonad', 644 | 'xmonad-x86-l' => 'Xmonad', 645 | 'bspwm' => 'bspwm', 646 | 647 | # NOTE Not sure of their processes 648 | 'xmonad' => 'Xmonad', # uses . prefixes ? 649 | 'evil-wm' => 'EvilWM', 650 | 'scrot-wm' => 'ScrotWM', 651 | tritium => 'Tritium', 652 | euclid => 'Euclid', 653 | echinus => 'Echinus', 654 | jwm => 'JWM', 655 | twm => 'TWM', 656 | ); 657 | my %rev_wm = reverse(%wm_list); 658 | 659 | my $ps = undef; 660 | if($^O =~ /.*bsd$/) { 661 | open($ps, '-|', 'ps -A|awk \'{print $5}\'') or(warn($!)); # ugly 662 | } 663 | elsif($^O eq 'cygwin') { 664 | open($ps, '-|', 'ps -a|awk \'{gsub(/\/.*\//,"",$8); print $8}\'') or(warn($!)); # _very_ ugly 665 | } 666 | else { 667 | open($ps, '-|', 'ps -A|awk \'{print $4}\'') or(warn($!)); # ugly 668 | } 669 | chomp(my @processes = <$ps>); 670 | close($ps); 671 | 672 | for my $process(@processes) { 673 | if(exists $wm_list{$process}) { 674 | $active_wm = $wm_list{$process}; 675 | last; 676 | } 677 | } 678 | return($active_wm); 679 | } 680 | 681 | sub get_os { 682 | if(-e '/etc/arch-release') { 683 | return("GNU/Linux (Arch Linux)"); 684 | } 685 | elsif(-e '/usr/bin/crux') { 686 | return("GNU/Linux (CRUX)"); 687 | } 688 | elsif(-e '/etc/grml-version') { 689 | open FILE, "); 691 | $line =~ s/\s\[[-0-9]+\]//; 692 | close FILE; 693 | return("GNU/Linux (${line})"); 694 | } 695 | elsif(-e '/etc/debian_version') { 696 | open FILE, "); 698 | close FILE; 699 | return("GNU/Linux (Debian ${line})"); 700 | } 701 | elsif(-e '/etc/sabayon-edition') { 702 | open FILE, "); 704 | $line=~ s/^.*?(\w+)[.!?]?\s*$/$1/; 705 | close FILE; 706 | return("GNU/Linux (Sabayon ${line})"); 707 | } 708 | elsif(-e '/etc/gentoo-release') { 709 | open FILE, "); 711 | close FILE; 712 | return("GNU/Linux ($line)"); 713 | } 714 | elsif($^O eq 'linux') { 715 | return("GNU/Linux"); # be nice 716 | } 717 | elsif($^O eq 'freebsd') { 718 | return("FreeBSD"); 719 | } 720 | elsif($^O eq 'cygwin') { 721 | my $ver = `echo \`cmd /c ver\``; 722 | $ver =~ s/^.*\[Version (.*)\].*$/$1/; 723 | my $win = ''; 724 | # Windows version numbering: major.minor.build 725 | # where major.minor corresponds to the name of the OS, and build changes 726 | # for different releases under the same name. 727 | if($ver =~ /^4\.0\./) { $win = 'NT 4.0'; } 728 | elsif($ver =~ /^4\.00/) { $win = '95'; } 729 | elsif($ver =~ /^4\.10/) { $win = '98'; } 730 | elsif($ver =~ /^5\.0/) { $win = '2000'; } 731 | elsif($ver =~ /^5\.1/) { $win = 'XP'; } 732 | elsif($ver =~ /^5\.2/) { $win = 'XP 64'; } 733 | elsif($ver =~ /^6\.0/) { $win = 'Vista'; } 734 | elsif($ver =~ /^6\.1/) { $win = '7'; } 735 | elsif($ver =~ /^6\.2/) { $win = '8'; } 736 | return("Windows $win (Cygwin)"); 737 | } 738 | else { 739 | return("Unknown"); 740 | } 741 | } 742 | 743 | sub available_colorschemes { 744 | print "$_\n" for(sort(keys(%colorschemes))); 745 | exit(0); 746 | } 747 | 748 | my $output = print_out($default_colorscheme, $default_logo); 749 | my $long = longest(@$output); 750 | 751 | 752 | @$output[0] = sprintf( 753 | "%-${long}s %12s: %s", @$output[0], 'OS', 754 | ucfirst(get_os()), 755 | ); 756 | 757 | @$output[1] = sprintf( 758 | "%-${long}s %12s: %s", @$output[1], 'Kernel', 759 | get_kernel(), 760 | ); 761 | 762 | @$output[2] = sprintf( 763 | "%-${long}s %12s: %s", @$output[2], 'WM', 764 | ucfirst(get_wm()), 765 | ); 766 | 767 | @$output[3] = sprintf( 768 | "%-${long}s %12s: %s", @$output[3], 'Theme', 769 | ucfirst(get_gtk_info()), 770 | ); 771 | 772 | @$output[4] = sprintf( 773 | "%-${long}s %12s: %s", @$output[4], 'Icons', 774 | ucfirst(get_gtk_info('icons')), 775 | ); 776 | 777 | @$output[5] = sprintf( 778 | "%-${long}s %12s: %s", @$output[5], 'Font', 779 | ucfirst(get_gtk_info('font')), 780 | ); 781 | 782 | @$output[6] = sprintf( 783 | "%-${long}s %12s: %s", @$output[6], 'Toolbar', 784 | get_gtk_info('toolbar'), 785 | ); 786 | 787 | 788 | my $used = get_disk_total('used'); 789 | my $total = get_disk_total('size'); 790 | my $percent_full = get_disk_total('percent'); 791 | $percent_full =~ s/\%//g; 792 | $percent_full = color_by_value($percent_full); 793 | 794 | @$output[7] = sprintf( 795 | "%-${long}s %12s: %s/%s used (%s%%)", @$output[7], 'Disk', 796 | $used, 797 | $total, 798 | $percent_full, 799 | ); 800 | 801 | @$output[8] = sprintf( 802 | "%-${long}s %12s: %s", @$output[8], 'Processes', 803 | get_no_proc(), 804 | ); 805 | 806 | @$output[9] = sprintf( 807 | "%-${long}s %12s: %sM/%sM used", @$output[9], 'Memory', 808 | fg(220, fg('bold', get_mem('used'))), 809 | fg(244, fg('bold', get_mem('total'))), 810 | ); 811 | 812 | @$output[10] = sprintf( 813 | "%-${long}s %12s: %s days, %s hours and %s minutes", @$output[10], 'Uptime', 814 | fg(196, fg('bold', get_uptime('days'))), 815 | fg(178, get_uptime('hours')), 816 | fg(100, get_uptime('mins')), 817 | ); 818 | 819 | @$output[11] = sprintf( 820 | "%-${long}s %12s: %s %s", @$output[11], 'Users', 821 | get_no_users() 822 | ); 823 | @$output[12] = sprintf( 824 | "%-${long}s %12s: %s %s", @$output[12], 'Shell', 825 | get_shell(), 826 | ); 827 | @$output[13] = sprintf( 828 | "%-${long}s %12s: %s %s", @$output[13], 'Terminal', 829 | get_terminal(), 830 | ); 831 | @$output[14] = sprintf( 832 | "%-${long}s %12s: %s %s", @$output[14], 'CPU', 833 | get_cpu, 834 | ); 835 | @$output[15] = sprintf( 836 | "%-${long}s %12s: %s %s", @$output[15],'Music', 837 | $now_playing->(), 838 | ); 839 | 840 | my $hostname = sprintf( 841 | "%-${long}s %32s@{[fg('bold', '@')]}%s",'', 842 | fg(178, $ENV{USER}), 843 | fg(240, fg('bold', `hostname`)), 844 | ); 845 | 846 | print $hostname; 847 | 848 | for(@$output) { 849 | # Ugliest hack ever... FIXME 850 | # fsck, it works just fine. No one likes ws anyway 851 | if(/(.+)\s+([A-Za-z]+: .+)/) { 852 | print colorme($1), $2, "\n"; 853 | } 854 | else { 855 | print colorme($_),"\n"; 856 | } 857 | } 858 | if($opt_shot) { 859 | #FIXME - scrot, import... 860 | my($s, $m, $h, $d, $month, $y) = localtime(time()); 861 | $y += 1900; 862 | $month = sprintf("%02d", $month+1); 863 | $m = sprintf("%02d", $m); 864 | $s = sprintf("%02d", $s); 865 | system('scrot', "$y-$month-$d-$h$m$s-screenfo.png") == 0 or(warn($!)); 866 | exit(0); 867 | } 868 | 869 | sub color_by_value { 870 | my $value = shift; 871 | 872 | return fg('green15', $value) if $value <= 10; 873 | return fg('green17', $value) if $value <= 15; 874 | return fg('green19', $value) if $value <= 20; 875 | return fg('green21', $value) if $value <= 25; 876 | return fg('green23', $value) if $value <= 30; 877 | 878 | return fg('yellow8', $value) if $value <= 35; 879 | return fg('yellow9', $value) if $value <= 40; 880 | return fg('yellow10', $value) if $value <= 45; 881 | return fg('yellow13', $value) if $value <= 50; 882 | return fg('yellow15', $value) if $value <= 55; 883 | return fg('yellow17', $value) if $value <= 60; 884 | 885 | return fg('red5', $value) if $value <= 60; 886 | return fg('red4', $value) if $value <= 65; 887 | return fg('red3', $value) if $value <= 70; 888 | return fg('red2', $value) if $value <= 85; 889 | return fg('red1', $value) if $value <= 80; 890 | } 891 | 892 | 893 | 894 | =pod 895 | 896 | =head1 NAME 897 | 898 | screenfo - screenshot information tool for nerds 899 | 900 | =head1 SYNOPSIS 901 | 902 | screenfo [OPTION]... 903 | 904 | =head1 DESCRIPTION 905 | 906 | Everybody likes 'The monthly screenshot thread' where one is supposed to show 907 | off their latest setup. 908 | 909 | Nobody likes screenshots that look awesome, but where there's no information 910 | at all available. 911 | 912 | B outputs a load of system information, including the running window 913 | manager, GTK theme, icons, fonts, shell, terminal emulator, and much more, 914 | while taking the screenshot. 915 | 916 | =head1 OPTIONS 917 | 918 | -c, --color specify colorscheme to use 919 | -l, --list list available colorschemes 920 | -a, --ascii specify ascii art to use 921 | -r, --random randomize the colors 922 | -s --shot take screenshot 923 | 924 | -d, --debug run some tests and exit 925 | -h, --help show help and exit 926 | -m, --man show the manpage and exit 927 | -v, --version show version info and exit 928 | 929 | =head1 ENVIRONMENT 930 | 931 | The configuration file is searched for in the following places: 932 | 933 | $XDG_CONFIG_HOME/screenfo/screenfo.conf 934 | $HOME/.config/screenfo/screenfo.conf 935 | $HOME/.screenfo.conf 936 | $HOME/screenfo.conf 937 | ./screenfo.conf 938 | /etc/screenfo.conf 939 | 940 | The files in the ascii/ directory is searched for in in the following places: 941 | 942 | $XDG_DATA_HOME/screenfo/ascii 943 | $XDG_CONFIG_HOME/screenfo/ascii 944 | $HOME/.local/share/screenfo/ascii 945 | $HOME/.screenfo/ascii 946 | ./ascii 947 | /usr/share/screenfo/ascii 948 | 949 | =head1 REQUIREMENTS 950 | 951 | Perl => 5.10 952 | 953 | Term::ExtendedColor, available from CPAN: 954 | 955 | cpan Term::ExtendedColor 956 | 957 | or github: L 958 | 959 | Some standard UNIX tools 960 | 961 | scrot for taking the actual screenshot 962 | 963 | =head1 AUTHOR 964 | 965 | Written by Magnus Woldrich 966 | 967 | =head1 REPORTING BUGS 968 | 969 | Report bugs to trapd00r\@trapd00r.se or use the issue tracker located at 970 | 971 | 972 | screenfo homepage: 973 | 974 | =head1 COPYRIGHT 975 | 976 | Copyright (C) 2010 Magnus Woldrich 977 | 978 | License: GPLv2 979 | 980 | =head1 HISTORY 981 | 982 | Lets quote the Arch Linux user B from a post on the BBS, late 2006: 983 | 984 | OK, all the time in the screenshots thread we get "What gtk theme is that?", 985 | "What is that in the corner?", blah blah blah. 986 | Now, while we try to encourage people to post that with their screenie why 987 | don't we make a simple script that grabs info from from the gtkrc's, .xinitrc, 988 | etc, and outputs into a nice cowsay-like soundbite? 989 | 990 | Couple days later, user B made the first Perl version simply named 991 | 'info.pl'. There were a lot of people in the community helping out, 992 | making it better, bigger, more complicated and virtually unmaintainable since 993 | absolutely no modularization or subroutines were used. 994 | 995 | People realized this and started to make their own versions in Bash and Python. 996 | 997 | My intent was to fork the original project, clean it up and make it 998 | maintainable, but that was no fun. Therefore, B was born. 999 | 1000 | =head1 THANKS 1001 | 1002 | I'd like to thank the Archlinux community for being awesome, B for 1003 | providing some ASCII art that I stole without asking, and B for coming up 1004 | with this awesome name. 1005 | 1006 | =head1 SEE ALSO 1007 | 1008 | The original post: 1009 | 1010 | =cut 1011 | 1012 | # vim: set et sw=2 ts=2 sts=2: 1013 | -------------------------------------------------------------------------------- /screenfo.conf: -------------------------------------------------------------------------------- 1 | use strict; 2 | =head1 SYNOPSIS 3 | 4 | This is the screenfo configuration file. 5 | I should be placed in either /etc/screenfo.conf or 6 | $XDG_CONFIG_HOME/screenfo/screenfo.conf 7 | 8 | =cut 9 | 10 | our $color_support = 256; 11 | our $default_colorscheme = 'pink'; 12 | our $default_logo = 'arch'; 13 | our $randomize_colors = 0; 14 | 15 | our @df_exclude = qw/rootfs devtmpfs tmpfs cgroup_root shm/; 16 | 17 | # A coderef that'll return the now playing information when executed 18 | 19 | our $now_playing = sub { return('Not configured'); }; 20 | 21 | ## MPD Example 22 | #our $now_playing = sub { 23 | # my $host = '192.168.1.100'; # host MPD server is running on 24 | # chomp(my $np = `mpc -h $host --format "%artist% - %title%"|head -1`); 25 | # if($np and $np !~ /mpc not found/) { 26 | # return($np); 27 | # } 28 | # else { 29 | # return("MPD: Not running"); 30 | # } 31 | #}; 32 | 33 | our %colorschemes = ( 34 | ansi => [0..15], 35 | all => [17..255], 36 | grey => [233..250], 37 | white => [255,254,253,252,251,250,249,248], 38 | red => [52,88,124,160,196], 39 | blue => [17,18,19,20,21,24,25,26,27,31,32,33,37,38,250,249,248,247], 40 | green => [22,28,34,40,46,76,100,106], 41 | pink => [53,54,55,56,57,89,90,91,92,93, 42 | 125,126,127,128,129,161,162,163,164,165,197,198,199, 43 | 200,201 44 | ], 45 | yellow => [142,148,154,172, 190, 214,82, 208,220, 226], 46 | fire => [226,220,214,208,202,196,190,184,178,172,166,160,154, 47 | 148,142,136,130,124,118,112,106,100,94,88,244,242 48 | ], 49 | pinkgrey => [53,54,55,56,57,89,90,91,92,93, 50 | 125,126,127,128,129,161,162,163,164,165,197,198,199, 51 | 200,201,233..243, 52 | ], 53 | orangegrey => [172,178,233..243,208,214,202], 54 | 55 | 56 | ); 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 1; 65 | # vim: set ft=perl tw=0: 66 | --------------------------------------------------------------------------------