summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2021-04-06 19:28:23 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2021-04-08 15:46:03 +0200
commitc8afe63a5434420fed5b2798386776673037f36d (patch)
tree743c4179c3d58c81ce3c3ce1bde960ae9373e4c7
parent55faf1c874fae5b67928395d3a35889bbb4e458b (diff)
Improve the editor window title for better usability
- Display the scene name, then the project name, then "Godot Engine". - Display the "modified" mark before anytihng else. Both of these changes ensure important, project-specific elements can always be seen in the task bar which may truncate strings due to its low per-item width. - Use "Unnamed Project" if the project has no name (similar to the Project Manager).
-rw-r--r--editor/editor_node.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 9ca46cfcc0..032244c489 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -376,14 +376,16 @@ void EditorNode::_version_control_menu_option(int p_idx) {
}
void EditorNode::_update_title() {
- String appname = ProjectSettings::get_singleton()->get("application/config/name");
- String title = appname.is_empty() ? String(VERSION_FULL_NAME) : String(VERSION_NAME + String(" - ") + appname);
- String edited = editor_data.get_edited_scene_root() ? editor_data.get_edited_scene_root()->get_filename() : String();
+ const String appname = ProjectSettings::get_singleton()->get("application/config/name");
+ String title = (appname.is_empty() ? "Unnamed Project" : appname) + String(" - ") + VERSION_NAME;
+ const String edited = editor_data.get_edited_scene_root() ? editor_data.get_edited_scene_root()->get_filename() : String();
if (!edited.is_empty()) {
- title += " - " + String(edited.get_file());
+ // Display the edited scene name before the program name so that it can be seen in the OS task bar.
+ title = vformat("%s - %s", edited.get_file(), title);
}
if (unsaved_cache) {
- title += " (*)";
+ // Display the "modified" mark before anything else so that it can always be seen in the OS task bar.
+ title = vformat("(*) %s", title);
}
DisplayServer::get_singleton()->window_set_title(title);