rendered paste body#!/usr/bin/env pythonimport commands# Define colors# color = "\x1b[1;30m" # black# color2 = "\x1b[0;30m" # black# color = "\x1b[1;31m" # red # color2 = "\x1b[0;30m" # red# color = "\x1b[1;32m" # green# color2 = "\x1b[0;32m" # green# color = "\x1b[1;33m" # yellow# color2 = "\x1b[0;33m" # yellowcolor = "\x1b[1;34m" # bluecolor2 = "\x1b[0;34m" # blue# color = "\x1b[1;35m" # magenta# color2 = "\x1b[0;35m" # magenta# color = "\x1b[1;36m" # cyan# color2 = "\x1b[0;36m" # cyan# color = "\x1b[1;37m" # white# color2 = "\x1b[0;37m" # whiteclear = "\x1b[0m"list = []# Find running processesprocesses = commands.getoutput("ps -A | awk {'print $4'}").split("\n")# Print coloured key with normal value.def output(key, value): output = "%s%s:%s %s" % (color, key, clear, value) print outputdef distro_display(): distro = "Arch Linux" output('Distro', distro)def kernel_display(): kernel = commands.getoutput("uname -r") output ('Kernel', kernel)def uptime_display(): uptime = commands.getoutput('uptime | sed -e \'s/^.*up //\' -e \'s/, *[0-9]*.users.*//\'') output ('Uptime', uptime)def battery_display(): battery = commands.getoutput('acpi | sed \'s/.*, //\'') output ('Battery', battery)def de_display(): # Dictionary of desktop environments dict = {'gnome-session': 'GNOME', 'ksmserver': 'KDE', 'xfce-mcs-manager': 'Xfce'} de = 'None found' for key in dict.keys(): if key in processes: de = dict[key] output ('DE', de)def wm_display(): # Dictionary of window managers dict = {'awesome': 'Awesome', 'beryl': 'Beryl', 'blackbox': 'Blackbox', 'DWM': 'dwm', 'Enlightenment': 'enlightenment', 'fluxbox': 'Fluxbox', 'FVWM': 'fvwm', 'IceWM': 'icewm', 'Kwin': 'kwin', 'metacity': 'Metacity', 'openbox': 'Openbox', 'Window Maker': 'wmaker', 'Xfwm': 'xfwm4', 'Xmonad': 'xmonad'} wm = 'None found' for key in dict.keys(): if key in processes: wm = dict[key] output ('WM', wm) # Values to Display# Possible options: kernel, uptime, battery, distro, de, wm, wmtheme, theme, font, iconsdisplay = [ 'distro', 'kernel', 'uptime', 'battery', 'de', 'wm' ]for x in display: funcname=x+"_display" func=locals()[funcname] func()print """%s%s + %s # %s ### %s%s ##### %s%s ###### %s%s ; #####; %s%s +##.##### %s%s +########## %s%s ######%s#####%s##; %s%s ###%s############%s+ %s%s #%s###### ####### %s%s .######; ;###;`\". %s%s .#######; ;#####. %s #########. .########` %s ######' '###### %s ;#### ####; %s ##' '## %s #' `# %s """ % (color, color, color, color, list, color, list, color, list, color, list, color, list, color, list, color, color2, color, list, color, color2, color, list, color, color2, list, color2, list, color2, color2, color2, color2, color2, color2, clear)