if not normalized_drive.startswith("/tmp") and not os.path.basename(normalized_drive).startswith("."):
dialog_title = f"Warning - {normalized_drive}"
if not is_dialog_open(dialog_title):
QtWidgets.QMessageBox.critical(
None, dialog_title,
f"Volume {normalized_drive} was removed without being ejected first.\n\n"
"To prevent data loss, always eject volumes before removal."
)
Maybe the easiest is to check for windows with the same title like this: