Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

screenfetch-dev

By: a guest on Mar 20th, 2011  |  syntax: Bash  |  size: 49.13 KB  |  views: 411  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/bash
  2. #
  3. # screenFetch (v2.3.2)
  4. #
  5. # Script to fetch system and theme settings for screenshots in most mainstream
  6. # Linux distributions.
  7. #
  8. # This script is released under the General Public License (GPL). Though it's open
  9. # source and you are free to do with it as you please, I would appreciate if you would
  10. # send any code modifications/additions upstream to me so that I can include them in
  11. # the official release. Please do not claim this code as your own as I have worked
  12. # very hard on this and am quite proud to call this script my own.
  13. #
  14. # Yes, I do realize some of this is horribly ugly coding. Any ideas/suggestions would be
  15. # appreciated by emailing me or by stopping by http://github.com/KittyKatt/screeFetch . You
  16. # could also drop in on my IRC network, SilverIRC, at irc://kittykatt.silverirc.com:6667/meowz
  17. # to put forth suggestions/ideas. Thank you.
  18. #
  19.  
  20. scriptVersion="2.3.2"
  21.  
  22. ######################
  23. # Settings for fetcher
  24. ######################
  25.  
  26. # This setting controls what ASCII logo is displayed. Available: Arch Linux (Old and Current Logos), Linux Mint, Ubuntu, Crunchbang, Debian, Gentoo, Mandrake/Mandriva, Slackware, SUSE, Fedora, BSD, and None
  27. # distro="Arch Linux"
  28.  
  29. # This sets the information to be displayed. Available: distro, Kernel, DE, WM, Win_theme, Theme, Icons, Font, Background, ASCII. To get just the information, and not a text-art logo, you would take "ASCII" out of the below variable.
  30. #display="host distro kernel uptime shell res de wm wmtheme gtk icons font background"
  31. display=( host distro kernel uptime shell res de wm wmtheme gtk )
  32. # Display Type: ASCII or Text
  33. display_type="ASCII"
  34.  
  35. # Colors to use for the information found. These are set below according to distribution. If you would like to set your OWN color scheme for these, uncomment the lines below and edit them to your heart's content.
  36. # textcolor="\e[0m"
  37. # labelcolor="\e[1;34m"
  38.  
  39. # WM & DE process names
  40. # Removed WM's: compiz
  41. wmnames="fluxbox openbox blackbox xfwm4 metacity kwin icewm pekwm fvwm dwm awesome WindowMaker stumpwm xmonad musca i3 ratpoison scrotwm wmfs wmii beryl subtle e16 sawfish"
  42. denames="gnome-session xfce-mcs-manage xfce4-session xfconfd ksmserver lxsession gnome-settings-daemon"
  43.  
  44. # Export theme settings
  45. # screenFetch has the capability (on some WM's and GTK) to export your GTK and WM settings to an archive. Specify Yes if you want this and No if you do not.
  46. exportTheme=
  47.  
  48. # Screenshot Settings
  49. # This setting lets the script know if you want to take a screenshot or not. 1=Yes 0=No
  50. screenshot=
  51. # You can specify a custom screenshot command here. Just uncomment and edit. Otherwise, we'll be using the default command: scrot -cd3.
  52. # screenCommand="scrot -cd5"
  53. hostshot=
  54. baseurl="http://www.example.com"
  55. serveraddr="www.example.com"
  56. scptimeout="20"
  57. serverdir="/path/to/directory"
  58. shotfile=$(echo "screenFetch-`date +'%Y-%m-%d_%H-%M-%S'`.png")
  59.  
  60. # Verbose Setting - Set to 1 for verbose output.
  61. verbosity=
  62.  
  63. verboseOut () {
  64.   echo -e "\e[1;31m:: \e[0m$1"
  65. }
  66.  
  67. errorOut () {
  68.   echo -e "\e[1;37m[[ \e[1;31m! \e[1;37m]] \e[0m$1"
  69. }
  70.  
  71. #############################################
  72. #### CODE No need to edit past here CODE ####
  73. #############################################
  74.  
  75. ####################
  76. # Static Variables
  77. ####################
  78. c0="\e[0m" # Reset Text
  79. bold="\e[1m" # Bold Text
  80. underline="\e[4m" # Underline Text
  81. display_index=0
  82.  
  83. #####################
  84. # Begin Flags Phase
  85. #####################
  86.  
  87. while getopts ":hsmevVntlc:D:o:B" flags; do
  88.   case $flags in
  89.     h)
  90.       echo -e "${underline}Usage${c0}:"
  91.       echo -e "  screenFetch [OPTIONAL FLAGS]"
  92.       echo ""
  93.       echo "screenFetch - a CLI Bash script to show system/theme info in screenshots."
  94.       echo ""
  95.       echo -e "${underline}Supported Distributions${c0}:      Arch Linux (Old and Current Logos), Linux Mint,"
  96.       echo -e "                       Ubuntu, Crunchbang, Debian, Gentoo, Fedora,"
  97.       echo -e "                       Mandrake/Mandriva, Slackware, SUSE, and BSD"
  98.       echo -e "${underline}Supported Desktop Managers${c0}:   KDE, GNOME, XFCE, and LXDE, and Not Present"
  99.       echo -e "${underline}Supported Window Managers${c0}:    PekWM, OpenBox, FluxBox, BlackBox, Xfwm4,"
  100.       echo -e "                       Metacity, StumpWM, KWin, IceWM, FVWM,"
  101.       echo -e "                       DWM, Awesome, XMonad, Musca, i3, WindowMaker,"
  102.       echo -e "                       Ratpoison, wmii, WMFS, ScrotWM, subtle,"
  103.       echo -e "                       and Beryl."
  104.       echo ""
  105.       echo -e "${underline}Options${c0}:"
  106.       echo -e "   ${bold}-v${c0}                 Verbose output."
  107.       echo -e "   ${bold}-o 'OPTIONS'${c0}       Allows for setting script variables on the"
  108.       echo -e "               command line. Must be in the following format..."
  109.       echo -e "               'OPTION1=\"OPTIONARG1\";OPTION2=\"OPTIONARG2\"'"
  110.       #echo -e "   ${bold}-d 'ARGUMENTS'${c0}     Allows for setting what information is displayed"
  111.       #echo -e "                      on the command line. Format must be as follows:"
  112.       #echo -e "                      'OPTION OPTION OPTION OPTION'. Valid options are"
  113.       #echo -e "                      host, distro, Kernel, Uptime, Shell, Resolution, DE, WM,"
  114.       #echo -e "                      Win_theme, Theme, Icons, Font, ASCII, Background."
  115.       echo -e "   ${bold}-n${c0}                 Do no display ASCII distribution logo."
  116.       echo -e "   ${bold}-t${c0}                 Truncate output based on terminal width (Experimental!)."
  117.       echo -e "   ${bold}-s(m)${c0}              Using this flag tells the script that you want it"
  118.       echo -e "               to take a screenshot. Use the -m flag if you would like"
  119.       echo -e "               to move it to a new location afterwards."
  120.       echo -e "   ${bold}-B${c0}                 Enable background detection."
  121.       echo -e "   ${bold}-e${c0}                 When this flag is specified, screenFetch will attempt"
  122.       echo -e "               to export all of your theme settings and archive them"
  123.       echo -e "               up for uploading."
  124.       echo -e "   ${bold}-l${c0}                 Specify that you have a light background. This turns"
  125.       echo -e "               all white text into dark gray text (in ascii logos and"
  126.       echo -e "               in information output)."
  127.       echo -e "   ${bold}-c 'COMMAND'${c0}       Here you can specify a custom screenshot command for"
  128.       echo -e "               the script to execute. Surrounding quotes are required."
  129.       echo -e "   ${bold}-D 'DISTRO'${c0}        Here you can specify your distribution for the script"
  130.       echo -e "               to use. Surrounding quotes are required."
  131.       echo -e "   ${bold}-V${c0}                 Display current script version."
  132.       echo -e "   ${bold}-h${c0}                 Display this help."
  133.       exit
  134.     ;;
  135.     s) screenshot=1; continue;;
  136.     m) hostshot=1; continue;;
  137.     e) exportTheme=1; continue;;
  138.     v) verbosity=1; continue;;
  139.     V)
  140.       echo -e $underline"screenFetch"$c0" - Version $scriptVersion"
  141.       echo "Copyright (C) Brett Bohnenkamper (kittykatt@silverirc.com)"
  142.       echo ""
  143.       echo "This is free software; see the source for copying conditions.  There is NO
  144. warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
  145.       exit
  146.     ;;
  147.     D) distro=$OPTARG; continue;;
  148.     t) truncateSet="Yes";;
  149.     c) screenCommand=$OPTARG; continue;;
  150.     n) display_type="Text";;
  151.     o) overrideOpts=$OPTARG; continue;;
  152.     # d) overrideDisplay=$OPTARG; continue;;
  153.     l) c1="\e[1;30m";;
  154.     B) background_detect="1"; continue;;
  155.     :) errorOut "Error: You're missing an argument somewhere. Exiting."; exit;;
  156.     ?) errorOut "Error: Invalid flag somewhere. Exiting."; exit;;
  157.     *) errorOut "Error"; exit;;
  158.   esac
  159.  done
  160.  
  161. ###################
  162. # End Flags Phase
  163. ###################
  164.  
  165.  
  166. ####################
  167. # Override Options
  168. ####################
  169.  
  170. if [[ "$overrideOpts" ]]; then
  171.   [[ "$verbosity" -eq "1" ]] && verboseOut "Found 'o' flag in syntax. Overriding some script variables..."
  172.   OLD_IFS="$IFS"
  173.   IFS=";"
  174.   for overopt in "$overrideOpts"; do
  175.     eval "$overrideOpts"
  176.   done
  177.   IFS="$OLD_IFS"
  178. fi
  179. #if [[ "$overrideDisplay" ]]; then
  180. #  [[ "$verbosity" -eq "1" ]] && verboseOut "Found 'd' flag in syntax. Overriding some display options..."
  181. #  display="$overrideDisplay"
  182. #fi
  183.  
  184.  
  185. #########################
  186. # Begin Detection Phase
  187. #########################
  188.    
  189.  
  190. # Host and User detection - Begin
  191. detecthost () {
  192.   myUser=$(echo "$USER")
  193.   myHost=$(hostname)
  194.   [[ "$verbosity" -eq "1" ]] && verboseOut "Finding hostname and user...found as '$myUser@$myHost'"
  195. }
  196.  
  197. # Distro Detection - Begin
  198. detectdistro () {
  199.   if [[ -z $distro ]]; then
  200.     distro="Unknown"
  201.     if which lsb_release >/dev/null 2>&1; then
  202.       distro_detect=$(lsb_release -i | sed -e 's/Distributor ID://' -e 's/\t//g')
  203.       if [ "$distro_detect" == "Arch" ]; then distro="Arch Linux"; fi
  204.       if [ "$distro_detect" == "Debian" ]; then distro="Debian"; fi
  205.       if [ "$distro_detect" == "LinuxMint" ]; then distro="Mint"
  206.         if [ "$(lsb_release -c | sed -e 's/Codename://' -e 's/\t//g')" == "debian" ]; then
  207.           distro="LMDE"
  208.           distro_codename=null
  209.           distro_release=null
  210.         fi
  211.       fi
  212.       if [ "$distro_detect" == "MandrivaLinux" ]; then distro="Mandriva"
  213.         if [ "$(lsb_release -c | sed -e 's/Codename://' -e 's/\t//g')" == "turtle" ]; then
  214.           distro="Mandriva"-lsb_release | sed -e 's/Release://' -e 's/\t//g'
  215.           distro_codename=null
  216.         fi
  217.         if [ "$(lsb_release -c | sed -e 's/Codename://' -e 's/\t//g')" == "Henry_Farman" ]; then
  218.           distro="Mandriva"-lsb_release | sed -e 's/Release://' -e 's/\t//g'
  219.           distro_codename=null
  220.         fi
  221.         if [ "$(lsb_release -c | sed -e 's/Codename://' -e 's/\t//g')" == "Farman" ]; then
  222.           distro="Mandriva"-lsb_release | sed -e 's/Release://' -e 's/\t//g'
  223.           distro_codename=null
  224.         fi
  225.         if [ "$(lsb_release -c | sed -e 's/Codename://' -e 's/\t//g')" == "Adelie" ]; then
  226.           distro="Mandriva"-lsb_release | sed -e 's/Release://' -e 's/\t//g'
  227.           distro_codename=null
  228.         fi
  229.         if [ "$(lsb_release -c | sed -e 's/Codename://' -e 's/\t//g')" == "pauillac" ]; then
  230.           distro="Mandriva"-lsb_release | sed -e 's/Release://' -e 's/\t//g'
  231.           distro_codename=null
  232.         fi
  233.       fi
  234.       if [ "$distro_detect" == "Fedora" ]; then distro="Fedora"; fi
  235.       if [ "$distro_detect" == "CrunchBang" ]; then distro="CrunchBang"; fi
  236.       if [ "$distro_detect" == "Ubuntu" ]; then distro="Ubuntu"; fi
  237.       if [[ $(lsb_release -r | sed -e 's/Release://' -e 's/\t//g') != "n/a" ]] && [[ ! $distro_release ]]; then distro_release=$(lsb_release -r | sed -e 's/Release://' -e 's/\t//g') && distro_more="$distro $distro_release"; fi
  238.       if [[ $(lsb_release -c | sed -e 's/Codename://' -e 's/\t//g') != "n/a" ]] && [[ ! $distro_codename ]]; then distro_codename=$(lsb_release -c | sed -e 's/Codename://' -e 's/\t//g') && distro_more="$distro $distro_codename"; fi
  239.     else
  240.       if [ -f /etc/debian_version ]; then distro="Debian"; fi
  241.       if grep -i ubuntu /etc/lsb-release >/dev/null 2>&1; then distro="Ubuntu"; fi
  242.       if grep -i mint /etc/lsb-release >/dev/null 2>&1; then
  243.         if grep -i debian /etc/lsb-release >/dev/null 2>&1; then distro="LMDE"
  244.         else distro="Mint"; fi
  245.       fi
  246.       if [ -f /etc/arch-release ]; then distro="Arch Linux"; fi
  247.       if [ -f /etc/fedora-release ]; then distro="Fedora"; fi
  248.       if [ -f /etc/redhat-release ]; then distro="Red Hat Linux"; fi
  249.       if [ -f /etc/slackware-version ]; then distro="Slackware"; fi
  250.       if [ -f /etc/SuSE-release ]; then distro="OpenSuSe"; fi
  251.       if [ -f /etc/mandrake-release ]; then distro="Mandrake"; fi
  252.       if [ -f /etc/mandriva-release ]; then distro="Mandriva"; fi
  253.       if [ -f /etc/crunchbang-lsb-release ]; then distro="CrunchBang"; fi
  254.       if [ -f /etc/gentoo-release ]; then distro="Gentoo"; fi
  255.       if [ -f /var/run/dmesg.boot ] && grep -i bsd /var/run/dmesg.boot; then distro="BSD"; fi
  256.       if [ -f /usr/share/doc/tc/release.txt ]; then distro="Tiny Core"; fi
  257.     fi
  258.   fi
  259.   [[ "$verbosity" -eq "1" ]] && verboseOut "Finding distro...found as '$distro $distro_release'"
  260. }
  261. # Distro Detection - End
  262.  
  263. # Find Number of Running Processes
  264. # processnum="$(( $( ps aux | wc -l ) - 1 ))"
  265.  
  266. # Kernel Version Detection - Begin
  267. detectkernel () {
  268.   kernel=`uname -r`
  269.   [[ "$verbosity" -eq "1" ]] && verboseOut "Finding kernel version...found as '$kernel'"
  270. }
  271. # Kernel Version Detection - End
  272.  
  273.  
  274. # Uptime Detection - Begin
  275. detectuptime () {
  276.   uptime=`awk -F. '{print $1}' /proc/uptime`
  277.   secs=$((${uptime}%60))
  278.   mins=$((${uptime}/60%60))
  279.   hours=$((${uptime}/3600%24))
  280.   days=$((${uptime}/86400))
  281.   uptime="${mins}m"
  282.   if [ "${hours}" -ne "0" ]; then
  283.     uptime="${hours}h ${uptime}"
  284.   fi
  285.   if [ "${days}" -ne "0" ]; then
  286.     uptime="${days}d ${uptime}"
  287.   fi
  288.   [[ "$verbosity" -eq "1" ]] && verboseOut "Finding current uptime...found as '$uptime'"
  289. }
  290. # Uptime Detection - End
  291.  
  292.  
  293. # Shell Detection - Begin
  294. detectshell () {
  295.   myShell=$(echo $SHELL | awk -F"/" '{print $NF}')
  296.   [[ "$verbosity" -eq "1" ]] && verboseOut "Finding current shell...found as '$myShell'"
  297. }
  298. # Shell Detection - End
  299.  
  300.  
  301. # Resolution Detection - Begin
  302. detectres () {
  303.   if [[ -n $DISPLAY ]]; then
  304.     xResolution=$(xdpyinfo | sed -n 's/.*dim.* \([0-9]*x[0-9]*\) .*/\1/pg' | sed ':a;N;$!ba;s/\n/ /g')
  305.   else
  306.     xResolution="No X Server"
  307.   fi
  308.   [[ "$verbosity" -eq "1" ]] && verboseOut "Finding current resolution(s)...found as '$xResolution'"
  309. }
  310. # Resolution Detection - End
  311.  
  312.  
  313. # DE Detection - Begin
  314. detectde () {
  315.   DE="Not Present"
  316.     for each in $denames; do
  317.       if [[ `ps aux` =~ "$each" ]]; then
  318.         [ "$each" == "gnome-session" -o "$each" == "gnome-settings-daemon" ] && DE="GNOME" && DEver=$(gnome-session --version | awk {'print $NF'})
  319.         [ "$each" == "xfce4-session" ] && DE="XFCE" && DEver=$(xfce4-settings-manager --version | grep -m 1 "" | awk {'print $2'})
  320.         [ "$each" == "ksmserver" ] && DE="KDE" && DEver=$(kwin --version | awk '/^Qt/ {data="Qt v" $2};/^KDE/ {data=$2 " (" data ")"};END{print data}')
  321.         [ "$each" == "lxsession" ] && DE="LXDE"
  322.       fi
  323.     done
  324.   [[ "$verbosity" -eq "1" ]] && verboseOut "Finding desktop environment...found as '$DE'"
  325. }
  326. ### DE Detection - End
  327.  
  328.  
  329. # WM Detection - Begin
  330. detectwm () {
  331.   WM="Not Found"
  332.   userId="$(id -u ${USER})"
  333.   for each in $wmnames; do
  334.     PID="$(pgrep -U ${userId} $each)"
  335.     if [ "$PID" ]; then
  336.       case $each in
  337.         'fluxbox') WM="FluxBox";;
  338.         'openbox') WM="OpenBox";;
  339.         'blackbox') WM="Blackbox";;
  340.         'xfwm4') WM="Xfwm4";;
  341.         'metacity') WM="Metacity";;
  342.         'kwin') WM="KWin";;
  343.         'icewm') WM="IceWM";;
  344.         'pekwm') WM="PekWM";;
  345.         'fvwm') WM="FVWM";;
  346.         'dwm') WM="DWM";;
  347.         'awesome') WM="Awesome";;
  348.         'WindowMaker') WM="WindowMaker";;
  349.         'stumpwm') WM="StumpWM";;
  350.         'xmonad') WM="XMonad";;
  351.         'musca') WM="Musca";;
  352.         'i3') WM="i3";;
  353.         'ratpoison') WM="Ratpoison";;
  354.         'scrotwm') WM="ScrotWM";;
  355.         'wmfs') WM="WMFS";;
  356.         'wmii') WM="wmii";;
  357.         'subtle') WM="subtle";;
  358.         'e16') WM="E16";;
  359.         'sawfish') WM="Sawfish";;
  360.         'beryl') WM="Beryl";;
  361.       esac
  362.     fi
  363.   done
  364.   [[ "$verbosity" -eq "1" ]] && verboseOut "Finding window manager...found as '$WM'"
  365. }
  366. # WM Detection - End
  367.  
  368.  
  369. # WM Theme Detection - BEGIN
  370. detectwmtheme () {
  371.   Win_theme="Not Found"
  372.   case $WM in
  373.     'PekWM') if [ -f $HOME/.pekwm/config ]; then Win_theme="$(awk -F"/" '/Theme/ {gsub(/\"/,""); print $NF}' $HOME/.pekwm/config)"; fi;;
  374.     'OpenBox') if [ -f ${XDG_CONFIG_HOME:-${HOME}/.config}/openbox/rc.xml ]; then Win_theme="$(awk -F"[<,>]" '/<theme/ { getline; print $3 }' ${XDG_CONFIG_HOME:-${HOME}/.config}/openbox/rc.xml)"; elif [ -f ${XDG_CONFIG_HOME:-${HOME}/.config}/openbox/lxde-rc.xml ]; then Win_theme="$(awk -F"[<,>]" '/<theme/ { getline; print $3 }' ${XDG_CONFIG_HOME:-${HOME}/.config}/openbox/lxde-rc.xml)"; fi;;
  375.     'FluxBox') if [ -f $HOME/.fluxbox/init ]; then Win_theme="$(awk -F"/" '/styleFile/ {print $NF}' $HOME/.fluxbox/init)"; fi;;
  376.     'BlackBox') if [ -f $HOME/.blackboxrc ]; then Win_theme="$(awk -F"/" '/styleFile/ {print $NF}' $HOME/.blackboxrc)"; fi;;
  377.     'Metacity') if [ "`gconftool-2 -g /apps/metacity/general/theme`" ]; then Win_theme="$(gconftool-2 -g /apps/metacity/general/theme)"; fi ;;
  378.     'Xfwm4') if [ -f ${XDG_CONFIG_HOME:-${HOME}/.config}/xfce4/xfconf/xfce-perchannel-xml/xfwm4.xml ]; then Win_theme="$(xfconf-query -c xfwm4 -p /general/theme)"; fi;;
  379.     'IceWM') if [ -f $HOME/.icewm/theme ]; then Win_theme="$(awk -F"[\",/]" '!/#/ {print $2}' $HOME/.icewm/theme)"; fi;;
  380.     'KWin') if [ -f $HOME/.kde/share/config/kwinrc ]; then Win_theme="$(awk -F"[<,>]" '/<theme/ { getline; print $3 }' ${XDG_CONFIG_HOME:-${HOME}/.config}/openbox/rc.xml)"; fi;;
  381.     'Emerald') if [ -f $HOME/.emerald/theme/theme.ini ]; then Win_theme="$(for a in /usr/share/emerald/themes/* $HOME/.emerald/themes/*; do cmp "$HOME/.emerald/theme/theme.ini" "$a/theme.ini" &>/dev/null && basename "$a"; done)"; fi;;
  382.     'FVWM') Win_theme="Not Present";;
  383.     'DWM') Win_theme="Not Present";;
  384.     'Awesome') if [ -f ${XDG_CONFIG_HOME:-${HOME}/.config}/awesome/rc.lua ]; then Win_theme="$(grep -e '^[^-].*\(theme\|beautiful\).*lua' ${XDG_CONFIG_HOME:-${HOME}/.config}/awesome/rc.lua | grep '[a-zA-Z0-9]\+/[a-zA-Z0-9]\+.lua' -o | cut -d'/' -f1)"; fi;;
  385.     'WindowMaker') Win_theme="Not Present";;
  386.     'XMonad') Win_theme="Not Present";;
  387.     'Musca') Win_theme="Not Present";;
  388.     'i3') Win_theme="Not Present";;
  389.     'Ratpoison') Win_theme="Not Present";;
  390.     'ScrotWM') Win_theme="Not Present";;
  391.     'WMFS') Win_theme="Not Present";;
  392.     'wmii') Win_theme="Not Present";;
  393.     'subtle') Win_theme="Not Present";;
  394.     'E16') Win_theme="$(awk -F"= " '/theme.name/ {print $2}' $HOME/.e16/e_config--0.0.cfg)";;
  395.     'Sawfish') Win_theme="$(awk -F")" '/\(custom-set-typed-variable/{print $2}' $HOME/.sawfish/custom | sed 's/ (quote //')";;
  396.    'Beryl') Win_theme="Not Present";;
  397.    esac
  398.  [[ "$verbosity" -eq "1" ]] && verboseOut "Finding window manager theme...found as '$Win_theme'"
  399. }
  400. # WM Theme Detection - END
  401.  
  402. # GTK Theme\Icon\Font Detection - BEGIN
  403. detectgtk () {
  404.  gtkTheme="Not Found"
  405.  gtkIcons="Not Found"
  406.  gtkFont="Not Found"
  407.  case $DE in
  408.    'KDE')  # Desktop Environment found as "KDE"
  409.          if [ -a $HOME/.kde/share/config/kdeglobals ]; then
  410.            if grep -q "widgetStyle=" $HOME/.kde/share/config/kdeglobals; then
  411.              gtkTheme=$(awk -F"=" '/widgetStyle=/ {print $2}' $HOME/.kde/share/config/kdeglobals)
  412.            elif grep -q "colorScheme=" $HOME/.kde/share/config/kdeglobals; then
  413.              gtkTheme=$(awk -F"=" '/colorScheme=/ {print $2}' $HOME/.kde/share/config/kdeglobals)
  414.            fi
  415.  
  416.            if grep -q "Theme=" $HOME/.kde/share/config/kdeglobals; then
  417.              gtkIcons=$(awk -F"=" '/Theme=/ {print $2}' $HOME/.kde/share/config/kdeglobals)
  418.            fi
  419.  
  420.            if grep -q "Font=" $HOME/.kde/share/config/kdeglobals; then
  421.              gtkFont=$(awk -F"=" '/Font=/ {print $2}' $HOME/.kde/share/config/kdeglobals)
  422.            fi
  423.          fi
  424.  ;;
  425.  'GNOME')  # Desktop Environment found as "GNOME"
  426.          if which gconftool-2 >/dev/null 2>&1; then
  427.            gtkTheme=$(gconftool-2 -g /desktop/gnome/interface/gtk_theme)
  428.          fi
  429.  
  430.          if which gconftool-2 >/dev/null 2>&1; then
  431.              gtkIcons=$(gconftool-2 -g /desktop/gnome/interface/icon_theme)
  432.          fi
  433.  
  434.          if which gconftool-2 >/dev/null 2>&1; then
  435.            gtkFont=$(gconftool-2 -g /desktop/gnome/interface/font_name)
  436.          fi
  437.           if [ "$background_detect" == "1" ]; then
  438.            if which gconftool-2 >/dev/null 2>&1; then
  439.              gtkBackgroundFull=$(gconftool-2 -g /desktop/gnome/background/picture_filename)
  440.               gtkBackground=$(echo "$gtkBackgroundFull" | awk -F"/" '{print $NF}')
  441.            fi
  442.           fi
  443.  ;;
  444.  'XFCE')  # Desktop Environment found as "XFCE"
  445.         if which xfconf-query >/dev/null 2>&1; then
  446.           gtkTheme=$(xfconf-query -c xsettings -p /Net/ThemeName)
  447.         fi
  448.  
  449.         if which xfconf-query >/dev/null 2>&1; then
  450.           gtkIcons=$(xfconf-query -c xsettings -p /Net/IconThemeName)
  451.         fi
  452.  
  453.         if which xfconf-query >/dev/null 2>&1; then
  454.           gtkFont=$(xfconf-query -c xsettings -p /Gtk/FontName)
  455.         fi
  456.  ;;
  457.  
  458. # /home/me/.config/rox.sourceforge.net/ROX-Session/Settings.xml
  459.  
  460.  *) # Lightweight or No DE Found
  461.    if [ -f $HOME/.gtkrc-2.0 ]; then
  462.      if grep -q gtk-theme $HOME/.gtkrc-2.0; then
  463.         gtkTheme=$(awk -F'"' '/gtk-theme/ {print $2}' $HOME/.gtkrc-2.0)
  464.      fi
  465.  
  466.      if grep -q icon-theme $HOME/.gtkrc-2.0; then
  467.          gtkIcons=$(awk -F'"' '/icon-theme/ {print $2}' $HOME/.gtkrc-2.0)
  468.      fi
  469.  
  470.      if grep -q font $HOME/.gtkrc-2.0; then
  471.          gtkFont=$(awk -F'"' '/gtk-font-name/ {print $2}' $HOME/.gtkrc-2.0)
  472.      fi
  473.    # LXDE
  474.    elif [ -f ${XDG_CONFIG_HOME:-${HOME}/.config}/lxde/config ]; then
  475.      if grep -q "sNet\/ThemeName" ${XDG_CONFIG_HOME:-${HOME}/.config}/lxde/config; then
  476.         gtkTheme=$(awk -F'=' '/sNet\/ThemeName/ {print $2}' ${XDG_CONFIG_HOME:-${HOME}/.config}/lxde/config)
  477.      fi
  478.  
  479.      if grep -q IconThemeName ${XDG_CONFIG_HOME:-${HOME}/.config}/lxde/config; then
  480.          gtkIcons=$(awk -F'=' '/sNet\/IconThemeName/ {print $2}' ${XDG_CONFIG_HOME:-${HOME}/.config}/lxde/config)
  481.      fi
  482.  
  483.      if grep -q FontName ${XDG_CONFIG_HOME:-${HOME}/.config}/lxde/config; then
  484.          gtkFont=$(awk -F'=' '/sGtk\/FontName/ {print $2}' ${XDG_CONFIG_HOME:-${HOME}/.config}/lxde/config)
  485.      fi
  486.    fi
  487.    # $HOME/.gtkrc.mine theme detect only
  488.    if [ -f $HOME/.gtkrc.mine ]; then
  489.      if grep -q "^include" $HOME/.gtkrc.mine; then
  490.        gtkTheme=$(grep '^include.*gtkrc' $HOME/.gtkrc.mine | awk -F "/" '{ print $5 }')
  491.      fi
  492.      if grep -q "^gtk-icon-theme-name" $HOME/.gtkrc.mine; then
  493.        gtkIcons=$(grep 'gtk-icon-theme-name' $HOME/.gtkrc.mine | awk -F '"' '{print $2}')
  494.      fi
  495.    fi
  496.    # ROX-Filer icon detect only
  497.    if [ -a ${XDG_CONFIG_HOME:-${HOME}/.config}/rox.sourceforge.net/ROX-Filer/Options ]; then
  498.      gtkIcons=$(awk -F'[>,<]' '/icon_theme/ {print $3}' ${XDG_CONFIG_HOME:-${HOME}/.config}/rox.sourceforge.net/ROX-Filer/Options)
  499.    fi
  500.    # Background Detection (feh, nitrogen)
  501.    if [ "$background_detect" == "1" ]; then
  502.      if [ -a $HOME/.fehbg ]; then
  503.        gtkBackgroundFull=$(awk -F"'" '/feh --bg/{print $2}' $HOME/.fehbg 2>/dev/null)
  504.        gtkBackground=$(echo "$gtkBackgroundFull" | awk -F"/" '{print $NF}')
  505.      elif [ -a ${XDG_CONFIG_HOME:-${HOME}/.config}/nitrogen/bg-saved.cfg ]; then
  506.        gtkBackground=$(awk -F"/" '/file=/ {print $NF}' ${XDG_CONFIG_HOME:-${HOME}/.config}/nitrogen/bg-saved.cfg)
  507.      fi
  508.    fi
  509.  ;;
  510.  esac
  511.  if [[ "$verbosity" -eq "1" ]]; then
  512.    verboseOut "Finding GTK theme...found as '$gtkTheme'"
  513.    verboseOut "Finding icon theme...found as '$gtkIcons'"
  514.    verboseOut "Finding user font...found as '$gtkFont'"
  515.    [[ $gtkBackground ]] && verboseOut "Finding background...found as '$gtkBackground'"
  516.  fi
  517. }
  518. # GTK Theme\Icon\Font Detection - END
  519.  
  520. #######################
  521. # End Detection Phase
  522. #######################
  523.  
  524. takeShot () {
  525.  if [[ -z $screenCommand ]]; then
  526.    if [[ "$hostshot" == "1" ]]; then
  527.      scrot -cd3 "${shotfile}"
  528.      if [ -f "${shotfile}" ]; then
  529.         [[ "$verbosity" -eq "1" ]] && verboseOut "Screenshot saved at '${shotfile}'"
  530.         scp -qo ConnectTimeout="${scptimeout}" "${shotfile}" "${serveraddr}:${serverdir}"
  531.         echo -e "${bold}==>${c0} Your screenshot can be viewed at ${baseurl}/$shotfile"
  532.      else
  533.        verboseOut "ERROR: Problem saving screenshot to ${shotfile}"
  534.      fi
  535.    else
  536.      scrot -cd3 "${shotfile}"
  537.      if [ -f "${shotfile}" ]; then
  538.         [[ "$verbosity" -eq "1" ]] && verboseOut "Screenshot saved at '${shotfile}'"
  539.      else
  540.        verboseOut "ERROR: Problem saving screenshot to ${shotfile}"
  541.      fi
  542.    fi
  543.  else
  544.    $screenCommand
  545.  fi
  546. }
  547.  
  548.  
  549. asciiText () {
  550. # Distro logos and ASCII outputs
  551. case $distro in
  552.  "Arch Linux - Old")
  553.    [ -z $c1 ] && c1="\e[1;37m" # White
  554.    c2="\e[1;34m" # Light Blue
  555.    startline="1"
  556.    fulloutput=("$c1              __"
  557. "$c1          _=(SDGJT=_                  %s"
  558. "$c1        _GTDJHGGFCVS)                %s"
  559. "$c1       ,GTDJGGDTDFBGX0               %s"
  560. "$c1      JDJDIJHRORVFSBSVL$c2-=+=,_        %s"
  561. "$c1     IJFDUFHJNXIXCDXDSV,$c2  \"DEBL      %s"
  562. "$c1    [LKDSDJTDU=OUSCSBFLD.$c2   '?ZWX,   %s"
  563. "$c1   ,LMDSDSWH'     \`DCBOSI$c2     DRDS], %s"
  564. "$c1   SDDFDFH'         !YEWD,$c2   )HDROD  %s"
  565. "$c1  !KMDOCG            &GSU|$c2\_GFHRGO\' %s"
  566. "$c1  HKLSGP'$c2           __$c1\TKM0$c2\GHRBV)'  %s"
  567. "$c1 JSNRVW'$c2       __+MNAEC$c1\IOI,$c2\BN'     %s"
  568. "$c1 HELK['$c2    __,=OFFXCBGHC$c1\FD)         %s"
  569. "$c1 ?KGHE $c2\_-#DASDFLSV='$c1    'EF         %s"
  570. "$c1 'EHTI                    !H"
  571. "$c1  \`0F'                    '!")
  572.  ;;
  573.  
  574.  "Arch Linux")
  575.    [ -z $c1 ] && c1="\e[1;36m" # Light
  576.    c2="\e[0;36m" # Dark
  577.    startline="3"
  578.    fulloutput=("${c1}                   -\`"
  579. "${c1}                  .o+\`"
  580. "${c1}                 \`ooo/"
  581. "${c1}                \`+oooo:               %s"
  582. "${c1}               \`+oooooo:             %s"
  583. "${c1}               -+oooooo+:            %s"
  584. "${c1}             \`/:-:++oooo+:           %s"
  585. "${c1}            \`/++++/+++++++:          %s"
  586. "${c1}           \`/++++++++++++++:         %s"
  587. "${c1}          \`/+++o"${c2}"oooooooo"${c1}"oooo/\`       %s"
  588. "${c2}         "${c1}"./"${c2}"ooosssso++osssssso"${c1}"+\`      %s"
  589. "${c2}        .oossssso-\`\`\`\`/ossssss+\`     %s"
  590. "${c2}       -osssssso.      :ssssssso.    %s"
  591. "${c2}      :osssssss/        osssso+++.   %s"
  592. "${c2}     /ossssssss/        +ssssooo/-   %s"
  593. "${c2}   \`/ossssso+/:-        -:/+osssso+- %s"
  594. "${c2}  \`+sso+:-\`                 \`.-/+oso:"
  595. "${c2} \`++:.                           \`-/+/"
  596. "${c2} .\`                                 \`/")
  597.  ;;
  598.  
  599.  "Mint")
  600.    [ -z $c1 ] && c1="\e[1;37m" # White
  601.    c2="\e[1;32m" # Bold Green
  602.    startline="1"
  603.    fulloutput=("$c2 MMMMMMMMMMMMMMMMMMMMMMMMMmds+."
  604. "$c2 MMm----::-://////////////oymNMd+\`       %s"
  605. "$c2 MMd      "$c1"/++                "$c2"-sNMd:   %s"
  606. "$c2 MMNso/\`  "$c1"dMM    \`.::-. .-::.\` "$c2".hMN:  %s"
  607. "$c2 ddddMMh  "$c1"dMM   :hNMNMNhNMNMNh: "$c2"\`NMm  %s"
  608. "$c2     NMm  "$c1"dMM  .NMN/-+MMM+-/NMN\` "$c2"dMM  %s"
  609. "$c2     NMm  "$c1"dMM  -MMm  \`MMM   dMM. "$c2"dMM  %s"
  610. "$c2     NMm  "$c1"dMM  -MMm  \`MMM   dMM. "$c2"dMM  %s"
  611. "$c2     NMm  "$c1"dMM  .mmd  \`mmm   yMM. "$c2"dMM  %s"
  612. "$c2     NMm  "$c1"dMM\`  ..\`   ...   ydm. "$c2"dMM  %s"
  613. "$c2     hMM- "$c1"+MMd/-------...-:sdds  "$c2"dMM  %s"
  614. "$c2     -NMm- "$c1":hNMNNNmdddddddddy/\`  "$c2"dMM  %s"
  615. "$c2      -dMNs-"$c1"\`\`-::::-------.\`\`    "$c2"dMM  %s"
  616. "$c2       \`/dMNmy+/:-------------:/yMMM  %s"
  617. "$c2          ./ydNMMMMMMMMMMMMMMMMMMMMM")
  618.  ;;
  619.  
  620.  
  621.  "LMDE")
  622.    [ -z $c1 ] && c1="\e[1;37m" # White
  623.    c2="\e[1;32m" # Bold Green
  624.    startline="2"
  625.    fulloutput=("          "${c1}"\`.-::---.."
  626. "${c2}       .:++++ooooosssoo:."
  627. "${c2}     .+o++::.      \`.:oos+.     %s"
  628. "${c2}    :oo:.\`             -+oo"${c1}":   %s"
  629. "${c2}  "${c1}"\`"${c2}"+o/\`    ."${c1}"::::::"${c2}"-.    .++-"${c1}"\`  %s"
  630. "${c2} "${c1}"\`"${c2}"/s/    .yyyyyyyyyyo:   +o-"${c1}"\`  %s"
  631. "${c2} "${c1}"\`"${c2}"so     .ss       ohyo\` :s-"${c1}":  %s"
  632. "${c2} "${c1}"\`"${c2}"s/     .ss  h  m  myy/ /s\`"${c1}"\`  %s"
  633. "${c2} \`s:     \`oo  s  m  Myy+-o:\`   %s"
  634. "${c2} \`oo      :+sdoohyoydyso/.     %s"
  635. "${c2}  :o.      .:////////++:       %s"
  636. "${c2}  \`/++        "${c1}"-:::::-          %s"
  637. "${c2}   "${c1}"\`"${c2}"++-                        %s"
  638. "${c2}    "${c1}"\`"${c2}"/+-                       %s"
  639. "${c2}      "${c1}"."${c2}"+/.                     %s"
  640. "${c2}        "${c1}"."${c2}":+-."
  641. "${c2}           \`--.\`\`")
  642.  ;;
  643.  
  644.  "Ubuntu")
  645.    [ -z $c1 ] && c1="\e[1;37m" # White
  646.    c2="\e[1;31m" # Light Red
  647.    c3="\e[1;33m" # Bold Yellow
  648.    startline="2"
  649.    fulloutput=("$c2                          ./+o+-"
  650. "$c1                  yyyyy- $c2-yyyyyy+"
  651. "$c1               $c1://+//////$c2-yyyyyyo      %s"
  652. "$c3           .++ $c1.:/++++++/-$c2.+sss/\`     %s"
  653. "$c3         .:++o:  $c1/++++++++/:--:/-     %s"
  654. "$c3        o:+o+:++.$c1\`..\`\`\`.-/oo+++++/    %s"
  655. "$c3       .:+o:+o/.$c1          \`+sssoo+/   %s"
  656. "$c1  .++/+:$c3+oo+o:\`$c1             /sssooo.  %s"
  657. "$c1 /+++//+:$c3\`oo+o$c1               /::--:.  %s"
  658. "$c1 \+/+o+++$c3\`o++o$c2               ++////.  %s"
  659. "$c1  .++.o+$c3++oo+:\`$c2             /dddhhh.  %s"
  660. "$c3       .+.o+oo:.$c2          \`oddhhhh+   $mygtk"
  661. "$c3        \+.++o+o\`\`-\`\`$c2\`\`.:ohdhhhhh+    %s"
  662. "$c3         \`:o+++ $c2\`ohhhhhhhhyo++os:     %s"
  663. "$c3           .o:$c2\`.syhhhhhhh/$c3.oo++o\`     %s"
  664. "$c2               /osyyyyyyo$c3++ooo+++/"
  665. "$c2                   \`\`\`\`\` $c3+oo+++o\:"
  666. "$c3                          \`oo++.")
  667.  ;;
  668.  
  669.  "Debian")
  670.    [ -z $c1 ] && c1="\e[1;37m" # White
  671.    c2="\e[1;31m" # Light Red
  672.    startline="2"
  673.    fulloutput=("  $c1       _,met\$\$\$\$\$gg."
  674. "  $c1    ,g\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$P."
  675. "  $c1  ,g\$\$P\"\"       \"\"\"Y\$\$.\".\t %s"
  676. "  $c1 ,\$\$P'              \`\$\$\$.\t%s"
  677. "  $c1',\$\$P       ,ggs.     \`\$\$b:\t%s"
  678. "  $c1\`d\$\$'     ,\$P\"\'   $c2.$c1    \$\$\$\t%s"
  679. "  $c1 \$\$P      d\$\'     $c2,$c1    \$\$P\t%s"
  680. "  $c1 \$\$:      \$\$.   $c2-$c1    ,d\$\$'\t%s"
  681. "  $c1 \$\$\;      Y\$b._   _,d\$P'\t%s"
  682. "  $c1 Y\$\$.    $c2\`.$c1\`\"Y\$\$\$\$P\"'\t\t%s"
  683. "  $c1 \`\$\$b      $c2\"-.__\t\t%s"
  684. "  $c1  \`Y\$\$\t\t\t%s"
  685. "  $c1   \`Y\$\$.\t\t\t%s"
  686. "  $c1     \`\$\$b.\t\t\t%s"
  687. "  $c1       \`Y\$\$b.\t\t\t%s"
  688. "  $c1          \`\"Y\$b._"
  689. "  $c1              \`\"\"\"\"")
  690.  ;;
  691.  
  692.  "CrunchBang")
  693.    [ -z $c1 ] && c1="\e[1;37m" # White
  694.    c2="\e[1;30m" # Dark Gray
  695.    startline="1"
  696.    fulloutput=("$c1                ___       ___      _"
  697. "$c1               /  /      /  /     | |  %s"
  698. "$c1              /  /      /  /      | | %s"
  699. "$c1             /  /      /  /       | | %s"
  700. "$c1     _______/  /______/  /______  | | %s"
  701. "$c1    /______   _______   _______/  | | %s"
  702. "$c1          /  /      /  /          | | %s"
  703. "$c1         /  /      /  /           | | %s"
  704. "$c1        /  /      /  /            | | %s"
  705. "$c1 ______/  /______/  /______       | | %s"
  706. "$c1/_____   _______   _______/       | | %s"
  707. "$c1     /  /      /  /               |_| %s"
  708. "$c1    /  /      /  /                 _  %s"
  709. "$c1   /  /      /  /                 | | %s"
  710. "$c1  /__/      /__/                  |_|")
  711.  ;;
  712.  
  713.  "Gentoo")
  714.    [ -z $c1 ] && c1="\e[1;37m" # White
  715.    c2="\e[1;35m" # Light Purple
  716.    startline="2"
  717.    fulloutput=("$c2         -/oyddmdhs+:."
  718. "$c2     -o"$c1"dNMMMMMMMMNNmhy+"$c2"-\`"
  719. "$c2   -y"$c1"NMMMMMMMMMMMNNNmmdhy"$c2"+-           %s"
  720. "$c2 \`o"$c1"mMMMMMMMMMMMMNmdmmmmddhhy"$c2"/\`       %s"
  721. "$c2 om"$c1"MMMMMMMMMMMN"$c2"hhyyyo"$c1"hmdddhhhd"$c2"o\`     %s"
  722. "$c2.y"$c1"dMMMMMMMMMMd"$c2"hs++so/s"$c1"mdddhhhhdm"$c2"+\`   %s"
  723. "$c2 oy"$c1"hdmNMMMMMMMN"$c2"dyooy"$c1"dmddddhhhhyhN"$c2"d.  %s"
  724. "$c2  :o"$c1"yhhdNNMMMMMMMNNNmmdddhhhhhyym"$c2"Mh  %s"
  725. "$c2    .:"$c1"+sydNMMMMMNNNmmmdddhhhhhhmM"$c2"my  %s"
  726. "$c2       /m"$c1"MMMMMMNNNmmmdddhhhhhmMNh"$c2"s:  %s"
  727. "$c2    \`o"$c1"NMMMMMMMNNNmmmddddhhdmMNhs"$c2"+\`   %s"
  728. "$c2  \`s"$c1"NMMMMMMMMNNNmmmdddddmNMmhs"$c2"/.     %s"
  729. "$c2 /N"$c1"MMMMMMMMNNNNmmmdddmNMNdso"$c2":\`       %s"
  730. "$c2+M"$c1"MMMMMMNNNNNmmmmdmNMNdso"$c2"/-          %s"
  731. "$c2yM"$c1"MNNNNNNNmmmmmNNMmhs+/"$c2"-\`              %s"
  732. "$c2/h"$c1"MMNNNNNNNNMNdhs++/"$c2"-\`"
  733. "$c2\`/"$c1"ohdmmddhys+++/:"$c2".\`"
  734. "$c2  \`-//////:--.")
  735.  ;;
  736.  
  737.  "Fedora")
  738.    [ -z $c1 ] && c1="\e[1;37m" # White
  739.    c2="\e[1;34m" # Light Blue
  740.    startline="3"
  741.    fulloutput=("$c2           :/------------://"
  742. "$c2        :------------------://"
  743. "$c2      :-----------"$c1"/shhdhyo/"$c2"-://"
  744. "$c2    /-----------"$c1"omMMMNNNMMMd/"$c2"-:/      %s"
  745. "$c2   :-----------"$c1"sMMMdo:/"$c2"       -:/    %s"
  746. "$c2  :-----------"$c1":MMMd"$c2"-------    --:/   %s"
  747. "$c2  /-----------"$c1":MMMy"$c2"-------    ---/   %s"
  748. "$c2 :------    --"$c1"/+MMMh/"$c2"--        ---:  %s"
  749. "$c2 :---     "$c1"oNMMMMMMMMMNho"$c2"     -----:  %s"
  750. "$c2 :--      "$c1"+shhhMMMmhhy++"$c2"   ------:   %s"
  751. "$c2 :-      -----"$c1":MMMy"$c2"--------------/   %s"
  752. "$c2 :-     ------"$c1"/MMMy"$c2"-------------:    %s"
  753. "$c2 :-      ----"$c1"/hMMM+"$c2"------------:     %s"
  754. "$c2 :--"$c1":dMMNdhhdNMMNo"$c2"-----------:       %s"
  755. "$c2 :---"$c1":sdNMMMMNds:"$c2"----------:         %s"
  756. "$c2 :------"$c1":://:"$c2"-----------://          %s"
  757. "$c2 :--------------------://")
  758.  ;;
  759.  
  760.  "BSD")
  761.    [ -z $c1 ] && c1="\e[1;37m" # White
  762.    c2="\e[1;31m" # Light Red
  763.    startline="4"
  764.    fulloutput=("$c2              ,        ,"
  765. "$c2             /(        )\`"
  766. "$c2             \ \___   / |"
  767. "$c2             /- "$c1"_$c2  \`-/  '"
  768. "$c2            ($c1/\/ \ $c2\   /\\       %s"
  769. "$c1            / /   |$c2 \`    \\     %s"
  770. "$c1            O O   )$c2 /    |     %s"
  771. "$c1            \`-^--'\`$c2<     '     %s"
  772. "$c2           (_.)  _  )   /      %s"
  773. "$c2            \`.___/\`    /       %s"
  774. "$c2              \`-----' /        %s"
  775. "$c1 <----.     "$c2"__/ __   \\         %s"
  776. "$c1 <----|===="$c2"O}}}$c1==$c2} \} \/$c1====   %s"
  777. "$c1 <----'    $c2\`--' \`.__,' \\       %s"
  778. "$c2              |        |       %s"
  779. "$c2               \       /       /\\ %s"
  780. "$c2          ______( (_  / \______/  %s"
  781. "$c2        ,'  ,-----'   |"
  782. "$c2        \`--{__________)")
  783.  ;;
  784.  
  785.  "Mandriva"|"Mandrake")
  786.    c1="\e[1;34m" # Light Blue
  787.    c2="\e[1;33m" # Bold Yellow
  788.    startline="1"
  789.    fulloutput=("$c2                         \`\`"
  790. "$c2                        \`-.                 %s"
  791. "$c1       \`               $c2.---                %s"
  792. "$c1     -/               $c2-::--\`               %s"
  793. "$c1   \`++    $c2\`----...\`\`\`-:::::.               %s"
  794. "$c1  \`os.      $c2.::::::::::::::-\`\`\`     \`  \`   %s"
  795. "$c1  +s+         $c2.::::::::::::::::---...--\`   %s"
  796. "$c1 -ss:          $c2\`-::::::::::::::::-.\`\`.\`\`   %s"
  797. "$c1 /ss-           $c2.::::::::::::-.\`\`   \`      %s"
  798. "$c1 +ss:          $c2.::::::::::::-              %s"
  799. "$c1 /sso         $c2.::::::-::::::-              %s"
  800. "$c1 .sss/       $c2-:::-.\`   .:::::              %s"
  801. "$c1  /sss+.    $c2..\`$c1  \`--\`    $c2.:::              %s"
  802. "$c1   -ossso+/:://+/-\`        $c2.:\`             %s"
  803. "$c1     -/+ooo+/-.              $c2\`")
  804.  ;;
  805.  
  806.  "OpenSuSe")
  807.    c1="\e[1;32m" # Bold Green
  808.    c2="\e[1;37m" # Bold White
  809.    startline="3"
  810.    fulloutput=("$c2             .;ldkO0000Okdl;."
  811. "$c2         .;d00xl:,'....';:ok00d;."
  812. "$c2       .d00l'                ,o00d."
  813. "$c2     .d0Kd."$c1" :Okxol:;'.          "$c2":O0d.        %s"
  814. "$c2    'OK"$c1"KKK0kOKKKKKKKKKKOxo:'      "$c2"lKO'      %s"
  815. "$c2   ,0K"$c1"KKKKKKKKKKKKKKK0d:"$c2",,,"$c1":dx:"$c2"    ;00,     %s"
  816. "$c2  .OK"$c1"KKKKKKKKKKKKKKKk."$c2".oOkdl."$c1"'0k."$c2"   cKO.    %s"
  817. "$c2  :KK"$c1"KKKKKKKKKKKKKKK: "$c2"kKx..od "$c1"lKd"$c2"   .OK:    %s"
  818. "$c2  dKK"$c1"KKKKKKKKKOx0KKKd "$c2";0KKKO, "$c1"kKKc"$c2"   dKd    %s"
  819. "$c2  dKK"$c1"KKKKKKKKKK;.;oOKx,.."$c2"'"$c1"..;kKKK0."$c2"  dKd    %s"
  820. "$c2  :KK"$c1"KKKKKKKKKK0o;...;cdxxOK0Oxc,.  "$c2".0K:    %s"
  821. "$c2   kKK"$c1"KKKKKKKKKKKKK0xl;'......,cdo  "$c2"lKk     %s"
  822. "$c2   '0K"$c1"KKKKKKKKKKKKKKKKKKKK00KKOo;  "$c2"c00'     %s"
  823. "$c2    .kK"$c1"KKOxddxkOO00000Okxoc;'.   "$c2".dKk.      %s"
  824. "$c2      l0Ko.                    .c00l.       %s"
  825. "$c2       .l0Kk:.              .;xK0l.         %s"
  826. "$c2          ,lkK0xl:;,,,,;:ldO0kl,"
  827. "$c2              .':ldxkkkkxdl:'.")
  828.  ;;
  829.  
  830.  "Slackware")
  831.    c1="\e[1;35m" # Light Purple
  832.    c2="\e[1;37m" # Bold White
  833.    startline="4"
  834.    fulloutput=("$c1                   :::::::"
  835. "$c1             :::::::::::::::::::"
  836. "$c1          :::::::::::::::::::::::::"
  837. "$c1        ::::::::"${c2}"cllcccccllllllll"${c1}"::::::"
  838. "$c1     :::::::::"${c2}"lc               dc"${c1}":::::::         %s"
  839. "$c1    ::::::::"${c2}"cl   clllccllll    oc"${c1}":::::::::      %s"
  840. "$c1   :::::::::"${c2}"o   lc"${c1}"::::::::"${c2}"co   oc"${c1}"::::::::::     %s"
  841. "$c1  ::::::::::"${c2}"o    cccclc"${c1}":::::"${c2}"clcc"${c1}"::::::::::::    %s"
  842. "$c1  :::::::::::"${c2}"lc        cclccclc"${c1}":::::::::::::    %s"
  843. "$c1 ::::::::::::::"${c2}"lcclcc          lc"${c1}"::::::::::::   %s"
  844. "$c1 ::::::::::"${c2}"cclcc"${c1}":::::"${c2}"lccclc     oc"${c1}":::::::::::   %s"
  845. "$c1 ::::::::::"${c2}"o    l"${c1}"::::::::::"${c2}"l    lc"${c1}":::::::::::   %s"
  846. "$c1  :::::"${c2}"cll"${c1}":"${c2}"o     clcllcccll     o"${c1}":::::::::::    %s"
  847. "$c1  :::::"${c2}"occ"${c1}":"${c2}"o                  clc"${c1}":::::::::::    %s"
  848. "$c1   ::::"${c2}"ocl"${c1}":"${c2}"ccslclccclclccclclc"${c1}":::::::::::::     %s"
  849. "$c1    :::"${c2}"oclcccccccccccccllllllllllllll"${c1}":::::      %s"
  850. "$c1     ::"${c2}"lcc1lcccccccccccccccccccccccco"${c1}"::::       %s"
  851. "$c1       ::::::::::::::::::::::::::::::::     %s"
  852. "$c1         ::::::::::::::::::::::::::::"
  853. "$c1            ::::::::::::::::::::::"
  854. "$c1                 ::::::::::::")
  855.  ;;
  856.  
  857.  "Red Hat Linux")
  858.    [ -z $c1 ] && c1="\e[1;37m" # White
  859.    c2="\e[1;31m" # Light Red
  860.    startline="2"
  861.    fulloutput=("$c2              \`.-..........\`"
  862. "$c2             \`////////::.\`-/."
  863. "$c2             -: ....-////////.               %s"
  864. "$c2             //:-::///////////\`             %s"
  865. "$c2      \`--::: \`-://////////////:             %s"
  866. "$c2      //////-    \`\`.-:///////// .\`          %s"
  867. "$c2      \`://////:-.\`    :///////::///:\`       %s"
  868. "$c2        .-/////////:---/////////////:       %s"
  869. "$c2           .-://////////////////////.       %s"
  870. "$c1          yMN+\`.-$c2::///////////////-\`        %s"
  871. "$c1       .-\`:NMMNMs\`  \`..-------..\`           %s"
  872. "$c1        MN+/mMMMMMhoooyysshsss              %s"
  873. "$c1 MMM    MMMMMMMMMMMMMMyyddMMM+              %s"
  874. "$c1  MMMM   MMMMMMMMMMMMMNdyNMMh\`     hyhMMM   %s"
  875. "$c1   MMMMMMMMMMMMMMMMyoNNNMMM+.   MMMMMMMM    %s"
  876. "$c1    MMNMMMNNMMMMMNM+ mhsMNyyyyMNMMMMsMM")
  877.  ;;
  878.  
  879.  
  880.  
  881.  *)
  882.    [ -z $c1 ] && c1="\e[1;37m" # White
  883.    c2="\e[1;30m" # Light Gray
  884.    c3="\e[1;33m" # Light Yellow
  885.    startline="0"
  886.    fulloutput=("                             %s"
  887. "$c2         #####$c0              %s"
  888. "$c2        #######             %s"
  889. "$c2        ##"$c1"O$c2#"$c1"O$c2##             %s"
  890. "$c2        #$c3#####$c2#             %s"
  891. "$c2      ##$c1##$c3###$c1##$c2##           %s"
  892. "$c2     #$c1##########$c2##          %s"
  893. "$c2    #$c1############$c2##         %s"
  894. "$c2    #$c1############$c2###        %s"
  895. "$c3   ##$c2#$c1###########$c2##$c3#        %s"
  896. "$c3 ######$c2#$c1#######$c2#$c3######      %s"
  897. "$c3 #######$c2#$c1#####$c2#$c3#######      %s"
  898. "$c3   #####$c2#######$c3#####        %s"
  899. "$c0")
  900.  ;;
  901. esac
  902.  
  903. # Truncate lines based on terminal width.
  904. if [ "$truncateSet" == "Yes" ]; then
  905.         n=${#fulloutput[*]}
  906.         for ((i=0;i<n;i++)); do
  907.                 targetPercent=100
  908.                 termWidth=$(tput cols)
  909.                 # stringReal=$(echo "${fulloutput[i]}" | sed -e 's/\x1b\[[0-9];[0-9]*m\?//g')
  910.                 stringReal=$(echo "${fulloutput[i]}" | sed -e 's/\\e\[[0-9];[0-9]*m//g' -e 's/\\e\[[0-9]*m//g')
  911.                 stringLength=${#stringReal}
  912.                 targetLength="$((termWidth*targetPercent/100))"
  913.                 if [ "$stringLength" -le "$targetLength" ]; then
  914.                         echo -e "${fulloutput[i]}"$c0
  915.                 elif [ "$stringLength" -gt "$targetLength" ]; then
  916.                         echo "${fulloutput[i]:0:$targetLength}..."$c0
  917.                 fi
  918.                 # Debugging widths
  919.                 # echo "Term Width: $termWidth"
  920.                 # echo "String Length: $stringLength"
  921.         done
  922. else
  923.         n=${#fulloutput[*]}
  924.         for ((i=0;i<n;i++)); do
  925.                 # echo "${out_array[@]}"
  926.                 printf "${fulloutput[i]}$c0\n" "${out_array}"
  927.                 if [[ "$i" -ge "$startline" ]]; then
  928.                         unset out_array[0]
  929.                         out_array=( "${out_array[@]}" )
  930.                 fi
  931.         done
  932. fi
  933. # Done with ASCII output
  934. }
  935.  
  936. infoDisplay () {
  937.  if [ -z "$textcolor" ]; then textcolor="\e[0m"; fi
  938.  if [ -z "$labelcolor" ]; then
  939.    case $distro in
  940.      "Arch Linux - Old"|"Fedora"|"Mandriva"|"Mandrake") labelcolor="\e[1;34m";;
  941.      "Arch Linux") labelcolor="\e[1;36m";;
  942.      "Mint"|"LMDE"|"OpenSuSe") labelcolor="\e[1;32m";;
  943.      "Ubuntu"|"Debian"|"BSD"|"Red Hat Linux") labelcolor="\e[1;31m";;
  944.      "CrunchBang") labelcolor="\e[1;30m";;
  945.      "Gentoo"|"Slackware") labelcolor="\e[1;35m";;
  946.      *) labelcolor="\e[1;33m";;
  947.    esac
  948.  fi
  949.  # Some verbosity stuff
  950.  [[ "$verbosity" == "1" ]] && [[ "$screenshot" == "1" ]] && verboseOut "Screenshot will be taken after info is displayed."
  951.  [[ "$verbosity" == "1" ]] && [[ "$hostshot" == "1" ]] && verboseOut "Screenshot will be transferred/uploaded to specified location."
  952.  #########################
  953.  # Info Variable Setting #
  954.  #########################
  955.  if [[ "${display[@]}" =~ "host" ]]; then myinfo=$(echo -e "${labelcolor}${myUser}$textcolor$bold@${labelcolor}${myHost}"); out_array=( "${out_array[@]}" "$myinfo" ); ((display_index++)); fi
  956.  if [[ "${display[@]}" =~ "distro" ]]; then
  957.    sysArch=`uname -m`
  958.    if [ -n "$distro_more" ]; then mydistro=$(echo -e "$labelcolor OS:$textcolor $distro_more $sysArch")
  959.    else mydistro=$(echo -e "$labelcolor OS:$textcolor $distro $sysArch"); fi
  960.    out_array=( "${out_array[@]}" "$mydistro" )
  961.    ((display_index++))
  962.  fi
  963.  if [[ "${display[@]}" =~ "kernel" ]]; then mykernel=$(echo -e "$labelcolor Kernel:$textcolor $kernel"); out_array=( "${out_array[@]}" "$mykernel" ); ((display_index++)); fi
  964.  if [[ "${display[@]}" =~ "uptime" ]]; then myuptime=$(echo -e "$labelcolor Uptime:$textcolor $uptime"); out_array=( "${out_array[@]}" "$myuptime" ); ((display_index++)); fi
  965.  if [[ "${display[@]}" =~ "shell" ]]; then myshell=$(echo -e "$labelcolor Shell:$textcolor $myShell"); out_array=( "${out_array[@]}" "$myshell" ); ((display_index++)); fi
  966.  if [[ "${display[@]}" =~ "res" ]]; then myres=$(echo -e "$labelcolor Resolution:${textcolor} $xResolution"); out_array=( "${out_array[@]}" "$myres" ); ((display_index++)); fi
  967.  if [[ "${display[@]}" =~ "de" ]]; then myde=$(echo -e "$labelcolor DE:$textcolor $DE"); out_array=( "${out_array[@]}" "$myde" ); ((display_index++)); fi
  968.  if [[ "${display[@]}" =~ "wm" ]]; then mywm=$(echo -e "$labelcolor WM:$textcolor $WM"); out_array=( "${out_array[@]}" "$mywm" ); ((display_index++)); fi
  969.  if [[ "${display[@]}" =~ "wmtheme" ]]; then mywmtheme=$(echo -e "$labelcolor WM Theme:$textcolor $Win_theme"); out_array=( "${out_array[@]}" "$mywmtheme" ); ((display_index++)); fi
  970.  if [[ "${display[@]}" =~ "gtk" ]]; then
  971.    mygtk=$(echo -e "$labelcolor GTK Theme:$textcolor $gtkTheme"); out_array=( "${out_array[@]}" "$mygtk" ); ((display_index++))
  972.    myicons=$(echo -e "$labelcolor Icon Theme:$textcolor $gtkIcons"); out_array=( "${out_array[@]}" "$myicons" ); ((display_index++))
  973.    myfont=$(echo -e "$labelcolor Font:$textcolor $gtkFont"); out_array=( "${out_array[@]}" "$myfont" ); ((display_index++))
  974.    [ "$gtkBackground" ] && mybg=$(echo -e "$labelcolor BG:$textcolor $gtkBackground"); out_array=( "${out_array[@]}" "$mybg" ); ((display_index++))
  975.  fi
  976.  if [[ "$display_type" == "ASCII" ]]; then
  977.    asciiText
  978.  else
  979.    echo -e "$mydistro"
  980.    echo -e "$mykernel"
  981.    echo -e "$myuptime"
  982.    echo -e "$myshell"
  983.    echo -e "$myres"
  984.    echo -e "$myde"
  985.    echo -e "$mywm"
  986.    echo -e "$mywmtheme"
  987.    echo -e "$mygtk"
  988.    echo -e "$myicons"
  989.    echo -e "$myfont"
  990.  fi
  991. }
  992.  
  993. ########
  994. # Theme Exporting (Experimental!)
  995. ########
  996. themeExport () {
  997.  WM=$(echo "$mywm" | awk '{print $NF}')
  998.  if [[ ! -d /tmp/screenfetch-export ]]; then mkdir -p "/tmp/screenfetch-export/Icons" & mkdir -p "/tmp/screenfetch-export/GTK-Theme" & mkdir -p "/tmp/screenfetch-export/WM-${WM}" ; fi
  999.  if [[ "$WM" ]]; then
  1000.    if [[ "$WM" =~ "Openbox" ]]; then
  1001.      if [[ "$Win_theme" != "Not Found" ]]; then
  1002.        if [[ -d "$HOME/.themes/$Win_theme" ]]; then
  1003.          cp -r "$HOME/.themes/$Win_theme" "/tmp/screenfetch-export/WM-${WM}/$Win_theme" &>/dev/null
  1004.          [[ "$verbosity" -eq "1" ]] && verboseOut "Found WM theme folder. Transferring to /tmp/screenfetch-export/..."
  1005.        fi
  1006.      fi
  1007.    elif [[ "$WM" =~ "Fluxbox" ]]; then
  1008.      if [[ "$Win_theme" != "Not Found" ]]; then
  1009.        if [[ -d "$HOME/.fluxbox/styles/$Win_theme" ]]; then
  1010.          cp -r "$HOME/.fluxbox/styles/$Win_theme" "/tmp/screenfetch-export/WM-${WM}/$Win_theme" &>/dev/null
  1011.          [[ "$verbosity" -eq "1" ]] && verboseOut "Found WM theme folder. Transferring to /tmp/screenfetch-export/..."
  1012.        fi
  1013.      fi
  1014.    elif [[ "$WM" =~ "Blackbox" ]]; then
  1015.      if [[ "$Win_theme" != "Not Found" ]]; then
  1016.        if [[ -d "$HOME/.blackbox/styles/$Win_theme" ]]; then
  1017.          cp -r "$HOME/.blackbox/styles/$Win_theme" "/tmp/screenfetch-export/WM-${WM}/$Win_theme" &>/dev/null
  1018.          [[ "$verbosity" -eq "1" ]] && verboseOut "Found WM theme folder. Transferring to /tmp/screenfetch-export/..."
  1019.        elif [[ -d "/usr/share/blackbox/styles/$Win_theme" ]]; then
  1020.          cp -r "/usr/share/blackbox/styles/$Win_theme" "/tmp/screenfetch-export/WM-${WM}/$Win_theme" &>/dev/null
  1021.          [[ "$verbosity" -eq "1" ]] && verboseOut "Found WM theme folder. Transferring to /tmp/screenfetch-export/..."
  1022.        fi
  1023.      fi
  1024.    elif [[ "$WM" =~ "PekWM" ]]; then
  1025.      if [[ "$Win_theme" != "Not Found" ]]; then
  1026.        if [[ -d "$HOME/.pekwm/themes/$Win_theme" ]]; then
  1027.          cp -r "$HOME/.pekwm/themes/$Win_theme" "/tmp/screenfetch-export/WM-${WM}/$Win_theme" &>/dev/null
  1028.          [[ "$verbosity" -eq "1" ]] && verboseOut "Found WM theme folder. Transferring to /tmp/screenfetch-export/..."
  1029.        fi
  1030.      fi
  1031.    elif [[ "$WM" =~ "Metacity" ]]; then
  1032.      if [[ "$Win_theme" != "Not Found" ]]; then
  1033.        if [[ -d "$HOME/.themes/$Win_theme" ]]; then
  1034.          cp -r "$HOME/.themes/$Win_theme" "/tmp/screenfetch-export/WM-${WM}/$Win_theme" &>/dev/null
  1035.          [[ "$verbosity" -eq "1" ]] && verboseOut "Found WM theme folder. Transferring to /tmp/screenfetch-export/..."
  1036.        elif [[ -d "/usr/share/themes/$Win_theme" ]]; then
  1037.          cp -r "/usr/share/themes/$Win_theme" "/tmp/screenfetch-export/WM-${WM}/$Win_theme" &>/dev/null
  1038.          [[ "$verbosity" -eq "1" ]] && verboseOut "Found WM theme folder. Transferring to /tmp/screenfetch-export/..."
  1039.        fi
  1040.      fi
  1041.    elif [[ "$WM" =~ "Xfwm4" ]]; then
  1042.      if [[ "$Win_theme" != "Not Found" ]]; then
  1043.        WM_theme=$(echo "$Win_theme" | awk '{print $NF}')
  1044.        if [[ -d "$HOME/.themes/$Win_theme" ]]; then
  1045.          cp -r "$HOME/.themes/$Win_theme" "/tmp/screenfetch-export/WM-${WM}/$Win_theme" &>/dev/null
  1046.          [[ "$verbosity" -eq "1" ]] && verboseOut "Found WM theme folder. Transferring to /tmp/screenfetch-export/..."
  1047.        elif [[ -d "/usr/share/themes/$Win_theme" ]]; then
  1048.          cp -r "/usr/share/themes/$Win_theme" "/tmp/screenfetch-export/WM-${WM}/$Win_theme" &>/dev/null
  1049.          [[ "$verbosity" -eq "1" ]] && verboseOut "Found WM theme folder. Transferring to /tmp/screenfetch-export/..."
  1050.        fi
  1051.      fi
  1052.    fi
  1053.  fi
  1054.  if [[ "$gtkBackgroundFull" ]]; then
  1055.    cp "$gtkBackgroundFull" /tmp/screenfetch-export/
  1056.    [[ "$verbosity" -eq "1" ]] && verboseOut "Found BG file. Transferring to /tmp/screenfetch-export/..."
  1057.  fi
  1058.  if [[ "$mygtk" ]]; then
  1059.    GTK_theme=$(echo "$mygtk" | awk '{print $NF}')
  1060.    if [ -d "/usr/share/themes/$GTK_theme" ]; then
  1061.      cp -r "/usr/share/themes/$GTK_theme" "/tmp/screenfetch-export/GTK/Theme/$GTK_theme" &>/dev/null
  1062.      [[ "$verbosity" -eq "1" ]] && verboseOut "Found GTK theme folder. Transferring to /tmp/screenfetch-export/..."
  1063.    fi
  1064.  fi
  1065.  if [[ "$myicons" ]]; then
  1066.    GTK_icons=$(echo "$myicons" | awk '{print $NF}')
  1067.    if [ -d "/usr/share/icons/$GTK_icons" ]; then
  1068.      cp -r "/usr/share/icons/$GTK_icons" "/tmp/screenfetch-export/GTK/Icons/$GTK_icons" &>/dev/null
  1069.      [[ "$verbosity" -eq "1" ]] && verboseOut "Found GTK icons theme folder. Transferring to /tmp/screenfetch-export/..."
  1070.    fi
  1071.    if [ -d "$HOME/.icons/$GTK_icons" ]; then
  1072.      cp -r "$HOME/.icons/$GTK_icons" "/tmp/screenfetch-export/GTK/Icons/$GTK_icons" &>/dev/null
  1073.      [[ "$verbosity" -eq "1" ]] && verboseOut "Found GTK icons theme folder. Transferring to /tmp/screenfetch-export/..."
  1074.    fi
  1075.  fi
  1076.  if [[ "$myfont" ]]; then
  1077.    GTK_font=$(echo "$myfont" | awk '{print $NF}')
  1078.    if [ -d "/usr/share/fonts/$GTK_font" ]; then
  1079.      cp -r "/usr/share/fonts/$GTK_font" "/tmp/screenfetch-export/GTK/$GTK_font" &>/dev/null
  1080.      [[ "$verbosity" -eq "1" ]] && verboseOut "Found GTK font. Transferring to /tmp/screenfetch-export/..."
  1081.    elif [ -d "$HOME/.fonts/$GTK_font" ]; then
  1082.      cp -r "$HOME/.fonts/$GTK_font" "/tmp/screenfetch-export/GTK/$GTK_font" &>/dev/null
  1083.      [[ "$verbosity" -eq "1" ]] && verboseOut "Found GTK font. Transferring to /tmp/screenfetch-export/..."
  1084.    fi
  1085.  fi
  1086.  if [ "$screenshot" == "1" ]; then
  1087.    if [ -f "${shotfile}" ]; then
  1088.      cp "${shotfile}" "/tmp/screenfetch-export/"
  1089.      [[ "$verbosity" -eq "1" ]] && verboseOut "Found screenshot. Transferring to /tmp/screenfetch-export/..."
  1090.    fi
  1091.  fi
  1092.  cd /tmp/screenfetch-export/
  1093.  [[ "$verbosity" -eq "1" ]] && verboseOut "Creating screenfetch-export.tar.gz archive in /tmp/screenfetch-export/...."
  1094.  tar -czf screenfetch-export.tar.gz ../screenfetch-export &>/dev/null
  1095.  mv /tmp/screenfetch-export/screenfetch-export.tar.gz $HOME/
  1096.  echo -e "${bold}==>${c0} Archive created in /tmp/ and moved to $HOME. Removing /tmp/screenfetch-export/..."
  1097.  rm -rf /tmp/screenfetch-export/
  1098. }
  1099.  
  1100.  
  1101. ##################
  1102. # Let's Do This!
  1103. ##################
  1104.  
  1105. for i in "${display[@]}"; do
  1106.   [[ "${display[*]}" =~ "$i" ]] && detect${i}
  1107. done
  1108. infoDisplay
  1109. [ "$screenshot" == "1" ] && takeShot
  1110. [ "$exportTheme" == "1" ] && themeExport