-
Notifications
You must be signed in to change notification settings - Fork 1
/
archey.py
executable file
·1721 lines (1369 loc) · 78.2 KB
/
archey.py
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
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python3
# Purpose: ####################################################################
# Show system information with an ASCII art representation of the operating #
# system logo. Designed to be included in login scripts. #
# #
###############################################################################
# License: ####################################################################
# This program is free software: you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation, either version 3 of the License, or (at your option) #
# any later version. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
###############################################################################
# History: ####################################################################
# Based on version 0.30, in turn based on version 0.2.8 - original notes: #
# Archey is a system information tool written in Python. #
# Maintained by Melik Manukyan <[email protected]> #
# ASCII art by Brett Bohnenkamper <[email protected]> #
# Changes Jerome Launay <[email protected]> #
# Fedora support by YeOK <[email protected]> #
# Updates 2016-2023 by Manganar <[email protected]> (changelog.md) #
# #
###############################################################################
# TODO: #######################################################################
# None. #
# #
###############################################################################
# Import libraries ############################################################
import os, sys, re
import psutil # Access process information
import glob # File wildcard support
import shlex # Split with quoted sub-strings
import datetime # To allow logging of run time
import tempfile # Identify temporary directory
import plistlib # Access Apple plist files
from subprocess import Popen, PIPE, DEVNULL, STDOUT
from optparse import OptionParser # Parse command line arguments
from getpass import getuser
from time import ctime, sleep, perf_counter
from pyparsing import * # Allow strip of ANSI sequences
from dotenv import dotenv_values # Parse environment variable file.
from enum import Enum # Enum for distro identification.
# Define the escape sequences used to show colour output. #####################
clear = '\x1b[0m'
blackN = '\x1b[0;30m'; blackB = '\x1b[1;30m'; blackH = '\x1b[90m'
redN = '\x1b[0;31m'; redB = '\x1b[1;31m'; redH = '\x1b[91m'
greenN = '\x1b[0;32m'; greenB = '\x1b[1;32m'; greenH = '\x1b[92m'
yellowN = '\x1b[0;33m'; yellowB = '\x1b[1;33m'; yellowH = '\x1b[93m'
blueN = '\x1b[0;34m'; blueB = '\x1b[1;34m'; blueH = '\x1b[94m'
magentaN = '\x1b[0;35m'; magentaB = '\x1b[1;35m'; magentaH = '\x1b[95m'
cyanN = '\x1b[0;36m'; cyanB = '\x1b[1;36m'; cyanH = '\x1b[96m'
whiteN = '\x1b[0;37m'; whiteB = '\x1b[1;37m'
# Background colours. #########################################################
bgBlack = "\x1b[40m"; bgRed = "\x1b[41m"; bgGreen = "\x1b[42m"
bgYellow = "\x1b[43m"; bgBlue = "\x1b[44m"; bgCyan = "\x1b[46m"
bgWhite = "\x1b[47m"
# Define Display Contents: Comment/Uncomment to Enable/Disable information. ###
display = [
'user', # Display Username
'hostname', # Display Machine Hostname
'distro', # Display Distribution
'pimodel', # Display the model of Pi
'kernel', # Display Kernel Version
'uptime', # Display System Uptime
'wm', # Display Window Manager
'de', # Display Desktop Environment
'sh', # Display Current Shell
'term', # Display Current Terminal
'packages', # Display No. of Packages Installed
'resolution', # Display Screen Resolution
'gpu', # Display GPU Model
'cpu', # Display CPU Model
'ram', # Display RAM Usage
'disk' # Display Disk Usage
]
# Define an enum to support distro identification. ############################
Distro = Enum("Distro", ['Arch', 'BunsenLabs', 'CrunchBang', 'CentOS',
'Debian', 'Elementary', 'Fedora', 'FreeBSD',
'Kubuntu', 'Linuxmint', 'MacOS', 'Manjaro',
'ManjaroARM', 'Neon', 'PopOS', 'Raspbian',
'Ubuntu', 'Zorin', 'Unknown'])
# Dictionary to support mapping distro string ID to the enum ID.
DistroEnumDict = {
'Arch' : Distro.Arch,
'Bunsenlabs' : Distro.BunsenLabs,
'Centos' : Distro.CentOS,
'CrunchBang' : Distro.CrunchBang,
'Debian' : Distro.Debian,
'Elementary' : Distro.Elementary,
'Fedora' : Distro.Fedora,
'Freebsd' : Distro.FreeBSD,
'Kubuntu' : Distro.Kubuntu,
'Linuxmint' : Distro.Linuxmint,
'MacOS' : Distro.MacOS,
'Manjaro' : Distro.Manjaro,
'Manjaro-ARM' : Distro.ManjaroARM,
'Neon' : Distro.Neon,
'Pop' : Distro.PopOS,
'Raspbian' : Distro.Raspbian,
'Ubuntu' : Distro.Ubuntu,
'Zorin' : Distro.Zorin
}
# Dictionary identifying desktop environments based on process names. #########
DesktopEnvironmentProcessDict = {
'cinnamon' : 'Cinnamon',
'dde-dock' : 'Deepin',
'fur-box-session' : 'Fur Box',
'gnome-session' : 'GNOME',
'gnome-shell' : 'GNOME',
'ksmserver' : 'KDE',
'lxqt-session' : 'LXQt',
'lxsession' : 'LXDE',
'mate-session' : 'MATE',
'xfce4-session' : 'Xfce'
}
# Dictionary identifying desktop environments based on XDG_CURRENT_DESKTOP. ###
DesktopEnvironmentShellVarDict = {
'X-Cinnamon' : 'Cinnamon',
'GNOME' : 'GNOME',
'pop:GNOME' : 'GNOME',
'ubuntu:GNOME' : 'GNOME',
'KDE' : 'KDE',
'LXDE' : 'LXDE',
'MATE' : 'MATE',
'Pantheon' : 'Pantheon',
'unity' : 'Unity',
'Unity' : 'Unity',
'XFCE' : 'Xfce'
}
# Dictionary defining the color to use for the field labels for each distro. ##
DistroColourDict = {
Distro.Arch : blueB,
Distro.BunsenLabs : whiteN,
Distro.CentOS : blueB,
Distro.CrunchBang : whiteN,
Distro.Debian : redB,
Distro.Elementary : blueB,
Distro.Fedora : blueB,
Distro.FreeBSD : redB,
Distro.Kubuntu : cyanB,
Distro.Linuxmint : greenB,
Distro.MacOS : yellowN,
Distro.Manjaro : greenB,
Distro.ManjaroARM : greenB,
Distro.Neon : blueB,
Distro.PopOS : cyanB,
Distro.Raspbian : redB,
Distro.Ubuntu : redB,
Distro.Zorin : cyanB
}
# Define the dictionary for identifying window managers. ######################
wm_dict = {
'awesome' : 'Awesome',
'beryl' : 'Beryl',
'blackbox' : 'Blackbox',
'compiz' : 'Compiz',
'dwm' : 'DWM',
'enlightenment' : 'Enlightenment',
'fluxbox' : 'Fluxbox',
'fvwm' : 'FVWM',
'gnome shell' : 'Mutter',
'i3' : 'i3',
'icewm' : 'IceWM',
'kwin' : 'KWin',
'metacity' : 'Metacity',
'musca' : 'Musca',
'mutter' : 'Mutter',
'mutter(gala)' : 'Gala',
'mutter (muffin)' : 'mutter (muffin)',
'openbox' : 'Openbox',
'pekwm' : 'PekWM',
'ratpoison' : 'Rat Poison',
'scrotwm' : 'ScrotWM',
'wmaker' : 'Window Maker',
'wmfs' : 'Wmfs',
'wmii' : 'Wmii',
'xfwm4' : 'Xfwm',
'xmonad' : 'Xmonad'
}
# Dictionary mapping revision code from /proc/cpuinfo to the Pi model (Code, GPU, Model).
# 0002 - 0015 for older Pi models, 2 - 23 for newer models.
RaspberryPiModelDict = {
"0002" : ["VideoCore IV", "B"],
"0003" : ["VideoCore IV", "B"],
"0004" : ["VideoCore IV", "B"],
"0005" : ["VideoCore IV", "B"],
"0006" : ["VideoCore IV", "B"],
"0007" : ["VideoCore IV", "A"],
"0008" : ["VideoCore IV", "A"],
"0009" : ["VideoCore IV", "A"],
"000d" : ["VideoCore IV", "B"],
"000e" : ["VideoCore IV", "B"],
"000f" : ["VideoCore IV", "B"],
"0010" : ["VideoCore IV", "B+"],
"0011" : ["VideoCore IV", "CM1"],
"0012" : ["VideoCore IV", "A+"],
"0013" : ["VideoCore IV", "B+"],
"0014" : ["VideoCore IV", "CM1"],
"0015" : ["VideoCore IV", "A+"],
2 : ['VideoCore IV', "A+"],
3 : ['VideoCore IV', "B+"],
4 : ['VideoCore IV', "2B"],
6 : ['VideoCore IV', "CM1"],
8 : ['VideoCore IV', "3B"],
9 : ['VideoCore IV', "Zero"],
10 : ['VideoCore IV', "CM3"],
12 : ['VideoCore IV', "Zero W"],
13 : ['VideoCore IV', "3B+"],
14 : ['VideoCore IV', "3A+"],
16 : ['VideoCore IV', "CM3+"],
17 : ['VideoCore VI', "4B"],
18 : ['VideoCore IV', "Zero 2 W"],
19 : ['VideoCore VI', "Pi 400"],
20 : ['VideoCore VI', "CM4"],
23 : ['VideoCore VII', "5"]
}
# Define the dictionary for identifying Mac OS version names. #################
MacOSVersion_dict = {
'10.4' : 'Mac OS X Tiger',
'10.5' : 'Mac OS X Leopard',
'10.6' : 'Mac OS X Snow Leopard',
'10.7' : 'Mac OS X Lion',
'10.8' : 'OS X Mountain Lion',
'10.9' : 'OS X Mavericks',
'10.10' : 'OS X Yosemite',
'10.11' : 'OS X El Capitan',
'10.12' : 'macOS Sierra',
'10.13' : 'macOS High Sierra',
'10.14' : 'macOS Mojave',
'10.15' : 'macOS Catalina',
'10.16' : 'macOS Big Sur',
'11.0' : 'macOS Big Sur'
}
# Set up global variables. ####################################################
result = [] # Results to show.
DistroID = Distro.Unknown # The distribution we are running on.
DistroTitle = "Unknown" # The display title of the distribution.
GlobalTerminal = "Unset" # Variable for "static" terminal ID.
# Define the correct logo for the specified distribution. #####################
def DefineDistroLogo(LogoID):
if LogoID == Distro.Ubuntu:
# Ubuntu Logo #################################################################
DistroLogo = [f"{redB} .-/+oossssoo+/-."]
DistroLogo.append(f"{redB} `:+ssssssssssssssssss+:`")
DistroLogo.append(f"{redB} -+ssssssssssssssssssyyssss+-")
DistroLogo.append(f"{redB} .ossssssssssssssssss{whiteB}dMMMNy{redB}sssso.")
DistroLogo.append(f"{redB} /sssssssssss{whiteB}hdmmNNmmyNMMMMh{redB}ssssss/")
DistroLogo.append(f"{redB} +sssssssss{whiteB}hm{redB}yd{whiteB}MMMMMMMNddddy{redB}ssssssss+")
DistroLogo.append(f"{redB} /ssssssss{whiteB}hNMMM{redB}yh{whiteB}hyyyyhmNMMMNh{redB}ssssssss/")
DistroLogo.append(f"{redB} .ssssssss{whiteB}dMMMNh{redB}ssssssssss{whiteB}hNMMMd{redB}ssssssss.")
DistroLogo.append(f"{redB} +ssss{whiteB}hhhyNMMNy{redB}ssssssssssss{whiteB}yNMMMy{redB}sssssss+")
DistroLogo.append(f"{redB} oss{whiteB}yNMMMNyMMh{redB}ssssssssssssss{whiteB}hmmmh{redB}ssssssso")
DistroLogo.append(f"{redB} oss{whiteB}yNMMMNyMMh{redB}sssssssssssssshmmmhssssssso")
DistroLogo.append(f"{redB} +ssss{whiteB}hhhyNMMNy{redB}ssssssssssss{whiteB}yNMMMy{redB}sssssss+")
DistroLogo.append(f"{redB} .ssssssss{whiteB}dMMMNh{redB}ssssssssss{whiteB}hNMMMd{redB}ssssssss.")
DistroLogo.append(f"{redB} /ssssssss{whiteB}hNMMM{redB}yh{whiteB}hyyyyhdNMMMNh{redB}ssssssss/")
DistroLogo.append(f"{redB} +sssssssss{whiteB}dm{redB}yd{whiteB}MMMMMMMMddddy{redB}ssssssss+")
DistroLogo.append(f"{redB} /sssssssssss{whiteB}hdmNNNNmyNMMMMh{redB}ssssss/")
DistroLogo.append(f"{redB} .ossssssssssssssssss{whiteB}dMMMNy{redB}sssso.")
DistroLogo.append(f"{redB} -+sssssssssssssssss{whiteB}yyy{redB}ssss+-")
DistroLogo.append(f"{redB} `:+ssssssssssssssssss+:`")
DistroLogo.append(f"{redB} .-/+oossssoo+/-.{clear}")
elif LogoID == Distro.Arch:
# Arch Logo ###################################################################
DistroLogo = [f"{blueB} +"]
DistroLogo.append(f"{blueB} #")
DistroLogo.append(f"{blueB} ###")
DistroLogo.append(f"{blueB} #####")
DistroLogo.append(f"{blueB} ######")
DistroLogo.append(f"{blueB} ; #####;")
DistroLogo.append(f"{blueB} +##.#####")
DistroLogo.append(f"{blueB} +##########")
DistroLogo.append(f"{blueB} #############;")
DistroLogo.append(f"{blueB} ###############+")
DistroLogo.append(f"{blueB} ####### #######")
DistroLogo.append(f"{blueB} .######; ;###;`\".")
DistroLogo.append(f"{blueB} .#######; ;#####.")
DistroLogo.append(f"{blueB} #########. .########`")
DistroLogo.append(f"{blueB} ######' '######")
DistroLogo.append(f"{blueB} ;#### ####;")
DistroLogo.append(f"{blueB} ##' '##")
DistroLogo.append(f"{blueB} #' `#{clear}")
elif LogoID in [Distro.Manjaro, Distro.ManjaroARM]:
# Manjaro Logo ################################################################
DistroLogo = [f"{greenB} ██████████████████ ████████"]
DistroLogo.append(f"{greenB} ██████████████████ ████████")
DistroLogo.append(f"{greenB} ██████████████████ ████████")
DistroLogo.append(f"{greenB} ██████████████████ ████████")
DistroLogo.append(f"{greenB} ████████ ████████")
DistroLogo.append(f"{greenB} ████████ ████████ ████████")
DistroLogo.append(f"{greenB} ████████ ████████ ████████")
DistroLogo.append(f"{greenB} ████████ ████████ ████████")
DistroLogo.append(f"{greenB} ████████ ████████ ████████")
DistroLogo.append(f"{greenB} ████████ ████████ ████████")
DistroLogo.append(f"{greenB} ████████ ████████ ████████")
DistroLogo.append(f"{greenB} ████████ ████████ ████████")
DistroLogo.append(f"{greenB} ████████ ████████ ████████")
DistroLogo.append(f"{greenB} ████████ ████████ ████████{clear}")
elif LogoID == Distro.Debian:
# New Version of Debian Logo ##################################################
DistroLogo = [f"{whiteB} _,met$$$$$gg."]
DistroLogo.append(f"{whiteB} ,g$$$$$$$$$$$$$$$P.")
DistroLogo.append(f"{whiteB} ,g$$P\" \"\"\"Y$$.\".")
DistroLogo.append(f"{whiteB} ,$$P' `$$$.")
DistroLogo.append(f"{whiteB} ',$$P ,ggs. `$$b:")
DistroLogo.append(f"{whiteB} `d$$' ,$P\"' {redB}.{whiteB} $$$")
DistroLogo.append(f"{whiteB} $$P d$' {redB},{whiteB} $$P")
DistroLogo.append(f"{whiteB} $$: $$. {redB}-{whiteB} ,d$$'")
DistroLogo.append(f"{whiteB} $$; Y$b._ _,d$P'")
DistroLogo.append(f"{whiteB} Y$$. {redB}`.{whiteB}`\"Y$$$$P\"'")
DistroLogo.append(f"{whiteB} `$$b {redB}\"-.__")
DistroLogo.append(f"{whiteB} `Y$$")
DistroLogo.append(f"{whiteB} `Y$$.")
DistroLogo.append(f"{whiteB} `$$b.")
DistroLogo.append(f"{whiteB} `Y$$b.")
DistroLogo.append(f"{whiteB} `\"Y$b._")
DistroLogo.append(f"{whiteB} `\"\"\"{clear}")
elif LogoID == Distro.Fedora:
# Fedora Logo #################################################################
DistroLogo = [f"{blueN} :/------------://"]
DistroLogo.append(f"{blueN} :------------------://")
DistroLogo.append(f"{blueN} :-----------{whiteB}/shhdhyo/{blueN}-://")
DistroLogo.append(f"{blueN} /-----------{whiteB}omMMMNNNMMMd/{blueN}-:/")
DistroLogo.append(f"{blueN} :-----------{whiteB}sMMMdo:/{blueN} -:/")
DistroLogo.append(f"{blueN} :-----------{whiteB}:MMMd{blueN}------- --:/")
DistroLogo.append(f"{blueN} /-----------{whiteB}:MMMy{blueN}------- ---/")
DistroLogo.append(f"{blueN} :------ --{whiteB}/+MMMh/{blueN}-- ---:")
DistroLogo.append(f"{blueN} :--- {whiteB}oNMMMMMMMMMNho{blueN} -----:")
DistroLogo.append(f"{blueN} :-- {whiteB}+shhhMMMmhhy++{blueN} ------:")
DistroLogo.append(f"{blueN} :- -----{whiteB}:MMMy{blueN}--------------/")
DistroLogo.append(f"{blueN} :- ------{whiteB}/MMMy{blueN}-------------:")
DistroLogo.append(f"{blueN} :- ----{whiteB}/hMMM+{blueN}------------:")
DistroLogo.append(f"{blueN} :--{whiteB}:dMMNdhhdNMMNo{blueN}-----------:")
DistroLogo.append(f"{blueN} :---{whiteB}:sdNMMMMNds:{blueN}----------:")
DistroLogo.append(f"{blueN} :------{whiteB}:://:{blueN}-----------://")
DistroLogo.append(f"{blueN} :--------------------://{clear}")
elif LogoID == Distro.CrunchBang:
# CrunchBang Logo #############################################################
DistroLogo = [f"{whiteN} ___ ___ _"]
DistroLogo.append(f"{whiteN} / / / / | |")
DistroLogo.append(f"{whiteN} / / / / | |")
DistroLogo.append(f"{whiteN} / / / / | |")
DistroLogo.append(f"{whiteN} _______/ /______/ /______ | |")
DistroLogo.append(f"{whiteN} /______ _______ _______/ | |")
DistroLogo.append(f"{whiteN} / / / / | |")
DistroLogo.append(f"{whiteN} / / / / | |")
DistroLogo.append(f"{whiteN} / / / / | |")
DistroLogo.append(f"{whiteN} ______/ /______/ /______ | |")
DistroLogo.append(f"{whiteN} /_____ _______ _______/ | |")
DistroLogo.append(f"{whiteN} / / / / | |")
DistroLogo.append(f"{whiteN} / / / / |_|")
DistroLogo.append(f"{whiteN} / / / / _ ")
DistroLogo.append(f"{whiteN} / / / / | |")
DistroLogo.append(f"{whiteN} /__/ /__/ |_|{clear}")
elif LogoID == Distro.BunsenLabs:
# BunsenLabs Logo #############################################################
DistroLogo = [f"{whiteN} `++"]
DistroLogo.append(f"{whiteN} -yMMs")
DistroLogo.append(f"{whiteN} `yMMMMN`")
DistroLogo.append(f"{whiteN} -NMMMMMMm.")
DistroLogo.append(f"{whiteN} :MMMMMMMMMN-")
DistroLogo.append(f"{whiteN} .NMMMMMMMMMMM/")
DistroLogo.append(f"{whiteN} yMMMMMMMMMMMMM/")
DistroLogo.append(f"{whiteN}`MMMMMMNMMMMMMMN.")
DistroLogo.append(f"{whiteN}-MMMMN+ /mMMMMMMy")
DistroLogo.append(f"{whiteN}-MMMm` `dMMMMMM")
DistroLogo.append(f"{whiteN}`MMN. .NMMMMM.")
DistroLogo.append(f"{whiteN} hMy yMMMMM`")
DistroLogo.append(f"{whiteN} -Mo +MMMMN")
DistroLogo.append(f"{whiteN} /o +MMMMs")
DistroLogo.append(f"{whiteN} +MMMN`")
DistroLogo.append(f"{whiteN} hMMM:")
DistroLogo.append(f"{whiteN} `NMM/")
DistroLogo.append(f"{whiteN} +MN:")
DistroLogo.append(f"{whiteN} mh.")
DistroLogo.append(f"{whiteN} -/{clear}")
elif LogoID == Distro.Linuxmint:
# Linux Mint Logo #############################################################
DistroLogo = [f"{whiteB} MMMMMMMMMMMMMMMMMMMMMMMMMmds+."]
DistroLogo.append(f"{whiteB} MMm----::-://////////////oymNMd+`")
DistroLogo.append(f"{whiteB} MMd {greenB}/++ {whiteB}-sNMd:")
DistroLogo.append(f"{whiteB} MMNso/` {greenB}dMM `.::-. .-::.` {whiteB}.hMN:")
DistroLogo.append(f"{whiteB} ddddMMh {greenB}dMM :hNMNMNhNMNMNh: `{whiteB}NMm")
DistroLogo.append(f"{whiteB} NMm {greenB}dMM .NMN/-+MMM+-/NMN` {whiteB}dMM")
DistroLogo.append(f"{whiteB} NMm {greenB}dMM -MMm `MMM dMM. {whiteB}dMM")
DistroLogo.append(f"{whiteB} NMm {greenB}dMM -MMm `MMM dMM. {whiteB}dMM")
DistroLogo.append(f"{whiteB} NMm {greenB}dMM .mmd `mmm yMM. {whiteB}dMM")
DistroLogo.append(f"{whiteB} NMm {greenB}dMM` ..` ... ydm. {whiteB}dMM")
DistroLogo.append(f"{whiteB} hMM- {greenB}+MMd/-------...-:sdds {whiteB}MMM")
DistroLogo.append(f"{whiteB} -NMm- {greenB}:hNMNNNmdddddddddy/` {whiteB}dMM")
DistroLogo.append(f"{whiteB} -dMNs-``{greenB}-::::-------.`` {whiteB}dMM")
DistroLogo.append(f"{whiteB} `/dMNmy+/:-------------:/yMMM")
DistroLogo.append(f"{whiteB} ./ydNMMMMMMMMMMMMMMMMMMMMM{clear}")
elif LogoID == Distro.Raspbian:
# Raspbian Logo ###############################################################
DistroLogo = [f"{greenB} `.::///+:/-. --///+//-:``"]
DistroLogo.append(f"{greenB} `+oooooooooooo: `+oooooooooooo:")
DistroLogo.append(f"{greenB} /oooo++//ooooo: ooooo+//+ooooo.")
DistroLogo.append(f"{greenB} `+ooooooo:-:oo- +o+::/ooooooo:")
DistroLogo.append(f"{greenB} `:oooooooo+`` `.oooooooo+-")
DistroLogo.append(f"{greenB} `:++ooo/. :+ooo+/.`")
DistroLogo.append(f"{redB} ...` `.----.` ``..")
DistroLogo.append(f"{redB} .::::-``:::::::::.`-:::-`")
DistroLogo.append(f"{redB} -:::-` .:::::::-` `-:::-")
DistroLogo.append(f"{redB} `::. `.--.` `` `.---.``.::`")
DistroLogo.append(f"{redB} .::::::::` -::::::::` `")
DistroLogo.append(f"{redB} .::` .:::::::::- `::::::::::``::.")
DistroLogo.append(f"{redB} -:::` ::::::::::. ::::::::::.`:::-")
DistroLogo.append(f"{redB} :::: -::::::::. `-:::::::: ::::")
DistroLogo.append(f"{redB} -::- .-:::-.``....``.-::-. -::-")
DistroLogo.append(f"{redB} .. `` .::::::::. `..`..")
DistroLogo.append(f"{redB} -:::-` -::::::::::` .:::::`")
DistroLogo.append(f"{redB} :::::::` -::::::::::` :::::::.")
DistroLogo.append(f"{redB} .::::::: -::::::::. ::::::::")
DistroLogo.append(f"{redB} `-:::::` ..--.` ::::::.")
DistroLogo.append(f"{redB} `...` `...--..` `...`")
DistroLogo.append(f"{redB} .::::::::::")
DistroLogo.append(f"{redB} `.-::::-`{clear}")
elif LogoID == Distro.Zorin:
# Zorin Logo ##################################################################
DistroLogo = [f"{blueN} `osssssssssssssssssssso`"]
DistroLogo.append(f"{blueN} .osssssssssssssssssssssso.")
DistroLogo.append(f"{blueN} .+oooooooooooooooooooooooo+.")
DistroLogo.append(f"{blueN}")
DistroLogo.append(f"{blueN}")
DistroLogo.append(f"{blueN} `::::::::::::::::::::::. .:`")
DistroLogo.append(f"{blueN} `+ssssssssssssssssss+:.` `.:+ssso`")
DistroLogo.append(f"{blueN} .ossssssssssssssso/. `-+ossssssso.")
DistroLogo.append(f"{blueN} ssssssssssssso/-` `-/osssssssssssss")
DistroLogo.append(f"{blueN} .ossssssso/-` .-/ossssssssssssssso.")
DistroLogo.append(f"{blueN} `+sss+:. `.:+ssssssssssssssssss+`")
DistroLogo.append(f"{blueN} `:. .::::::::::::::::::::::`")
DistroLogo.append(f"{blueN}")
DistroLogo.append(f"{blueN}")
DistroLogo.append(f"{blueN} .+oooooooooooooooooooooooo+.")
DistroLogo.append(f"{blueN} -osssssssssssssssssssssso-")
DistroLogo.append(f"{blueN} `osssssssssssssssssssso`{clear}")
elif LogoID == Distro.Kubuntu:
# Kubuntu Logo ################################################################
DistroLogo = [f"{blueN} `.:/ossyyyysso/:."]
DistroLogo.append(f"{blueN} .:oyyyyyyyyyyyyyyyyyyo:`")
DistroLogo.append(f"{blueN} -oyyyyyyyo{whiteB}dMMy{blueN}yyyyyyysyyyyo-")
DistroLogo.append(f"{blueN} -syyyyyyyyyy{whiteB}dMMy{blueN}oyyyy{whiteB}dmMMy{blueN}yyyys-")
DistroLogo.append(f"{blueN} oyyys{whiteB}dMy{blueN}syyyy{whiteB}dMMMMMMMMMMMMMy{blueN}yyyyyyo")
DistroLogo.append(f"{blueN} `oyyyy{whiteB}dMMMMy{blueN}syysoooooo{whiteB}dMMMMy{blueN}yyyyyyyyo`")
DistroLogo.append(f"{blueN} oyyyyyy{whiteB}dMMMMy{blueN}yyyyyyyyyyys{whiteB}dMMy{blueN}sssssyyyo")
DistroLogo.append(f"{blueN} -yyyyyyyy{whiteB}dMy{blueN}syyyyyyyyyyyyyys{whiteB}dMMMMMy{blueN}syyy-")
DistroLogo.append(f"{blueN} oyyyysoo{whiteB}dMy{blueN}yyyyyyyyyyyyyyyyyy{whiteB}dMMMMy{blueN}syyyo")
DistroLogo.append(f"{blueN} yyys{whiteB}dMMMMMy{blueN}yyyyyyyyyyyyyyyyyysosyyyyyyyy")
DistroLogo.append(f"{blueN} yyys{whiteB}dMMMMMy{blueN}yyyyyyyyyyyyyyyyyyyyyyyyyyyyy")
DistroLogo.append(f"{blueN} oyyyyysos{whiteB}dy{blueN}yyyyyyyyyyyyyyyyyy{whiteB}dMMMMy{blueN}syyyo")
DistroLogo.append(f"{blueN} -yyyyyyyy{whiteB}dMy{blueN}syyyyyyyyyyyyyys{whiteB}dMMMMMy{blueN}syyy-")
DistroLogo.append(f"{blueN} oyyyyyy{whiteB}dMMMy{blueN}syyyyyyyyyyys{whiteB}dMMy{blueN}oyyyoyyyo")
DistroLogo.append(f"{blueN} `oyyyy{whiteB}dMMMy{blueN}syyyoooooo{whiteB}dMMMMy{blueN}oyyyyyyyyo")
DistroLogo.append(f"{blueN} oyyysyyoyyyys{whiteB}dMMMMMMMMMMMy{blueN}yyyyyyyo")
DistroLogo.append(f"{blueN} -syyyyyyyyy{whiteB}dMMMy{blueN}syyy{whiteB}dMMMy{blueN}syyyys-")
DistroLogo.append(f"{blueN} -oyyyyyyy{whiteB}dMMy{blueN}yyyyyysosyyyyo-")
DistroLogo.append(f"{blueN} ./oyyyyyyyyyyyyyyyyyyo/.")
DistroLogo.append(f"{blueN} `.:/oosyyyysso/:.`{clear}")
elif LogoID == Distro.PopOS:
# PopOS Logo ##################################################################
DistroLogo = [f"{cyanB} /////////////"]
DistroLogo.append(f"{cyanB} /////////////////////")
DistroLogo.append(f"{cyanB} ///////{whiteB}*767{cyanB}////////////////")
DistroLogo.append(f"{cyanB} //////{whiteB}7676767676*{cyanB}//////////////")
DistroLogo.append(f"{cyanB} /////{whiteB}76767{cyanB}//{whiteB}7676767{cyanB}//////////////")
DistroLogo.append(f"{cyanB} /////{whiteB}767676{cyanB}///{whiteB}*76767{cyanB}///////////////")
DistroLogo.append(f"{cyanB} ///////{whiteB}767676{cyanB}///{whiteB}76767{cyanB}.///{whiteB}7676*{cyanB}///////")
DistroLogo.append(f"{cyanB} /////////{whiteB}767676{cyanB}//{whiteB}76767{cyanB}///{whiteB}767676{cyanB}////////")
DistroLogo.append(f"{cyanB} //////////{whiteB}76767676767{cyanB}////{whiteB}76767{cyanB}/////////")
DistroLogo.append(f"{cyanB} ///////////{whiteB}76767676{cyanB}//////{whiteB}7676{cyanB}//////////")
DistroLogo.append(f"{cyanB} ////////////,{whiteB}7676{cyanB},///////{whiteB}767{cyanB}///////////")
DistroLogo.append(f"{cyanB} /////////////*{whiteB}7676{cyanB}///////{whiteB}76{cyanB}////////////")
DistroLogo.append(f"{cyanB} ///////////////{whiteB}7676{cyanB}////////////////////")
DistroLogo.append(f"{cyanB} ///////////////{whiteB}7676{cyanB}///{whiteB}767{cyanB}////////////")
DistroLogo.append(f"{cyanB} //////////////////////{whiteB}'{cyanB}////////////")
DistroLogo.append(f"{cyanB} //////{whiteB}.7676767676767676767,{cyanB}//////")
DistroLogo.append(f"{cyanB} /////{whiteB}767676767676767676767{cyanB}/////")
DistroLogo.append(f"{cyanB} ///////////////////////////")
DistroLogo.append(f"{cyanB} /////////////////////")
DistroLogo.append(f"{cyanB} /////////////{clear}")
elif LogoID == Distro.MacOS:
# Mac OS Logo #################################################################
DistroLogo = [f"{greenN} 'c."]
DistroLogo.append(f"{greenN} ,xNMM.")
DistroLogo.append(f"{greenN} .OMMMMo")
DistroLogo.append(f"{greenN} OMMM0,")
DistroLogo.append(f"{greenN} .;loddo:' loolloddol;.")
DistroLogo.append(f"{greenN} cKMMMMMMMMMMNWMMMMMMMMMM0:")
DistroLogo.append(f"{yellowN} .KMMMMMMMMMMMMMMMMMMMMMMMWd.")
DistroLogo.append(f"{yellowN} XMMMMMMMMMMMMMMMMMMMMMMMX.")
DistroLogo.append(f"{redN} ;MMMMMMMMMMMMMMMMMMMMMMMM:")
DistroLogo.append(f"{redN} :MMMMMMMMMMMMMMMMMMMMMMMM:")
DistroLogo.append(f"{redN} .MMMMMMMMMMMMMMMMMMMMMMMMX.")
DistroLogo.append(f"{redN} kMMMMMMMMMMMMMMMMMMMMMMMMWd.")
DistroLogo.append(f"{magentaN} .XMMMMMMMMMMMMMMMMMMMMMMMMMMk")
DistroLogo.append(f"{magentaN} .XMMMMMMMMMMMMMMMMMMMMMMMMK.")
DistroLogo.append(f"{blueN} kMMMMMMMMMMMMMMMMMMMMMMd")
DistroLogo.append(f"{blueN} ;KMMMMMMMWXXWMMMMMMMk.")
DistroLogo.append(f"{blueN} .cooc,. .,coo:.{clear}")
elif LogoID == Distro.Neon:
# KDE Neon Logo ###############################################################
DistroLogo = [f"{greenN} `..---+/---..`"]
DistroLogo.append(f"{greenN} `---.`` `` `.---.`")
DistroLogo.append(f"{greenN} .--.` `` `-:-.")
DistroLogo.append(f"{greenN} `:/: `.----//----.` :/-")
DistroLogo.append(f"{greenN} .:. `---` `--.` .:`")
DistroLogo.append(f"{greenN} .:` `--` .:- `:.")
DistroLogo.append(f"{greenN} `/ `:. `.-::-.` -:` `/`")
DistroLogo.append(f"{greenN} /. /. `:++++++++:` .: .:")
DistroLogo.append(f"{greenN} `/ .: `+++++++++++/ /` `+`")
DistroLogo.append(f"{greenN} /+` -- .++++++++++++` :. .+:")
DistroLogo.append(f"{greenN} `/ .: `+++++++++++/ /` `+`")
DistroLogo.append(f"{greenN} /` /. `:++++++++:` .: .:")
DistroLogo.append(f"{greenN} ./ `:. `.:::-.` -:` `/`")
DistroLogo.append(f"{greenN} .:` `--` .:- `:.")
DistroLogo.append(f"{greenN} .:. `---` `--.` .:`")
DistroLogo.append(f"{greenN} `:/: `.----//----.` :/-")
DistroLogo.append(f"{greenN} .-:.` `` `-:-.")
DistroLogo.append(f"{greenN} `---.`` `` `.---.`")
DistroLogo.append(f"{greenN} `..---+/---..`{clear}")
elif LogoID == Distro.Elementary:
# Elementary OS Logo ##########################################################
DistroLogo = [f"{blueN} eeeeeeeeeeeeeeeee"]
DistroLogo.append(f"{blueN} eeeeeeeeeeeeeeeeeeeeeee")
DistroLogo.append(f"{blueN} eeeee eeeeeeeeeeee eeeee")
DistroLogo.append(f"{blueN} eeee eeeee eee eeee")
DistroLogo.append(f"{blueN} eeee eeee eee eeee")
DistroLogo.append(f"{blueN} eee eee eee eee")
DistroLogo.append(f"{blueN} eee eee eee eee")
DistroLogo.append(f"{blueN} ee eee eeee eeee")
DistroLogo.append(f"{blueN} ee eee eeeee eeeeee")
DistroLogo.append(f"{blueN} ee eee eeeee eeeee ee")
DistroLogo.append(f"{blueN} eee eeee eeeeee eeeee eee")
DistroLogo.append(f"{blueN} eee eeeeeeeeee eeeeee eee")
DistroLogo.append(f"{blueN} eeeeeeeeeeeeeeeeeeeeeeee eeeee")
DistroLogo.append(f"{blueN} eeeeeeee eeeeeeeeeeee eeee")
DistroLogo.append(f"{blueN} eeeee eeeee")
DistroLogo.append(f"{blueN} eeeeeee eeeeeee")
DistroLogo.append(f"{blueN} eeeeeeeeeeeeeeeee{clear}")
elif LogoID == Distro.FreeBSD:
# FreeBSD Logo ################################################################
DistroLogo = [f"{redB} , ,"]
DistroLogo.append(f"{redB} /( )`")
DistroLogo.append(f"{redB} \\ \\___ / |")
DistroLogo.append(f"{redB} /- {whiteB}_{redB} `-/ '")
DistroLogo.append(f"{redB} ({whiteB}/\\/ \\{redB} \\ /\\")
DistroLogo.append(f"{whiteB} / / |{redB} ` \\")
DistroLogo.append(f"{blueB} O O {whiteB}){redB} / |")
DistroLogo.append(f"{whiteB} `-^--'{redB}`< '")
DistroLogo.append(f"{redB} (_.) _ ) /")
DistroLogo.append(f"{redB} `.___/` /")
DistroLogo.append(f"{redB} `-----' /")
DistroLogo.append(f"{yellowB} <----.{redB} __ / __ \\")
DistroLogo.append(f"{yellowB} <----|===={redB}O))){yellowB}=={redB}) \\) /{yellowB}====")
DistroLogo.append(f"{yellowB} <----'{redB} `--' `.__,' \\")
DistroLogo.append(f"{redB} | |")
DistroLogo.append(f"{redB} \\ / /\\")
DistroLogo.append(f"{cyanB} ______{redB}( (_ / \\______/")
DistroLogo.append(f"{cyanB} ,' ,-----' |")
DistroLogo.append(f"{cyanB} `--(__________){clear}")
elif LogoID == Distro.CentOS:
# FreeBSD Logo ################################################################
DistroLogo = [f"{yellowB} .."]
DistroLogo.append(f"{yellowB} .PLTJ.")
DistroLogo.append(f"{yellowB} <><><><>")
DistroLogo.append(f"{greenB} KKSSV' 4KKK {yellowB}LJ{magentaB} KKKL.'VSSKK")
DistroLogo.append(f"{greenB} KKV' 4KKKKK {yellowB}LJ{magentaB} KKKKAL 'VKK")
DistroLogo.append(f"{greenB} V' ' 'VKKKK {yellowB}LJ${magentaB} KKKKV' ' 'V")
DistroLogo.append(f"{greenB} .4MA.' 'VKK {yellowB}LJ{magentaB} KKV' '.4Mb.")
DistroLogo.append(f"{magentaB} . {greenB}KKKKKA.' 'V {yellowB}LJ{magentaB} V' '.4KKKKK {blueB}.")
DistroLogo.append(f"{magentaB} .4D {greenB}KKKKKKKA.'' {yellowB}LJ{magentaB} ''.4KKKKKKK {blueB}FA.")
DistroLogo.append(f"{magentaB}<QDD ++++++++++++ {blueB}++++++++++++ GFD>")
DistroLogo.append(f"{magentaB} 'VD {blueB}KKKKKKKK'.. {greenB}LJ {yellowB}..'KKKKKKKK {blueB}FV")
DistroLogo.append(f"{magentaB} ' {blueB}VKKKKK'. .4 {greenB}LJ {yellowB}K. .'KKKKKV {blueB}'")
DistroLogo.append(f"{blueB} 'VK'. .4KK {greenB}LJ {yellowB}KKA. .'KV'")
DistroLogo.append(f"{blueB} A. . .4KKKK {greenB}LJ {yellowB}KKKKA. . .4")
DistroLogo.append(f"{blueB} KKA. 'KKKKK {greenB}LJ {yellowB}KKKKK' .4KK")
DistroLogo.append(f"{blueB} KKSSA. VKKK {greenB}LJ {yellowB}KKKV .4SSKK")
DistroLogo.append(f"{greenB} <><><><>")
DistroLogo.append(f"{greenB} 'MKKM'")
DistroLogo.append(f"{greenB} ''{clear}")
else:
# Large Tux Logo ##############################################################
#tuxbg = blackN # Colour behind Tux.
tuxbg = clear + blackH # Colour behind Tux. Clear other colours, set background.
tuxfg = blackB # Tux line colour.
DistroLogo = [f"{tuxfg}{tuxbg} ▄█████▄"]
DistroLogo.append(f"{tuxfg}{tuxbg} █████████")
DistroLogo.append(f"{tuxfg}{tuxbg} {bgWhite}████████▀██{tuxbg}")
DistroLogo.append(f"{tuxfg}{tuxbg} {bgWhite}██████████▄██{tuxbg}")
DistroLogo.append(f"{tuxfg}{tuxbg} {bgWhite}██▀▀███▀▀████{tuxbg}")
DistroLogo.append(f"{tuxfg}{tuxbg} {bgWhite}████ █ ██ ███{tuxbg}")
DistroLogo.append(f"{tuxfg}{tuxbg} {bgYellow}█ ████{tuxbg}")
DistroLogo.append(f"{tuxfg}{tuxbg} {bgYellow}█ ▄ ████{tuxbg}")
DistroLogo.append(f"{tuxfg}{tuxbg} {bgYellow}███▀▀▀▀▀▄{bgWhite}▀████{tuxbg}")
DistroLogo.append(f"{tuxfg}{tuxbg} {bgWhite}██▀▀▀▀▀▀ ███{tuxbg}▄")
DistroLogo.append(f"{tuxfg}{tuxbg} ▄█{bgWhite}▀ █████{tuxbg}")
DistroLogo.append(f"{tuxfg}{tuxbg} {bgWhite}███ ██████{tuxbg}")
DistroLogo.append(f"{tuxfg}{tuxbg} {bgWhite}███ ██████{tuxbg}")
DistroLogo.append(f"{tuxfg}{tuxbg} {bgWhite}█▀██ ██████{tuxbg}")
DistroLogo.append(f"{tuxfg}{tuxbg} {bgWhite}█ █ █ ████{tuxbg}")
DistroLogo.append(f"{tuxfg}{tuxbg} {bgWhite}█ █ ██ ███{tuxbg}")
DistroLogo.append(f"{tuxfg}{tuxbg} {bgWhite}██ ▀ █▀ ████{tuxbg}")
DistroLogo.append(f"{tuxfg}{tuxbg} {bgWhite}███ ████{tuxbg}")
DistroLogo.append(f"{tuxfg}{tuxbg} {bgWhite}█████ ███ ███{tuxbg}")
DistroLogo.append(f"{tuxfg}{tuxbg} {bgYellow}█▀▀███{bgWhite} █████████{tuxbg}")
DistroLogo.append(f"{tuxfg}{tuxbg} ▄{bgYellow}█ ███{bgWhite} █{bgYellow}▀ ████ ▀█{tuxbg}")
DistroLogo.append(f"{tuxfg}{tuxbg} ▄█{bgYellow}▀ ████{bgWhite} █{bgYellow} ▀ █{tuxbg}")
DistroLogo.append(f"{tuxfg}{tuxbg} █{bgYellow} ████{bgWhite} █ █{bgYellow} ██{tuxbg}")
DistroLogo.append(f"{tuxfg}{tuxbg} █{bgYellow} ██{bgWhite} █ █{bgYellow} ▀█{tuxbg}")
DistroLogo.append(f"{tuxfg}{tuxbg} █{bgYellow} █{bgWhite} █ █{bgYellow} █{tuxbg}")
DistroLogo.append(f"{tuxfg}{tuxbg} █{bgYellow} ███████████{bgYellow} ▄{tuxbg}▀")
DistroLogo.append(f"{tuxfg}{tuxbg} █{bgYellow}▄ █{tuxbg} ▀▀▀▀▀▀▀ █{bgYellow} ▄{tuxbg}▀")
DistroLogo.append(f"{tuxfg}{tuxbg} ▀▀▀▀▀{bgYellow}▄▄▄█{tuxbg}▀ ▀{bgYellow}▄ █{tuxbg}")
DistroLogo.append(f"{tuxfg}{tuxbg} ▀▀▀▀{clear}")
# Return the logo information as a list. ##################################
return(DistroLogo)
# Check if a command line tool is installed. ##################################
def CheckCommandInstalled(CommandName):
WhichOutput = Popen(['which', CommandName], stdout=PIPE).communicate()[0].decode("utf-8").split('\n')
return ( len(WhichOutput) > 1 )
# Function to run a command and return the first line of output. ##############
def GetCommandOutputList(CommandList):
if CheckCommandInstalled(CommandList[0]):
Output = Popen(CommandList, stdout=PIPE, stderr=DEVNULL).communicate()[0].decode("utf-8").split('\n')
else:
Output = []
return Output
# Function to run a command and return the first line of output. ##############
def GetCommandOutput(CommandList):
if CheckCommandInstalled(CommandList[0]):
Output = Popen(CommandList, stdout=PIPE, stderr=DEVNULL).communicate()[0].decode("utf-8").split('\n')[0]
else:
Output = ""
return Output
# Function to run a command and count the lines of output. ####################
def CountCommandOutput(CommandList):
if CheckCommandInstalled(CommandList[0]):
OutputList = Popen(CommandList, stdout=PIPE).communicate()[0].decode("utf-8").split('\n')
OutputCount = len(OutputList) - 1
else:
OutputCount = 0
return OutputCount
# Function to print coloured key with normal value. ###########################
def output(key, value):
if DistroID in DistroColourDict:
DistroColour = DistroColourDict[DistroID]
else:
DistroColour = redB
result.append(f"{DistroColour}{key}:{clear} {value}")
# Function to identify installed RAM and how much is being used. ##############
def ram_display():
if DistroID == Distro.MacOS:
RawRAMInfo = GetCommandOutputList(['sysctl', '-n', 'hw.memsize'])
RAMInfo = [ "Mem:", str(int(int(RawRAMInfo[0])/1048576)), 0, 0, 0, 0, 0]
RAMUsedInfo = GetCommandOutputList(['vm_stat'])
for EachVM_StatItem in RAMUsedInfo:
WorkingLine = re.sub(r"\.", "", EachVM_StatItem) # Remove trailing full stop.
SplitLine = WorkingLine.split(":") # Split at the colon.
if re.search(" wired", SplitLine[0]):
VM_Wired = int(SplitLine[1])
if re.search(" active", SplitLine[0]):
VM_Active = int(SplitLine[1])
if re.search(" occupied", SplitLine[0]):
VM_Compressed = int(SplitLine[1])
RAMInfo[2] = (VM_Wired + VM_Active + VM_Compressed) * 4 / 1024
elif DistroID == Distro.FreeBSD:
MemTotal = int(int(GetCommandOutput(['sysctl', '-n', 'hw.physmem'])) / 1024 / 1024)
HWPageSize = int(GetCommandOutput(['sysctl', '-n', 'hw.pagesize']))
MemInactive = int(GetCommandOutput(['sysctl', '-n', 'vm.stats.vm.v_inactive_count'])) * HWPageSize
MemUnused = int(GetCommandOutput(['sysctl', '-n', 'vm.stats.vm.v_free_count'])) * HWPageSize
MemCache = int(GetCommandOutput(['sysctl', '-n', 'vm.stats.vm.v_cache_count'])) * HWPageSize
MemFree = int((MemInactive + MemUnused + MemCache) / 1024 / 1024)
RAMInfo = [ "Mem:", MemTotal, MemTotal - MemFree, 0, 0, 0, 0, 0]
else:
# Use the free command to gather memory info in mebibytes (1024*1024 bytes)
RawRAMInfo = GetCommandOutputList(['free', '-m'])
# Find the line starting with "Mem", split each entry in that line into a list.
RAMInfo = ''.join(filter(re.compile('Mem').search, RawRAMInfo)).split()
# Prepare the RAM information for display.
RAMTotal = int(RAMInfo[1])
RAMUsed = int(RAMInfo[2])
RAMUsedPercent = int((RAMUsed / RAMTotal) * 100)
if RAMUsedPercent >= 80:
RAMColour = redB
elif RAMUsedPercent <= 50:
RAMColour = greenB
else:
RAMColour = yellowB
output('RAM', f"{RAMColour}{RAMUsed} MB {clear}/ {RAMTotal} MB")
# Function to identify the release and architecture. ##########################
def distro_display():
output('OS', DistroTitle)
# Function to identify the kernel version. ####################################
def kernel_display():
# Don't show the kernel on FreeBSD - it duplicates the distro title.
if Distro != Distro.FreeBSD:
# Originally used uname -r, added -sr to improve display on Mac OS.
kernel = GetCommandOutput(['uname', '-sr'])
output('Kernel', kernel)
# Function to identify the user name. #########################################
def user_display():
output('User', getuser())
# Function to identify the hostname. ##########################################
def hostname_display():
hostname = GetCommandOutput(['uname', '-n'])
# Remove ".local" from the hostname if present.
hostname = re.sub('.local', ' ', hostname)
output('Hostname', hostname)
# Function to identify the CPU. ###############################################
def cpu_display():
if DistroID == Distro.MacOS:
PrettyCPUInfo = GetCommandOutput(['sysctl', '-n', 'machdep.cpu.brand_string'])
elif DistroID == Distro.FreeBSD:
PrettyCPUInfo = GetCommandOutput(['sysctl', '-n', 'hw.model'])
elif CheckCommandInstalled("lscpu"):
TempCPU = GetCommandOutputList(['lscpu'])
# Set Default Values
CPUVendorID = ""
CPUModelName = ""
RawCPUMaxMhz = ""
PrettyCPUInfo = ""
for EachLine in TempCPU:
if "Vendor ID:" in EachLine:
CPUVendorID = (EachLine.replace("Vendor ID:", "")).strip()
elif "Model name:" in EachLine:
CPUModelName = (EachLine.replace("Model name:", "")).strip()
elif "CPU max MHz:" in EachLine:
RawCPUMaxMhz = (EachLine.replace("CPU max MHz:", "")).strip()
if RawCPUMaxMhz != "":
# Convert Raw Mhz value into a displayable value.
NumericCPUMhz = float(RawCPUMaxMhz)
# Check if less that 1000 and show in Mhz rather than Ghz.
if NumericCPUMhz < 1000:
CPUMaxMhz = str(NumericCPUMhz) + " MHz"
else:
NumericCPUMhz = round(NumericCPUMhz / 1000, 2)
CPUMaxMhz = str(NumericCPUMhz) + " GHz"
else:
CPUMaxMhz = ""
# If this is an ARM CPU and ARM is not mentioned in the model name, add it.
if CPUVendorID == "ARM" and not ("ARM" in CPUModelName):
PrettyCPUInfo = CPUVendorID + " " + CPUModelName
elif CPUModelName != "":
PrettyCPUInfo = CPUModelName
# If CPU speed identified and not already included in the model name, add it.
if PrettyCPUInfo != "" and CPUMaxMhz != "" and not ("@" in PrettyCPUInfo):
PrettyCPUInfo += " @ " + CPUMaxMhz
if PrettyCPUInfo == "":
PrettyCPUInfo = "Undetermined"
else:
PrettyCPUInfo = "Undetermined (lscpu not available)"
# Some model names contain multiple spaces. Remove them if present.
PrettyCPUInfo = re.sub(r' {2,}', ' ', PrettyCPUInfo)
output('CPU', PrettyCPUInfo)
# Function to identify uptime. ################################################
def uptime_display():
if DistroID in [Distro.MacOS, Distro.FreeBSD]:
BootTime = GetCommandOutputList(['sysctl', '-n', 'kern.boottime'])
BootTime = re.sub('{ sec = ', '', BootTime[0]) # Strip leading characters.
BootTime = int(BootTime[0:BootTime.find(",")]) # Remove everything after first comma.
CurrentTime = int(datetime.datetime.timestamp(datetime.datetime.now()))
fuptime = CurrentTime - BootTime
else:
fuptime = int(open('/proc/uptime').read().split('.')[0])
day = int(fuptime / 86400)
fuptime = fuptime % 86400
hour = int(fuptime / 3600)
fuptime = fuptime % 3600
minute = int(fuptime / 60)
uptime = ''
if day == 1:
uptime += '%d day, ' % day
else:
uptime += '%d days, ' % day
if hour == 1:
uptime += '%d hour, ' % hour
else:
uptime += '%d hours, ' % hour
if minute == 1:
uptime += '%d minute.' % minute
else:
uptime += '%d minutes.' % minute
output('Uptime', uptime)
# Function to identify and return the Desktop Environment. ####################
# Used to both identify Ubuntu variants, and called by de_display to
# populate the output.
def DesktopEvironmentID():
DesktopEnvironment = "None"
if DistroID == Distro.MacOS:
DesktopEnvironment = "Aqua"
else:
# Attempt to read the desktop environment from a shell variable.
DesktopEnvironmentShellVar = os.getenv('XDG_CURRENT_DESKTOP')
if DesktopEnvironmentShellVar in DesktopEnvironmentShellVarDict:
# Desktop Environment detected from shell variable, return that.
DesktopEnvironment = DesktopEnvironmentShellVarDict[DesktopEnvironmentShellVar]
else:
# Check the process list for any matching environments
for proc in psutil.process_iter():
try:
# Get process name & pid from process object.
processName = proc.name()
# Check the process list for any matching environments
for de_id, de_name in DesktopEnvironmentProcessDict.items():
if de_id == processName:
DesktopEnvironment = de_name
break
except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):
pass
return DesktopEnvironment
# Return detailed information on the version of KDE. ##########################
def KDEVersionInfo():
KDEVersionNumber = os.getenv("KDE_SESSION_VERSION")
# If the KDE session version is not available, assume version 4.
if KDEVersionNumber == None:
KDEVersionNumber = "4"
KDEVersion = GetCommandOutput(["kded" + KDEVersionNumber, "--version"])
KDEVersion = re.sub("kded" + KDEVersionNumber + " ", "", KDEVersion)
PlasmaShellVersion = GetCommandOutput(["plasmashell", "--version"])
PlasmaShellVersion = re.sub("plasmashell ", "", PlasmaShellVersion)
PrettyKDEVersion = "KDE"
if KDEVersion != "":
PrettyKDEVersion += " " + KDEVersion
if PlasmaShellVersion != "":
PrettyKDEVersion = PrettyKDEVersion + " / Plasma " + PlasmaShellVersion
return PrettyKDEVersion
# Return detailed information on the version of GNOME. ########################
def GNOMEVersionInfo():
# Read the GNOME shell version.
GNOMEVersion = GetCommandOutput(["gnome-shell", "--version"]).upper()
GNOMEVersion = re.sub("GNOME.SHELL ", "", GNOMEVersion)