SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2010-05-03 16:37:16

FonzCam
Member
Registered: 2010-04-19
Posts: 16

Quick Theme switch

I posted about this as a suggestion for Statler so decided to make a very basic version to start with and see if I can develop it into something more useful/universal/user friendly.

unless I've made a boo boo this should quickly switch tint2, conky, wallpaper, gtk and openbox themes.

Requirements are
gtk-theme-switch

Then put the script in a folder that includes:
wallpaper.png
tint2rc
conkyrc
customtheme (a folder containing GTK and openbox themes)

#!/bin/bash
BASEDIR=$(dirname $0)
killall conky
killall tint2
sleep 2s
nitrogen --set-scaled $BASEDIR/wallpaper.png &
tint2 -c $BASEDIR/tint2rc &
conky -c conkyrc &
gtk-theme-switch2 $BASEDIR/customtheme &
rm ~/.themes/customtheme    
ln -s $BASEDIR/customtheme ~/.themes/customtheme
perl -i -p -0777 -e 's@<theme>.*?</name>@<theme><name>customtheme</name>@sg' ~/.config/openbox/rc.xml 
openbox --reconfigure

It's my first ever attempt at scripting in Linux so it's a bit rough and ready!  The perl to replace the openbox rc.xml seems a bit dodgy to me and should probably use something that understands XML to avoid breaking it.

Right now some bits are persistant and some aren't.  I've got work to do but I'd like to make it easy to remove and non-destructive to the default conky/tint2 configs and not fill your .themes folder up with every theme you've ever tried so it doesn't actually install anything.

Next up is to get fonts and icons working and then to make it dynamic so you select from a range of themes and it remembers your original settings so there won't be any buyers remorse to trying something new!

Last edited by FonzCam (2010-05-03 16:40:15)

Offline

Be excellent to each other!

#2 2010-05-03 19:38:21

FonzCam
Member
Registered: 2010-04-19
Posts: 16

Re: Quick Theme switch

With a few tweaks and a few of gutterslob's themes as examples I've made something that kind of works!
http://www.fonz.co.uk/themeswitch-0.22.tar.gz

Extract it somewhere like your home folder and then click on the themeswitch.sh in either of the two theme folders to switch over to that theme/config  There's another script called remove.sh that should undo everything.

I've only tested it on the openbox statler live cd and there are still plenty of issues but it gets the job done. 

(you still need gtk-theme-switch installed for the gtk bit to work.  You may also need to create the ~/.themes folder)

changes from the previous script are that it now modifies autostart.sh, a few files have moved around and the remove.sh script returns to the system to default.

In simple terms it creates a symbolic link from ~/.themes/customtheme to the selected theme and re-launches everything pointing to that location for config and theme files.

Offline

#3 2010-05-03 22:32:54

FiniteStateMachine
Part of the Machine
From: Ontario, Canada
Registered: 2009-06-29
Posts: 1,489

Re: Quick Theme switch

Sounds like your making progress, I'll try it out tomorrow if I get a chance.


just call me...
~FSM~

Offline

#4 2010-05-05 05:11:55

iggykoopa
Script Master
Registered: 2008-12-13
Posts: 1,485

Re: Quick Theme switch

you could try improving the theme switcher I made here http://crunchbanglinux.org/forums/topic … installer/ .I haven't worked on it in a while, but it already supports icons, openbox themes, wallpapers, etc


I say never be complete, I say stop being perfect, I say lets evolve, let the chips fall where they may.

Offline

#5 2011-04-09 03:49:55

DarthWound
#! CrunchBanger
From: Paris, France.
Registered: 2010-08-17
Posts: 241
Website

Re: Quick Theme switch

Hi, sorry for the up (last post was on 2010), but I've did a modification, I think easier and more complete.

I'm too tired to translate (it is 5:47 AM in Paris), but you can see and download it here:
http://crunchbanglinux-fr.org/forum/vie … 198#p11198

If somebody wants a quick translation, I will ^^

Thanks iggykoopa and FonzCam for the base.

I hope that some people will like it.

From Paris with love big_smile

DW

Offline

#6 2011-11-01 19:21:11

demarsjcd
#! Member
Registered: 2011-09-28
Posts: 94

Re: Quick Theme switch

The link is dead for the download from darthwound.

Offline

#7 2011-11-02 00:51:23

DarthWound
#! CrunchBanger
From: Paris, France.
Registered: 2010-08-17
Posts: 241
Website

Re: Quick Theme switch

Yes, sorry.

