disable decoration on mobile compositors by default

On mobile compositors like Phosh, the title bar will have no
buttons and is useless. Therefore it can be disabled by default.

This behaviour can still be overwritten using the
ATL_DISABLE_WINDOW_DECORATIONS environment variable.
This commit is contained in:
Julian Winkler 2024-10-31 16:44:56 +01:00
parent b413f67932
commit 0bec10bb26

View file

@ -401,8 +401,16 @@ static void open(GtkApplication *app, GFile **files, gint nfiles, const gchar *h
window = gtk_application_window_new(app);
if (getenv("ATL_DISABLE_WINDOW_DECORATIONS"))
gtk_window_set_decorated(GTK_WINDOW(window), 0);
const char *disable_decoration_env = getenv("ATL_DISABLE_WINDOW_DECORATIONS");
gboolean decorated;
if (disable_decoration_env)
decorated = !strcmp(disable_decoration_env, "0") || !strcmp(disable_decoration_env, "false");
else { // by default only enable decorations if there are any action buttons to show in the title bar
const char *decoration_layout;
g_object_get(G_OBJECT(gtk_settings_get_default()), "gtk-decoration-layout", &decoration_layout, NULL);
decorated = strcmp(decoration_layout, "") && strcmp(decoration_layout, "menu");
}
gtk_window_set_decorated(GTK_WINDOW(window), decorated);
if (getenv("ATL_FORCE_FULLSCREEN"))
gtk_window_fullscreen(GTK_WINDOW(window));