7

Usually pressing Alt+F2 and typing rt will reload the theme defined in gnome-shell.css.
But I want a command line to do that. With command line, one can easily reload the theme via a program when file is modified or exactly saved.

Is there any mean to do that please?

NorTicUs
  • 2,382

1 Answers1

7

This may be a bit late, but just for future reference:

gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval 'Main.loadTheme();'

(tested on 3.6/3.8)

l300lvl
  • 1,182
  • Thanks. I was waiting for it for a long time. Is this new feature in Gnome 3.6 – jiyinyiyong Apr 17 '13 at 05:50
  • Actually this may work in as far back as 3.2, I'm not sure exactly when gdbus or these specific calls were implemented, but they werent very well documented or easy to understand.

    I happened across this specific question on my own journey to be able to reload theme from command so I could better test an extension I'm updating for 3.8.

    I had the idea to try the loadTheme() function in place of lookingGlass.toggle() using the method I found here:

    http://askubuntu.com/questions/91938/how-can-one-invoke-lg-looking-glass-from-a-command-line

    – l300lvl Apr 17 '13 at 06:16
  • 3
    This didn't work for me on 3.14, and neither did rt. I didn't need this to work via command specifically, just to reload a theme quickly to see my changes' effect. Opening gnome-tweak-tool and switching themes to something else and back worked for this use case. – Vasiliy Sharapov Oct 15 '15 at 22:41
  • Assuming that you installed the extension User Theme, you can also use gsettings to reload a theme: gsettings set org.gnome.shell.extensions.user-theme name <my-theme>. – elboulangero Jun 08 '17 at 03:53
  • On Ubuntu 20.04.2 LTS it was in: /usr/share/themes/Yaru/gtk-3.20/gtk.css. To identify current theme (Yaru in my case, and by default i think) you can use following command: gsettings get org.gnome.desktop.interface gtk-theme. I had to restart to make the changes apply. – duo Mar 30 '21 at 12:37