You can modify the CTKarch script in order to have the same result.

Offline

#8 2013-05-12 11:24:24

istota
New Member
From: Poland
Registered: 2013-05-12
Posts: 1
Website

Re: Quick Theme switch

Thank you for Crunchbang

#!/bin/bash

#  obprofile
#  
#  For GoBang System.
#  Copyright 2013 gobang <wojciech.witkowski@ovi.com>
#  
#  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, write to the Free Software
#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#  MA 02110-1301, USA.
#  
#  

function PROFAPPS () {
echo ""
echo "TOUCH PROFAPPS"	
if [ -e $conf_dir/profapps ]; then echo "NO NECESSARY"
		else 
echo "#!/bin/bash

#Profapps is responsible for the final phase, changes in the profiles.
#It can contain a variety of functions.
#Each profile has a separate (autostart) and (profapps)
#It is loaded when changing.
#To avoid duplication of already running programs,
#which have been added to the (autostart)
#before changing the profile, should be killed.
#To check the processes responsible for the program,
#type in the terminal (htop)
#Example:

#killall xbmc.bin" >> $conf_dir/profapps
chmod a+x $conf_dir/profapps
fi
}	
function FIRSTRUN () {
echo ""
echo "PROCEDURE FIRSTRUN"	
if [ -e $conf_dir/rc.xml ]; then echo "NO NECESSARY"
		else 
zenity --error --width '500' --height '150' --no-wrap --text='
				   FATAL   ERORR 
                           GoBang Profile Changer

GoBang Profile Changer No configuration files in a directory ...
Please read the man page to fix this error !!!' --title='Fatal Erorr !!!'
rc=$? 
	if [ "${rc}" == "1" ]; then 
 exit 1 
fi 
terminator --command="man obprofile"
		fi
}		
function SAVED () {
echo ""	
echo "PROCEDURE SAVE"		
     #back-conky
		if [ -e $HOME/.conkyrc.switch.back ]; then
			cp $HOME/.conkyrc.switch.back $HOME/.conkyrc
			rm $HOME/.conkyrc.switch.back
			cp -f $HOME/.conkyrc $save_dir/conkyrc
		else
			cp -f $HOME/.conkyrc $save_dir/conkyrc
		fi
	 #back Xfce4-notifyd
			cp -f $HOME/.config/xfce4/xfconf/xfce-pearchannel-xml/xfce4-notifyd.xml $save_dir/xfce4-notifyd.xml
     #back-tint2
		cp -f $HOME/.config/tint2/tint2rc $save_dir/tint2rc  
     #back-wbar
		cp -f $HOME/.wbar $save_dir/wbar
     #back-theme
		cp -rf $HOME/.config/gtk-3.0 $save_dir
		cp -f $HOME/.gtkrc-2.0 $save_dir/gtkrc-2.0
		cp -f $HOME/.gtkrc-2.0.mine $save_dir/gtkrc-2.0.mine
		cp -f $HOME/.config/openbox/rc.xml $save_dir/rc.xml
     #back-terminator
		cp -f $HOME/.config/terminator/config $save_dir/config
	 #back tilda
		cp -rf $HOME/.tilda/config_0 $save_dir/config_0tilda
     #back-walpapper
		cp -f $HOME/.config/nitrogen/bg-saved.cfg $save_dir/bg-saved.cfg
	 #back-menu
		cp -f $HOME/.config/openbox/menu.xml $save_dir/menu.xml
     #back-autostart
		cp -f $HOME/.config/openbox/autostart $save_dir/autostart
}
function SWITCH () {
echo""	
echo "PROCEDURE SWITCH"
	#apps profile
		sh $save_dir/profapps
	#walpapper
		cp -f $conf_dir/bg-saved.cfg $HOME/.config/nitrogen/bg-saved.cfg
	#conky
		killall conky
		   cp -f $conf_dir/conkyrc $HOME/.conkyrc
	#Xfce4-notifyd
		killall xfce4-notifyd
			cp -f $save_dir/xfce4-notifyd.xml $HOME/.config/xfce4/xfconf/xfce-pearchannel-xml/xfce4-notifyd.xml 
	#tint2
		pkill -2 -f tint2
	       cp -f $conf_dir/tint2rc $HOME/.config/tint2/tint2rc
	       cp -f $HOME/.config/tint2/tint2rc $HOME/.config/tint2/default.tint2rc
	#wbar
		killall wbar
	       cp -f $conf_dir/wbar $HOME/.wbar
	#theme
#	       cp -rf $conf_dir/gtk-3.0 $HOME/.config
	       cp -f $conf_dir/rc.xml $HOME/.config/openbox/rc.xml
	#terminator
	       cp -f $conf_dir/config $HOME/.config/terminator/config
	#tilda
		 killall tilda	
		   cp -f $conf_dir/config_0tilda $HOME/.tilda/config_0
	#menu
		   cp -f $conf_dir/menu.xml $HOME/.config/openbox/menu.xml
	#autostart
	       cp -f $conf_dir/autostart $HOME/.config/openbox/autostart
	#xfce4-power-manager
		   killall xfce4-power-manager
	#nm-applet icon
		   killall nm-applet
	#gb-compmgr
		   killall gb-compmgr
	#xscreensaver
		   killall xscreensaver
	#volumeicon
		   killall volumeicon
	#parcellite
		   killall parcellite	
	#dorpbox
		   killall dropbox
echo ""
echo "PROCEDURE RUN"
	#theme
		#gtkrc-2.0.mine
		if [ -e $HOME/.gtkrc-2.0.mine ]; then
			for i in $conf_dir/gtkrc-2.0; do
				ICON=`head -n5 "$i" | tail -n1 | cut -c 1-50`
			touch -f $HOME/.gtkrc-2.0.mine |echo $ICON > $HOME/.gtkrc-2.0.mine
			done
				else
				touch -f $HOME/.gtkrc-2.0.mine
				for i in $conf_dir/gtkrc-2.0; do
					ICON=`head -n5 "$i" | tail -n1 | cut -c 1-50`
				touch -f $HOME/.gtkrc-2.0.mine |echo $ICON > $HOME/.gtkrc-2.0.mine
				done
		fi			
		#gtkrc-2.0  gtk-3.0
		if [ -e $conf_dir/gtkrc-2.0 ]; then
			for i in $conf_dir/gtkrc-2.0; do
				GTK2=`head -n4 "$i" | tail -n1 | cut -c 17-50 |cut -d '"' -f -1`
			gtk-theme-switch2 /usr/share/themes/$GTK2
			sleep 1s
			cp -f $conf_dir/gtkrc-2.0 $HOME/.gtkrc-2.0
			cp -rf $conf_dir/gtk-3.0 $HOME/.config
			done
		fi
	#start	
	
			sh $HOME/.config/openbox/autostart &
			openbox --reconfigure & 
			if [ -e $HOME/.dropbox-dist/dropboxd ]; then
				$HOME/.dropbox-dist/dropboxd &
			fi	
		
}
if [ $# -lt 1 ]; then echo "
>>>>>>>> no options given
    
        Usage: obprofile <[options]>
        Options:
                  --restore        Set config restore 
                  --light          Set config light     
                  --dark           Set config dark       
                  --user           Set config user    
                  --help           Show this message"
	exit 0
else
  if [ $1 = "--help" ]; then
cat <<EOF

>>>>>>>> obprofile --help
    
        Usage: obprofile <[options]>
        Options:
                  --restore        Set config restore 
                  --light          Set config light     
                  --dark           Set config dark       
                  --user           Set config user    
                  --help           Show this message
EOF
	exit 0
  fi
 fi 
if [ -e $HOME/.config/openbox/profile/run ]; then
	echo "Wait Proces Run now"
	sleep 5s
 exit 0
 else 
if [ -d $HOME/.config/openbox/profile ]; then
	touch $HOME/.config/openbox/profile/run
###RESTOR###############################################################
if [ $1 = "--restore" ]; then
  #RESTORE  
	if [ -e $HOME/.config/openbox/profile/flag.restore ]; then echo "restore config is load"	  
	rm -f $HOME/.config/openbox/profile/run 
	  exit 0
	  fi  
  #LIGHT
	if [ -e $HOME/.config/openbox/profile/flag.light ]; then 
			#killall wbar &
		  save_dir=$HOME/.config/openbox/profile/light
		  conf_dir=$HOME/.config/openbox/profile/restore
		SAVED
		SWITCH
			sleep 1s
    mv $HOME/.config/openbox/profile/flag.light $HOME/.config/openbox/profile/flag.restore
		if [ -e $conf_dir/rc.xml ]; then echo ""
		else 
			FIRSTRUN
		fi
		 echo "END PROCES SWITCH" 
	  fi
  #DARK
	if [ -e $HOME/.config/openbox/profile/flag.dark ]; then  
			#killall wbar &
		  save_dir=$HOME/.config/openbox/profile/dark
		  conf_dir=$HOME/.config/openbox/profile/restore		
		SAVED
		SWITCH
			sleep 1s
    mv $HOME/.config/openbox/profile/flag.dark $HOME/.config/openbox/profile/flag.restore
		if [ -e $conf_dir/rc.xml ]; then echo ""
		else 
			FIRSTRUN
		fi
		 echo "END PROCES SWITCH" 
	  fi
  #USER
	if [ -e $HOME/.config/openbox/profile/flag.user ]; then  
			#killall wbar &
		  save_dir=$HOME/.config/openbox/profile/user
		  conf_dir=$HOME/.config/openbox/profile/restore		
		SAVED
		SWITCH
			sleep 1s
    mv $HOME/.config/openbox/profile/flag.user $HOME/.config/openbox/profile/flag.restore
		if [ -e $conf_dir/rc.xml ]; then echo ""
		else 
			FIRSTRUN
		fi
		 echo "END PROCES SWITCH" 
	  fi
    sleep 4s
	rm -f $HOME/.config/openbox/profile/run  
	notify-send "Complete Profile Change" -t 1250
     exit 0  
  fi
###LIGHT################################################################ 
if [ $1 = "--light" ]; then

  #LIGHT  
	if [ -e $HOME/.config/openbox/profile/flag.light ]; then echo "light config is load"	  
	rm -f $HOME/.config/openbox/profile/run 
	  exit 0
      fi  
  #RESTORE
	if [ -e $HOME/.config/openbox/profile/flag.restore ]; then 
		  save_dir=$HOME/.config/openbox/profile/restore
		  conf_dir=$HOME/.config/openbox/profile/light
		SAVED
		SWITCH
			sleep 1s
    mv $HOME/.config/openbox/profile/flag.restore $HOME/.config/openbox/profile/flag.light
		if [ -e $conf_dir/rc.xml ]; then echo ""
		else 
			FIRSTRUN
		fi
		 echo "END PROCES SWITCH" 
	  fi
  #DARK
	if [ -e $HOME/.config/openbox/profile/flag.dark ]; then 
		  save_dir=$HOME/.config/openbox/profile/dark
		  conf_dir=$HOME/.config/openbox/profile/light	
		SAVED	
      	SWITCH
			sleep 1s
    mv $HOME/.config/openbox/profile/flag.dark $HOME/.config/openbox/profile/flag.light
		if [ -e $conf_dir/rc.xml ]; then echo ""
		else 
			FIRSTRUN
		fi
		 echo "END PROCES SWITCH" 
	  fi
  #USER
	if [ -e $HOME/.config/openbox/profile/flag.user ]; then  
		  save_dir=$HOME/.config/openbox/profile/user
		  conf_dir=$HOME/.config/openbox/profile/light
		SAVED
		SWITCH
			sleep 1s
    mv $HOME/.config/openbox/profile/flag.user $HOME/.config/openbox/profile/flag.light
		if [ -e $conf_dir/rc.xml ]; then echo ""
		else 
			FIRSTRUN
		fi	 
		 echo "END PROCES SWITCH" 
	  fi
    sleep 4s
	rm -f $HOME/.config/openbox/profile/run  
	notify-send "Complete Profile Change" -t 1250    
     exit 0        
  fi
###DARK#################################################################	
if [ $1 = "--dark" ]; then


  #DARK  
	if [ -e $HOME/.config/openbox/profile/flag.dark ]; then echo "dark config is load"	  
	rm -f $HOME/.config/openbox/profile/run 
	  exit 0
      fi  
  #RESTORE
	if [ -e $HOME/.config/openbox/profile/flag.restore ]; then 
		  save_dir=$HOME/.config/openbox/profile/restore
		  conf_dir=$HOME/.config/openbox/profile/dark
		SAVED
		SWITCH
			sleep 1s
    mv $HOME/.config/openbox/profile/flag.restore $HOME/.config/openbox/profile/flag.dark
		if [ -e $conf_dir/rc.xml ]; then echo ""
		else 
			FIRSTRUN
		fi
		 echo "END PROCES SWITCH" 	
	  fi
  #LIGHT
	if [ -e $HOME/.config/openbox/profile/flag.light ]; then
		  save_dir=$HOME/.config/openbox/profile/light
		  conf_dir=$HOME/.config/openbox/profile/dark
		SAVED
		SWITCH
			sleep 1s
    mv $HOME/.config/openbox/profile/flag.light $HOME/.config/openbox/profile/flag.dark
		if [ -e $conf_dir/rc.xml ]; then echo ""
		else 
			FIRSTRUN
		fi
		 echo "END PROCES SWITCH"  
	  fi
  #USER
	if [ -e $HOME/.config/openbox/profile/flag.user ]; then  
		  save_dir=$HOME/.config/openbox/profile/user
		  conf_dir=$HOME/.config/openbox/profile/dark
		SAVED
		SWITCH
			sleep 1s
    mv $HOME/.config/openbox/profile/flag.user $HOME/.config/openbox/profile/flag.dark
		if [ -e $conf_dir/rc.xml ]; then echo ""
		else 
			FIRSTRUN
		fi
		 echo "END PROCES SWITCH"  
	  fi	
    sleep 4s
	rm -f $HOME/.config/openbox/profile/run 
	notify-send "Complete Profile Change" -t 1250
     exit 0
  fi
###USER#################################################################	
if [ $1 = "--user" ]; then

  #USER  
	if [ -e $HOME/.config/openbox/profile/flag.user ]; then echo "user config is load"	  
	rm -f $HOME/.config/openbox/profile/run 
	  exit 0
      fi  
  #RESTORE
	if [ -e $HOME/.config/openbox/profile/flag.restore ]; then	
		  save_dir=$HOME/.config/openbox/profile/restore		
		  conf_dir=$HOME/.config/openbox/profile/user		
		SAVED
		SWITCH
			sleep 1s
    mv $HOME/.config/openbox/profile/flag.restore $HOME/.config/openbox/profile/flag.user
		if [ -e $conf_dir/rc.xml ]; then echo ""
		else 
			FIRSTRUN
		fi	
		 echo "END PROCES SWITCH" 	
	  fi
  #LIGHT
	if [ -e $HOME/.config/openbox/profile/flag.light ]; then 
		  save_dir=$HOME/.config/openbox/profile/light
		  conf_dir=$HOME/.config/openbox/profile/user
		SAVED
		SWITCH
			sleep 1s
    mv $HOME/.config/openbox/profile/flag.light $HOME/.config/openbox/profile/flag.user
		if [ -e $conf_dir/rc.xml ]; then echo "NO NECESSARY"
		else 
			FIRSTRUN
		fi
		 echo "END PROCES SWITCH" 	
	  fi
  #DARK
	if [ -e $HOME/.config/openbox/profile/flag.dark ]; then
		  save_dir=$HOME/.config/openbox/profile/dark
		  conf_dir=$HOME/.config/openbox/profile/user				
		SAVED
		SWITCH
			sleep 1s
    mv $HOME/.config/openbox/profile/flag.dark $HOME/.config/openbox/profile/flag.user
		if [ -e $conf_dir/rc.xml ]; then echo ""
		else 
			FIRSTRUN
		fi		 
		 echo "END PROCES SWITCH" 
	  fi
    sleep 4s
	rm -f $HOME/.config/openbox/profile/run 
	notify-send "Complete Profile Change" -t 1250
     exit 0
  fi
  exit 0
###MAKE CATALOGS TREE###################################################  

else
	  mkdir $HOME/.config/openbox/profile |				echo "1"
	    if [ -d $HOME/.config/openbox/profile/user ]; then
	      echo "2e"
	        else
	         mkdir $HOME/.config/openbox/profile/user	|	echo "2"
				conf_dir=$HOME/.config/openbox/profile/user	
				PROFAPPS
	         fi
	    if [ -d $HOME/.config/openbox/profile/dark ]; then
	      echo "3e"
	        else
	         mkdir $HOME/.config/openbox/profile/dark	|	echo "3"
				conf_dir=$HOME/.config/openbox/profile/dark
				PROFAPPS
	         fi
	    if [ -d $HOME/.config/openbox/profile/light ]; then
	      echo "4e"
	        else
	         mkdir $HOME/.config/openbox/profile/light	 |	echo "4"
				conf_dir=$HOME/.config/openbox/profile/light
				PROFAPPS
	         fi
	    if [ -d $HOME/.config/openbox/profile/restore ]; then
	      echo "5e"
	        else
	         mkdir $HOME/.config/openbox/profile/restore 	| 	echo "5"
				conf_dir=$HOME/.config/openbox/profile/restore
				PROFAPPS
	         fi 
	  if [ -e $HOME/.config/openbox/profile/flag.* ]; then
		 echo "6e"
	    else	        
	  touch $HOME/.config/openbox/profile/flag.restore  | echo "6"
	  fi     
	FIRSTRUN
	fi
  fi
exit 0  

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo