10

I sometimes use two different Desktop Environments like Unity and Gnome Shell (comparing, testing, creating screenshots, etc.) but Unity looks bad using Adwaita theme, which is the same with Gnome Shell and Ambiance theme. Changing every time is quite a hassle and sometimes (but now less frequent than before) it crashes (I'm using Oneiric).

1
  • Both sessions are using the same theme because you're using your user to log in, selecting a new user will do it for you. Oct 3, 2011 at 0:59

3 Answers 3

6

Building upon the previous answers:

For 11.10

#!/bin/bash

if [ "$XDG_CURRENT_DESKTOP" = "Unity" ]
then
  gsettings set org.gnome.desktop.interface gtk-theme 'Ambiance'
  gconftool-2 --set --type string /apps/metacity/general/theme 'Ambiance'
  gsettings set org.gnome.desktop.interface icon-theme 'Faenza-Ambiance'

else
  gsettings set org.gnome.desktop.interface gtk-theme 'Adwaita'
  gconftool-2 --set --type string /apps/metacity/general/theme 'Adwaita'
  gsettings set org.gnome.desktop.interface icon-theme 'Faenza'

fi

For 12.04 and 12.10

#!/bin/bash

if [ "$XDG_CURRENT_DESKTOP" = "Unity" ]
then
  gsettings set org.gnome.desktop.interface gtk-theme 'Ambiance'
  gsettings set org.gnome.desktop.interface icon-theme 'ubuntu-mono-dark'
  gsettings set org.gnome.desktop.wm.preferences theme 'Ambiance'

else 
  gsettings set org.gnome.desktop.interface gtk-theme 'Adwaita'
  gsettings set org.gnome.desktop.interface icon-theme 'gnome'
  gsettings set org.gnome.desktop.wm.preferences theme 'Adwaita'

fi

Add this script to Startup Applications (Add => Command sh path/to/script).

2

You can try creating a script which you set to execute at each starts where you recognize which DE you are using and switch the theme in base of what you are running

1
  • Is it possible to change the themes from a script? I can use XDG_CURRENT_DESKTOP to know the DE, but I don't know how does Gnome 3 save theme settings. Oct 3, 2011 at 16:33
0

For 16.10

Using Startup Applications (as suggested by Matteo) and adapting the startup script from Mr Hyde:

#!/bin/bash

if [ "$XDG_CURRENT_DESKTOP" = "Unity" ]
then
  gsettings set org.gnome.desktop.interface gtk-theme 'Ambiance'
  gsettings set org.gnome.desktop.interface icon-theme 'ubuntu-mono-dark'
  gsettings set org.gnome.desktop.interface cursor-theme 'DMZ-White'
  gsettings set org.gnome.desktop.wm.preferences theme 'Ambiance'

else 
  gsettings set org.gnome.desktop.interface gtk-theme 'Adwaita'
  gsettings set org.gnome.desktop.interface icon-theme 'Adwaita'
  gsettings set org.gnome.desktop.interface cursor-theme 'Adwaita'
  gsettings set org.gnome.desktop.wm.preferences theme 'Adwaita'

fi

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .