-
Notifications
You must be signed in to change notification settings - Fork 7
/
ssig.pl
406 lines (380 loc) · 13.7 KB
/
ssig.pl
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
#!/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");