You are not logged in.
In an effort to keep the Desktop Workshop thread clean (i.e.: theme requests only), I'm moving the thread for those helping test the prototype installer I've put together for my themes here. If you are helping with the tests, please post ideas, bugs, constructive criticism and the like here. For those of you just joining us, starting with the RatLook theme, all my themes will have an install script with them. Use of this script is by no means mandatory (in fact, the script is still very much a prototype). However, I would greatly appreciate it if you would at least give it a try and send me some feedback.
The syntax of said installer is simple:
$ ./install = install theme
$ ./install -r or ./install --remove = remove theme
When the installer is run, the script will do the following things:
* Check the computers resolution and warn the user if it does not match the themes optimized resolution
* Verify that any needed dependencies are installed
* The installer itself requires gtk-theme-switch2 and either feh or nitrogen
* Themes usually require tint2 and conky
* Backup the users current wallpaper and openbox config
* Install any necessary fonts to $HOME/.fonts/
* Automagically copy the necessary configs to a standardized location ($HOME/.config/openbox/workshop/<theme>)
* Install necessary theme files to $HOME/.themes/
* Activate the theme
When the uninstaller is run, it removes the installed files and restores the backed up configuration.
For those who may want to take a look at the installer without actually having to download a theme, here is the current code.
#!/bin/bash
#
# Desktop Workshop Installation Framework (v0.4a)
# Copyright (C) 2009 Daniel J Griffiths <ghost1227@archlinux.us>
#
# 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 2 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, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
# Thanks to everyone in irc.oftc.net/#openbox for all their help!
WBUILD=${PWD}
WROOT=${HOME}/.config/openbox/workshop
WTHEME=AbstractCool
WCONFIGS=('tint2rc' 'conkyrc')
WWPAPER=AbstractCool.jpg
WTHEMES=('red_line')
WREZ="1280x1024"
ERROR="\e[1;31m==>\e[1;37m"
ASK="\e[1;33m==>\e[1;37m"
INFO="\e[1;34m==>\e[1;37m"
SUCCESS="\e[1;32m==>\e[1;37m"
RESET="\e[0m"
winstall(){
CREZ=`xrandr | grep "*" | awk '{ print $1 }'`
if [[ "${WREZ}" != "${CREZ}" ]]; then
echo -e "${ASK} This theme is optimized for ${WREZ} but your resolution"
echo -en " is set to ${CREZ}. Continue installing? [Y/n] "
read ANS
if [[ "${ANS}" == "n" || "${ANS}" == "N" ]]; then
echo -e "${INFO} Aborted by user.${RESET}"
exit 0
fi
fi
if [ -f /tmp/${WTHEME}.start ]; then
rm -f /tmp/${WTHEME}.start
fi
if [ ! -f /usr/bin/sudo ]; then
if [ $UID -ne 0 ]; then
ASUSER="none"
else
ASUSER="root"
fi
else
ASUSER="sudo"
fi
if [ ! -f /usr/bin/switch2 ]; then
echo -e "${ERROR} Error: gtk-theme-switch2 not found!"
echo -ne "${ASK} Install gtk-theme-switch2? [Y/n] "
read ANS
if [[ ${ANS} == "N" || ${ANS} == "n" ]]; then
echo -e "${INFO} gtk-theme-switch2 is needed for the installer to run."
echo -e "${INFO} Please install ${WTHEME} manually by following the readme file.${RESET}"
wremove
else
INST=(${INST[@]} gtk-theme-switch2)
fi
fi
if [ ! -f /usr/bin/nitrogen ]; then
if [ ! -f /usr/bin/feh ]; then
echo -e "${ERROR} Error: nitrogen not found!"
echo -ne "${ASK} Install nitrogen? [Y/n] "
read ANS
if [[ ${ANS} == "N" || ${ANS} == "n" ]]; then
echo -e "${INFO} nitrogen is needed for the installer to run."
echo -e "${INFO} Please install ${WTHEME} manually by following the readme file.${RESET}"
wremove
else
INST=(${INST[@]} nitrogen)
SETWALL="nitrogen --set-scaled"
fi
else
SETWALL="feh --bg-scale"
fi
else
SETWALL="nitrogen --set-scaled"
fi
if [[ `echo ${WCONFIGS[@]} | grep tint2` != "" ]]; then
if [ ! -f /usr/bin/tint2 ]; then
echo -e "${ERROR} Error: tint2 not found!"
echo -ne "${ASK} Install tint2? [Y/n] "
read ANS
if [[ ${ANS} == "N" || ${ANS} == "n" ]]; then
echo -e "${INFO} tint2 is required for this theme."
echo -e "${INFO} Please install ${WTHEME} manually by following the readme file.${RESET}"
wremove
else
mkdir /tmp/workshop
cd /tmp/workshop
wget aur.archlinux.org/packages/tint2/tint2.tar.gz
tar -xvf tint2.tar.gz
cd tint2
makepkg || echo -e "${ERROR} ERROR: tint2 build failed!"; wremove
if [[ "${ASUSER}" == "sudo" ]]; then
sudo pacman -U tint2*.pkg.tar.gz
elif [[ "${ASUSER}" == "root" ]]; then
pacman -U tint2*.pkg.tar.gz
else
su -c 'pacman -U tint2*.pkg.tar.gz'
fi
cd ${WBUILD}
fi
fi
fi
if [[ `echo ${WCONFIGS[@]} | grep conky` != "" ]]; then
if [ ! -f /usr/bin/conky ]; then
echo -e "${ERROR} Error: conky not found!"
echo -ne "${ASK} Install conky? [Y/n] "
read ANS
if [[ ${ANS} == "N" || ${ANS} == "n" ]]; then
echo -e "${INFO} conky is required for this theme."
echo -e "${INFO} Please install ${WTHEME} manually by following the readme file.${RESET}"
wremove
else
INST=(${INST[@]} conky)
fi
fi
fi
if [[ ${#INST[@]} != 0 ]]; then
if [[ "${ASUSER}" == "sudo" ]]; then
sudo pacman -S ${INST[@]}
elif [[ "${ASUSER}" == "root" ]]; then
pacman -S ${INST[@]}
else
su -c 'pacman -S ${INST[@]}'
fi
fi
if [ ! -d ${WROOT} ]; then
mkdir ${WROOT}
fi
if [ -d ${WROOT}/${WTHEME} ]; then
echo -e "${ERROR} Error: Theme '${WTHEME}' is already installed!"
echo -ne "${ASK} Reinstall? [y/N] "
read ANS
if [[ ${ANS} == "Y" || ${ANS} == "y" ]]; then
rm -R ${WROOT}/${WTHEME}
else
echo -e "${INFO} Aborted by user.${RESET}"
exit 0
fi
fi
if [[ `pgrep tint2` != "" ]]; then
killall tint2
fi
if [[ `pgrep conky` != "" ]]; then
killall conky
fi
echo -e "${INFO} Backing up current settings"
mkdir ${WROOT}/.backup
if [ -f ${HOME}/.config/nitrogen/bg-saved.cfg ]; then
cp ${HOME}/.config/nitrogen/bg-saved.cfg ${WROOT}/.backup/
fi
if [ -f ${HOME}/.fehbg ]; then
cp ${HOME}/.fehbg ${WROOT}/.backup/
fi
cp ${HOME}/.config/openbox/rc.xml ${WROOT}/.backup/
mkdir ${WROOT}/${WTHEME}
if [ ! -z ${WFONTS} ]; then
echo -e "${INFO} Installing fonts"
cp -R Fonts ${WROOT}/${WTHEME}/
cp Fonts/*.ttf ${HOME}/.fonts
fi
echo -e "${INFO} Installing configs"
cp -R Themes Configs readme ${WROOT}/${WTHEME}/
echo -e "${INFO} Installing themes"
CCOUNT=0
while [[ ${CCOUNT} -lt ${#WTHEMES[@]} ]]; do
if [ -d Themes/${WTHEMES[${CCOUNT}]} ]; then
cp -R Themes/${WTHEMES[${CCOUNT}]} ${HOME}/.themes/
let CCOUNT=${CCOUNT}+1
else
echo -e "${ERROR} Error: Theme ${WTHEMES[${CCOUNT}]} not found!${RESET}"
wremove
fi
done
echo -e "${SUCCESS} Installation completed\n"
echo -e "${INFO} Setting wallpaper"
if [ -f ${WROOT}/${WTHEME}/Themes/${WWPAPER} ]; then
${SETWALL} ${WROOT}/${WTHEME}/Themes/${WWPAPER} &> /dev/null
echo -e "\t${SETWALL} ${WROOT}/${WTHEME}/Themes/${WWPAPER} &" >>/tmp/${WTHEME}.start
else
echo -e "${ERROR} Error: Wallpaper ${WWPAPER} not found!${RESET}"
wremove
fi
echo -e "${INFO} Setting GTK theme"
if [ ${#WTHEMES[@]} == "1" ]; then
if [ -d ${HOME}/.themes/${WTHEMES[0]}/gtk-2.0 ]; then
switch2 ${HOME}/.themes/${WTHEMES[0]}
else
echo -e "${ERROR} Error: No valid GTK theme found!${RESET}"
wremove
fi
else
if [ -d ${HOME}/.themes/${WTHEMES[0]}/gtk-2.0 ]; then
switch2 ${HOME}/.themes/${WTHEMES[0]}
elif [ -d ${HOME}/.themes/${WTHEMES[1]}/gtk-2.0 ]; then
switch2 ${HOME}/.themes/${WTHEMES[1]}
else
echo -e "${ERROR} Error: No valid GTK theme found!${RESET}"
wremove
fi
fi
echo -e "${INFO} Setting OpenBox theme"
CTHEME=`sed -n '/<theme>/,/<\/theme>/p' ${HOME}/.config/openbox/rc.xml | sed -n -e '/<font/,/<\/font>/d' -e '/<name>/s/.*<name>\(.*\)<\/name>.*/\1/p'`
if [ ${#WTHEMES[@]} == "1" ]; then
if [ -d ${HOME}/.themes/${WTHEMES[0]}/openbox-3 ]; then
sed -i "s|${CTHEME}|${WTHEMES[0]}|" ${HOME}/.config/openbox/rc.xml
else
echo -e "${ERROR} Error: No valid OpenBox theme found!${RESET}"
wremove
fi
else
if [ -d ${HOME}/.themes/${WTHEMES[0]}/openbox-3 ]; then
sed -i "s|${CTHEME}|${WTHEMES[0]}|" ${HOME}/.config/openbox/rc.xml
elif [ -d ${HOME}/.themes/${WTHEMES[1]}/openbox-3 ]; then
sed -i "s|${CTHEME}|${WTHEMES[1]}|" ${HOME}/.config/openbox/rc.xml
else
echo -e "${ERROR} Error: No valid OpenBox theme found!${RESET}"
wremove
fi
fi
echo -e "${INFO} Reconfiguring OpenBox"
openbox --reconfigure
CCOUNT=0
while [[ ${CCOUNT} -lt ${#WCONFIGS[@]} ]]; do
if [[ `echo ${WCONFIGS[${CCOUNT}]} | grep tint2` != "" ]]; then
echo -e "${INFO} Launching tint2 panel"
while [[ `pgrep tint2` == "" ]]; do
tint2 -c ${WROOT}/${WTHEME}/Configs/${WCONFIGS[${CCOUNT}]} &> /dev/null &
done
echo -e "\ttint2 -c ${WROOT}/${WTHEME}/Configs/${WCONFIGS[${CCOUNT}]} &" >> /tmp/${WTHEME}.start
disown tint2
elif [[ `echo ${WCONFIGS[${CCOUNT}]} | grep conky` != "" ]]; then
echo -e "${INFO} Launching conky instance"
while [[ `pgrep conky` == "" ]]; do
conky -c ${WROOT}/${WTHEME}/Configs/${WCONFIGS[${CCOUNT}]} &> /dev/null &
done
echo -e "\tconky -c ${WROOT}/${WTHEME}/Configs/${WCONFIGS[${CCOUNT}]} &" >> /tmp/${WTHEME}.start
disown conky
else
echo -e "${ERROR} Error: Config file ${WCONFIGS[${CCOUNT}]} is invalid!"
fi
let CCOUNT=${CCOUNT}+1
done
echo -e "${INFO} In order to make these changes persistent, please"
echo -e " add the following to your autostart script:\n"
cat /tmp/${WTHEME}.start
echo -e "\n${SUCCESS} Done!${RESET}"
exit 0
}
wremove(){
echo -e "${INFO} Removing theme directories."
if [ -d ${WROOT}/${WTHEME} ]; then
rm -R ${WROOT}/${WTHEME}
fi
CCOUNT=0
while [[ ${CCOUNT} -lt ${#WTHEMES[@]} ]]; do
if [ -d ${HOME}/.themes/${WTHEMES[${CCOUNT}]} ]; then
rm -R ${HOME}/.themes/${WTHEMES[${CCOUNT}]}
fi
let CCOUNT=${CCOUNT}+1
done
echo -e "${INFO} Restoring previous configuration."
if [ -f ${WROOT}/.backup/bg-saved.cfg ]; then
cp ${WROOT}/.backup/bg-saved.cfg ${HOME}/.config/nitrogen/
nitrogen --restore &
elif [ -f ${WROOT}/.backup/.fehbg ]; then
cp ${WROOT}/.backup/.fehbg ${HOME}/
sh ${HOME}/.fehbg &
fi
cp ${WROOT}/.backup/rc.xml ${HOME}/.config/openbox/
openbox --reconfigure
echo -e "${SUCCESS} Removal completed!${RESET}"
exit 0
}
if [[ "$1" == "-r" || "$1" == "--remove" ]]; then
wremove
else
winstall
fi
Offline
I haven't tried this out, but just a couple of days ago I was thinking about something similar, mostly after seeing some of the cool desktops posted on Lifehacker. I was wondering how feasible it would be to come up with a system that lets you save the look of your desktop (window manager, wm theme, gtk, fonts, conky, wallpaper, etc), to say a tar.gz file, and then restore it at a later time. The real problem is handling exactly how much you want saved, right down to settings hidden away in gconf for example, or just the fact that everyone uses different window managers. But it would be bloody cool to combine it with a small pygtk app that shows different theme packages with a screenshot and description and allows you to change it with a click and a logout/login. Unfortunately it's probably a fair bit too complicated to pull off without some serious hacking.
Edit: That sounds awesome Ghost, I decided to edit my post rather than posting a reply in order to keep the thread clean. I'm probably being over cautious
Last edited by HashBox (2009-08-20 05:23:27)
Offline
Offline