From 00a24bc84b95c7440383c5e1e955e99610e2b6f4 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Thu, 7 Dec 2023 11:19:08 +0100 Subject: [PATCH] impr: Remove "ImHex" from title bar if a file is loaded --- main/gui/source/window/window.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/main/gui/source/window/window.cpp b/main/gui/source/window/window.cpp index 0f040afb2..066141b68 100644 --- a/main/gui/source/window/window.cpp +++ b/main/gui/source/window/window.cpp @@ -121,7 +121,7 @@ namespace hex { if (ProjectFile::hasPath()) { // If a project is open, show the project name instead of the file name - title += " - Project " + hex::limitStringLength(ProjectFile::getPath().stem().string(), 32); + title = "Project " + hex::limitStringLength(ProjectFile::getPath().stem().string(), 32); if (ImHexApi::Provider::isDirty()) title += " (*)"; @@ -129,7 +129,7 @@ namespace hex { } else if (ImHexApi::Provider::isValid()) { auto provider = ImHexApi::Provider::get(); if (provider != nullptr) { - title += " - " + hex::limitStringLength(provider->getName(), 32); + title = hex::limitStringLength(provider->getName(), 32); if (provider->isDirty()) title += " (*)"; @@ -141,8 +141,12 @@ namespace hex { this->m_windowTitle = title; - if (this->m_window != nullptr) + if (this->m_window != nullptr) { + if (title != "ImHex") + title = "ImHex - " + title; + glfwSetWindowTitle(this->m_window, title.c_str()); + } }); // Handle opening popups