impr: Show OS toast popup when a task finishes while ImHex is not focused

This commit is contained in:
WerWolv
2025-12-25 15:34:56 +01:00
parent bf1f613052
commit 691b56b4ac
5 changed files with 46 additions and 0 deletions

View File

@@ -75,6 +75,7 @@
"hex.builtin.command.web.desc": "Website lookup",
"hex.builtin.command.web.result": "Navigate to '{0}'",
"hex.builtin.drag_drop.text": "Drop files here to open them...",
"hex.builtin.os_toast_message.task_finished": "Task '{0}' finished",
"hex.builtin.inspector.ascii": "char",
"hex.builtin.inspector.binary": "Binary",
"hex.builtin.inspector.bfloat16": "bfloat16",

View File

@@ -206,6 +206,13 @@ namespace hex::plugin::builtin {
ui::ToastError::open(fmt::format("hex.builtin.popup.error.project.load"_lang, wolv::util::toUTF8String(path)));
}
});
} else if (name == "Open Folder") {
fs::openFileBrowser(fs::DialogMode::Folder, { },
[](const auto &path) {
if (!ProjectFile::load(path)) {
ui::ToastError::open(fmt::format("hex.builtin.popup.error.project.load"_lang, wolv::util::toUTF8String(path)));
}
});
}
});
@@ -420,6 +427,11 @@ namespace hex::plugin::builtin {
#endif
});
TaskManager::addTaskCompletionCallback([](Task &task) {
if (!glfwGetWindowAttrib(ImHexApi::System::getMainWindowHandle(), GLFW_FOCUSED) && !task.isBackgroundTask())
hex::showToastMessage("ImHex", fmt::format("hex.builtin.os_toast_message.task_finished"_lang, Lang(task.getUnlocalizedName())));
});
}
}