You are not logged in.

#1 2014-03-03 17:44:38

Thorsten Reinbold
Member
From: Germany
Registered: 2011-12-06
Posts: 353

Gtk3: is there a way to make single apps use the adwaita dark theme?

Hi there!

Does anyone know if there is a way to make single applications (like rhythmbox) use the dark variant of adwaita?


Thank you!

Last edited by Thorsten Reinbold (2014-03-03 17:48:39)

Offline

#2 2014-03-03 18:06:31

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: Gtk3: is there a way to make single apps use the adwaita dark theme?

According to this thread on superuser.com, the answer is, "Kind of no but but a little bit yes". hmm

Last edited by drcouzelis (2014-03-03 18:07:07)

Offline

#3 2014-03-03 18:17:04

Thorsten Reinbold
Member
From: Germany
Registered: 2011-12-06
Posts: 353

Re: Gtk3: is there a way to make single apps use the adwaita dark theme?

Mh, that's a bit confusing to me. There are single apps (totem, eog) that obviously are using the dark variant. Shouldn't it be possible to use the mechanisms that they use for other apps?

Offline

#4 2014-03-03 18:36:22

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: Gtk3: is there a way to make single apps use the adwaita dark theme?

What? That is strange.

What is your current GTK2 theme?
What is your current GTK3 theme?

All GTK3 applications should look the same...

Last edited by drcouzelis (2014-03-03 18:42:43)

Offline

#5 2014-03-03 18:48:05

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: Gtk3: is there a way to make single apps use the adwaita dark theme?

^ No, some applications by default use the dark variant if it is availble. I know you can turn this on for all applications, but I'm not sure how to (or if it is possible at all) to do this for specific applications that don't do this by default.


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#6 2014-03-03 19:07:52

Thorsten Reinbold
Member
From: Germany
Registered: 2011-12-06
Posts: 353

Re: Gtk3: is there a way to make single apps use the adwaita dark theme?

I've took a look at /usr/share/themes/Adwaita/gtk-3.0. In the good old gtk2 times, I've written some themes on my own, so I'm not a complete noob with gtk.rc or other things. I thought I could make some changes here, but I found out: gtk.css is a nearly empty file. Nothing to edit here. Instead, there is a binary (wtf?) .gresource file. I tried to unpack it with the gresource command, but I have to admit that I don't completly understand the syntax. It seems to me that it is only useful for extracting single resources from that binary, but I want to extract everything from it. What a mess. Thanks, dear gnome-devs, for making things more and more complicated without any needs.

Offline

#7 2014-03-03 19:11:10

Thorsten Reinbold
Member
From: Germany
Registered: 2011-12-06
Posts: 353

Re: Gtk3: is there a way to make single apps use the adwaita dark theme?

drcouzelis wrote:

What? That is strange.

What is your current GTK2 theme?
What is your current GTK3 theme?

All GTK3 applications should look the same...

What Unia says. wink

I'm using the standard theme for Gnome 3.10: Adwaita.

Offline

#8 2014-03-03 20:43:45

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: Gtk3: is there a way to make single apps use the adwaita dark theme?

Unia wrote:

No, some applications by default use the dark variant if it is availble.

WHAT?? Who thought that was a good idea? mad

Holy crap, there it is:
http://unix.stackexchange.com/questions … -gnome-3-4
https://ask.fedoraproject.org/en/questi … ark-theme/

Apparently Totem and EoG are the most notable "dark" exceptions. I wonder where the "trigger" is that tells those applications to prefer the dark theme...

Last edited by drcouzelis (2014-03-03 20:44:43)

Offline

#9 2014-03-03 22:30:50

Steef435
Member
Registered: 2013-08-29
Posts: 577
Website

Re: Gtk3: is there a way to make single apps use the adwaita dark theme?

It's in the source. The application can request a dark variant. It's "useful" for terminals and video players for example.

I think there is an easier way but the first thing I found is this:
http://stackoverflow.com/questions/1599 … dark-theme

It's quite easy to "solve"  though, have a look in /usr/share/themes/Adwaita/gtk-3.0/ or wherever you installed the theme. There are two main css files in there, gtk.css and gtk-dark.css. Simply renaming the gtk-dark.css to gtk.css makes the default light theme the dark variant, if that makes any sense. So if you set the content of gtk.css and gtk-dark.css to the contents of gtk-dark.css everything should have the appearance of the dark variant.

EDIT: Forgot what the initial question was, my bad. I don't know of any way to set this on a specific app except editing the source.

Last edited by Steef435 (2014-03-03 22:32:38)

Offline

#10 2014-03-04 18:52:22

Thorsten Reinbold
Member
From: Germany
Registered: 2011-12-06
Posts: 353

Re: Gtk3: is there a way to make single apps use the adwaita dark theme?

Thanks for the info. Sadly, I'm not a programmer. I've downloaded the source from the official arch repo, but I've stuck in finding out where to place the "gtk-application-prefer-dark-theme" string.

Offline

#11 2014-03-06 17:12:24

Steef435
Member
Registered: 2013-08-29
Posts: 577
Website

Re: Gtk3: is there a way to make single apps use the adwaita dark theme?

I've never done any Gtk+ in C, but I'd put it directly after gtk_init().

gtk_init (&argc, &argv); /* This'll probably be somewhere in int main() */
g_object_set(gtk_settings_get_default(), "gtk-application-prefer-dark-theme", TRUE, NULL); /* <-- This line is what you should add */

Note that it's possible to add more property/value pairs, so if there already is a line like this you could add this property and value behind it.

EDIT: I tried but rhytmbox can't survive without Gnome shell it seems, so I didn't test it.
This is what I did:
edit src/rhythmbox-3.0.1/shell/rb-application.c
There's a line in there like this:

        g_object_get (gtk_settings_get_default (),
                      "gtk-shell-shows-app-menu", &shell_shows_app_menu,
                      NULL);

Change the line like this:

        g_object_get (gtk_settings_get_default (),
                      "gtk-shell-shows-app-menu", &shell_shows_app_menu,
                      "gtk-application-prefer-dark-theme", TRUE,
                      NULL);

Last edited by Steef435 (2014-03-06 22:26:39)

Offline

#12 2014-03-06 19:22:05

jjacky
Member
Registered: 2011-11-09
Posts: 347
Website

Re: Gtk3: is there a way to make single apps use the adwaita dark theme?

Watch out: Looks like you're confusing a g_object_get() for a g_object_set() here!

Offline

#13 2014-03-06 22:25:36

Steef435
Member
Registered: 2013-08-29
Posts: 577
Website

Re: Gtk3: is there a way to make single apps use the adwaita dark theme?

Wow, you're right! Sorry for that, and thanks for pointing it out.
That's what happens when I don't test I suppose..

Offline

Board footer

Powered by FluxBB