Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 465
Jurosh Avatar asked Sep 02 '25 06:09

Jurosh


1 Answers

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
  }
like image 135
Etornam Avatar answered Sep 04 '25 22:09

Etornam