From 64cfe2b16329dcbee4dbe11dff314512c23f4761 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Fri, 9 Dec 2022 17:23:49 +0000 Subject: [PATCH] SpaceAnalyzer: Display the current location in the window title :^) --- Userland/Applications/SpaceAnalyzer/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Userland/Applications/SpaceAnalyzer/main.cpp b/Userland/Applications/SpaceAnalyzer/main.cpp index c6d95d50b3..8ce4b31a2c 100644 --- a/Userland/Applications/SpaceAnalyzer/main.cpp +++ b/Userland/Applications/SpaceAnalyzer/main.cpp @@ -412,6 +412,9 @@ ErrorOr serenity_main(Main::Arguments arguments) breadcrumbbar.clear_segments(); for (size_t k = 0; k < treemapwidget.path_size(); k++) { if (k == 0) { + if (treemapwidget.viewpoint() == 0) + window->set_title("/ - SpaceAnalyzer"); + breadcrumbbar.append_segment("/", GUI::FileIconProvider::icon_for_path("/").bitmap_for_size(16), "/", "/"); continue; } @@ -421,6 +424,10 @@ ErrorOr serenity_main(Main::Arguments arguments) builder.append('/'); builder.append(node->name()); + // Sneakily set the window title here, while the StringBuilder holds the right amount of the path. + if (k == treemapwidget.viewpoint()) + window->set_title(DeprecatedString::formatted("{} - SpaceAnalyzer", builder.string_view())); + breadcrumbbar.append_segment(node->name(), GUI::FileIconProvider::icon_for_path(builder.string_view()).bitmap_for_size(16), builder.string_view(), builder.string_view()); } breadcrumbbar.set_selected_segment(treemapwidget.viewpoint());