Jurosh
Jurosh

Reputation: 7767

How to configure Window Title in Flutter desktop app (linux)?

I've created basic Hello World app using Flutter template and now running it on Linux using flutter run command.

In application window top panel ("Title bar") there is text "hello_world" and I am trying to figure out how to change this default.

enter image description here

Note: I am not trying to modify it dynamically. Just need to set it to static text.

Upvotes: 4

Views: 1007

Answers (1)

Etornam
Etornam

Reputation: 493

Inside the linux folder, locate a file called my_application.cc and locate this line of code

if (use_header_bar) {
    GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
    gtk_widget_show(GTK_WIDGET(header_bar));
    gtk_header_bar_set_title(header_bar, "some_app"); //<----- change this
    gtk_header_bar_set_show_close_button(header_bar, TRUE);
    gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
  } else {
    gtk_window_set_title(window, "some_app"); //<----- change this
  }

Upvotes: 6

Related Questions