Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ Ashish Yadav <48384865+criticalAY@users.noreply.github.com>
Timothy Lee <timothyl@berkeley.edu>
DespicableGoose <68354378+DespicableGoose@users.noreply.github.com>
Han Lua <72375847+xiaohan484@users.noreply.github.com>
Jiaming Pei <jiamingpei16@gmail.com>

********************

Expand Down
14 changes: 14 additions & 0 deletions qt/aqt/deckoptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from anki.cards import Card
from anki.decks import DeckDict, DeckId
from anki.lang import without_unicode_isolation
from anki.utils import is_mac
from aqt import gui_hooks
from aqt.qt import *
from aqt.utils import (
Expand Down Expand Up @@ -59,6 +60,19 @@ def set_ready(self):
self._ready = True
gui_hooks.deck_options_did_load(self)

def changeEvent(self, evt: QEvent | None) -> None:
# A minimized application-modal window can't be restored on macOS (not
# from the Dock or the Window menu), leaving the app unusable until it's
# force-quit. Refuse to stay minimized.
if (
is_mac
and evt is not None
and evt.type() == QEvent.Type.WindowStateChange
and self.isMinimized()
):
self.showNormal()
super().changeEvent(evt)

def closeEvent(self, evt: QCloseEvent | None) -> None:
if self._close_event_has_cleaned_up or not self._ready:
return super().closeEvent(evt)
Expand Down