Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The command I want the system to run when the user changes the current theme is

wallch --changetheme

How can I accomplish that?

share|improve this question

Use dconf watch to monitor for changes in the setting path which you're interested with


while read -r line; do
    [[ -n $line ]] || echo "Change in theme setting detected"
done < <(dconf watch /org/gnome/desktop/interface/gtk-theme)

[[ -n $line ]] is there as workaround because dconf watch fires 3 lines in its output every time a change is detected

share|improve this answer

Cool question!

There is no easy way that I know of. However, you could set up a script running this command:

gsettings get org.gnome.desktop.interface gtk-theme

will return the current theme:


(I'm on GNOME).

So this is the script:

#! /bin/bash

pretheme="$(gsettings get org.gnome.desktop.interface gtk-theme)"

while :
    ctheme="$(gsettings get org.gnome.desktop.interface gtk-theme)"
    if [ "$ctheme" = "$pretheme" ]
      echo "nochange"
      wallch --changetheme
    pretheme="$(gsettings get org.gnome.desktop.interface gtk-theme)"
    sleep 10        
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.