main: Use dark theme when run in a Phosh session

Downstreams either don't restyle making us divert from the designs or
use squeekboard-restyled adding extra complexity.

Closes: #242
This commit is contained in:
Guido Günther
2021-11-21 20:33:41 +01:00
parent 28a48635b3
commit c3337b05b6

View File

@ -245,6 +245,32 @@ session_register(void) {
g_signal_connect (_client_proxy, "g-signal", G_CALLBACK (client_proxy_signal), NULL);
}
static void
phosh_theme_init (void)
{
GtkSettings *gtk_settings;
const char *desktop;
gboolean phosh_session;
g_auto (GStrv) components = NULL;
desktop = g_getenv ("XDG_CURRENT_DESKTOP");
if (!desktop) {
return;
}
components = g_strsplit (desktop, ":", -1);
phosh_session = g_strv_contains ((const char * const *)components, "Phosh");
if (!phosh_session) {
return;
}
gtk_settings = gtk_settings_get_default ();
g_object_set (G_OBJECT (gtk_settings), "gtk-application-prefer-dark-theme", TRUE, NULL);
}
int
main (int argc, char **argv)
{
@ -270,6 +296,8 @@ main (int argc, char **argv)
eek_init ();
phosh_theme_init ();
// Set up Wayland
gdk_set_allowed_backends ("wayland");
GdkDisplay *gdk_display = gdk_display_get_default ();