pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

primoturbo private pastebin - collaborative debugging tool What's a private pastebin?


Posted by PrimoTurbo on Thu 26 Jun 16:53
report abuse | download | new post

  1. #!/usr/bin/python
  2.  
  3. # themeinfo.py by dbbolton (envyouraudience at gmail)
  4.  
  5. import gconf
  6. import os
  7. import string
  8. from os.path import exists
  9. from subprocess import call
  10. from time import strftime
  11.  
  12. #colors
  13. blue = "\033[1;34m"
  14. green = "\033[1;32m"
  15. cyan = "\033[1;36m"
  16. red = "\033[1;31m"
  17. bblue = "\033[0;38;5;12m"
  18. orange = "\033[0;38;5;202m"
  19. yelloworange = "\033[0;38;5;208m"
  20. gold = "\033[0;38;5;214m"
  21. darkorange = "\033[0;38;5;130m"
  22. darkcyan="\033[0;38;5;32m"
  23.  
  24. #change color back to default
  25. end="\033[0m"
  26.  
  27. ################################
  28. #   OPTIONS
  29. ################################
  30.  
  31. # Which window manager?
  32. include_mt = False #metacity
  33. include_ob = True #openbox
  34. include_aw = False  #awesome
  35.  
  36. # Which terminal are you using?
  37. include_gt = True #gnome-terminal
  38. include_xft = False #xfce4-terminal
  39. include_tilda = False
  40. include_urxvt = False
  41.  
  42. # Is your GTK theme specified in yout .gtkrc.mine file?
  43. include_gtkrcmine = False
  44.  
  45. # What about your font?
  46. my_font = False
  47.  
  48. # And your icons?
  49. my_icons = False
  50.  
  51. # Do you use feh to set your wallpaper?
  52. include_feh = False
  53.  
  54. ################################
  55. #   END OPTIONS
  56. ################################
  57.  
  58. #define key to get stuff from gconf
  59. key = gconf.client_get_default()
  60.  
  61. #########################
  62. # distro
  63. #########################
  64. if exists(os.path.expanduser("/etc/issue")):
  65.         for line in open(os.path.expanduser("/etc/issue")):
  66.                 if " " in line:
  67.                         distro=line
  68.                         break
  69. else:
  70.         distro = "Linux"
  71.  
  72.  
  73. #########################
  74. # gtk
  75. #########################
  76. if include_gtkrcmine:
  77.         if exists(os.path.expanduser("~/.gtkrc.mine")):
  78.                 for line in open(os.path.expanduser("~/.gtkrc.mine")):
  79.                         if "/gtk-2.0/gtkrc" in line:
  80.                                 mygtk=line
  81.                                 use_my_gtk = True
  82.                                 break
  83.                         else:
  84.                                 use_my_gtk = False
  85. else:
  86.         mygtk = "?"
  87.         use_my_gtk = False
  88.  
  89. if include_gt:
  90.         gnomegtk = key.get_value("/desktop/gnome/interface/gtk_theme")
  91.  
  92. #########################
  93. # fonts
  94. #########################
  95. if my_font:
  96.         if exists(os.path.expanduser("~/.gtkrc.mine")):
  97.                 for line in open(os.path.expanduser("~/.gtkrc.mine")):
  98.                         if "gtk-font-name" in line:
  99.                                 myfont = line
  100.                                 use_my_font = True
  101.                                 break
  102.                         else:
  103.                                 use_my_font = False
  104. else:
  105.         use_my_font = False
  106.  
  107. gnomefont = key.get_value("/desktop/gnome/interface/font_name")
  108.  
  109. #tilda
  110. if exists(os.path.expanduser("~/.tilda/config_0")):
  111.         for line in open(os.path.expanduser("~/.tilda/config_0")):
  112.                 if "font" in line:
  113.                         tildfont=line
  114.                         break
  115. else:
  116.         tildfont = "?"
  117.  
  118. #gnome-terminal
  119.  
  120. gtfont = key.get_value("/apps/gnome-terminal/profiles/Default/font")
  121.  
  122. #xfce4-terminal
  123.  
  124. if exists(os.path.expanduser("~/.config/Terminal/terminalrc")):
  125.         for line in open(os.path.expanduser("~/.config/Terminal/terminalrc")):
  126.                 if "FontName" in line:
  127.                         xftfont=line
  128.                         break
  129. else:
  130.         xftfont = "?"
  131.  
  132. #urxvt
  133.  
  134. if exists(os.path.expanduser("~/.Xdefaults")):
  135.         for line in open(os.path.expanduser("~/.Xdefaults")):
  136.                 if "urxvt*font" in line:
  137.                         urxvtfont=line
  138.                         break
  139. else:
  140.         urxvtfont = "?"
  141.  
  142. #########################
  143. # icons
  144. #########################
  145. if my_icons:
  146.         if exists(os.path.expanduser("~/.gtkrc.mine")):
  147.                 for line in open(os.path.expanduser("~/.gtkrc.mine")):
  148.                         if "icon-theme" in line:
  149.                                 myicons = line
  150.                                 use_my_icons = True
  151.                                 break
  152.                         else:
  153.                                 use_my_icons = False
  154. else:
  155.         myicons = "?"
  156.         use_my_icons = False
  157.  
  158. gnomeicons = key.get_value("/desktop/gnome/interface/icon_theme")
  159.  
  160. #########################
  161. # metacity
  162. #########################
  163.  
  164. if include_mt:
  165.         metacitytheme = key.get_value("/apps/metacity/general/theme")
  166. else:
  167.         metacitytheme = "?"
  168.  
  169.  
  170. #########################
  171. # openbox
  172. #########################
  173. if exists(os.path.expanduser("~/.config/openbox/rc.xml")):
  174.         for line in open(os.path.expanduser("~/.config/openbox/rc.xml")):
  175.                 if "<name>" in line:
  176.                         ob = line
  177.                         break
  178. else:
  179.         ob = "?"
  180.  
  181.  
  182. #########################
  183. # wall
  184. #########################
  185. if include_feh:
  186.         if exists(os.path.expanduser("~/.fehbg")):
  187.                 for line in open(os.path.expanduser("~/.fehbg")):
  188.                         if "feh" in line:
  189.                                 fehwall = line
  190.                                 break
  191.                         else:
  192.                                 use_feh_wall = False
  193. else:
  194.         wall="?"
  195.         use_feh_wall = False
  196.  
  197. gwallpath = key.get_value("/desktop/gnome/background/picture_filename")[0:-4]
  198. gwallname = gwallpath.split('/')[-1]
  199.  
  200.  
  201. ######################
  202. #print info
  203. ######################
  204. print "\n"+orange+distro.split(' ')[0]+" "+distro.split(' ')[1]+"\n"
  205.  
  206.  
  207. if use_my_gtk:
  208.         print darkcyan+"  GTK:"+end+"                   "+mygtk.split('/')[4]
  209. else:
  210.         print darkcyan+"  GTK:"+end+"                   "+gnomegtk
  211. if use_my_font:
  212.         print darkcyan+"  Font (Apps):"+end+"           "+myfont.split('"')[1]
  213. else:
  214.         print darkcyan+"  Font (Apps):"+end+"           "+gnomefont
  215. if include_tilda:
  216.         print darkcyan+"  Font (Terminal):"+end+"       "+tildfont.split('"')[1]
  217. elif include_gt:
  218.         print darkcyan+"  Font (Terminal):"+end+"       "+gtfont
  219. elif include_urxvt:
  220.         print darkcyan+"  Font (Terminal):"+end+"       "+urxvtfont.split(':')[-1][0:-1]
  221. elif include_xft:
  222.         print darkcyan+"  Font (Terminal):"+end+"       "+xftfont.split('=')[1][0:-1]
  223. if use_my_icons:
  224.         print darkcyan+"  Icons:"+end+"                 "+myicons.split('"')[1]
  225. else:
  226.         print darkcyan+"  Icons:"+end+"                 "+gnomeicons
  227. if include_mt:
  228.         print darkcyan+"  Metacity:"+end+"              "+metacitytheme
  229. elif include_ob:
  230.         if exists(os.path.expanduser("~/.config/openbox/rc.xml")):
  231.                 print darkcyan+"  Openbox:"+end+"               "+ob.split('>')[1][0:-6]
  232.         else:
  233.                 print "Openbox theme not found."
  234. elif include_aw:
  235.         print darkcyan+"  WM:"+end+"                    Awesome"
  236. else:
  237.         print darkcyan+"  WM:"+end+"                    ?"
  238. if include_feh:
  239.         print darkcyan+"  Wall:"+end+"                  "+fehwall.split('/')[-1][0:-2]+"\n"
  240. else:
  241.         print darkcyan+"  Wall:"+end+"                  "+gwallname+"\n"
  242.  
  243. print " "+strftime("%A %d %B %Y")+"\n"
  244. ######################
  245. #take screenshot
  246. ######################
  247. call(["sleep", "15"])
  248. #call("scrot")

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me so that I can delete my post