quickmacapp 2025.7.22__py3-none-any.whl → 2026.2.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
quickmacapp/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  from ._quickapp import Actionable, ItemState, Status, mainpoint, menu, quit
2
2
  from ._interactions import ask, choose, answer, getpass
3
- from ._background import dockIconWhenVisible
3
+ from ._background import dockIconWhenVisible, DockIconManager
4
4
 
5
5
  __all__ = [
6
6
  "Actionable",
@@ -14,4 +14,5 @@ __all__ = [
14
14
  "answer",
15
15
  "getpass",
16
16
  "dockIconWhenVisible",
17
+ "DockIconManager",
17
18
  ]
@@ -1,6 +1,6 @@
1
- from typing import Any, Callable
2
-
1
+ from contextlib import contextmanager
3
2
  from dataclasses import dataclass, field
3
+ from typing import Any, Callable, Iterator, Protocol, ContextManager
4
4
 
5
5
  from AppKit import (
6
6
  NSApplication,
@@ -21,6 +21,18 @@ from AppKit import (
21
21
  )
22
22
 
23
23
 
24
+ class DockIconManager(Protocol):
25
+ """
26
+ Methods for managing the background dock icon status.
27
+ """
28
+
29
+ def noDockIcon(self) -> ContextManager[None]:
30
+ """
31
+ Temporarily suppress the application foregrounding with a dock icon,
32
+ for example, while displaying a brief popup.
33
+ """
34
+
35
+
24
36
  @dataclass
25
37
  class SometimesBackground:
26
38
  """
@@ -35,12 +47,27 @@ class SometimesBackground:
35
47
  onSpaceChange: Callable[[], None]
36
48
  currentlyRegular: bool = False
37
49
  previouslyActiveApp: NSRunningApplication = field(init=False)
50
+ suppressed: bool = False
51
+
52
+ @contextmanager
53
+ def noDockIcon(self) -> Iterator[None]:
54
+ """
55
+ For the duration of this contextmanager, don't show the dock icon or show the main window.
56
+ """
57
+ self.suppressed = True
58
+ try:
59
+ yield None
60
+ finally:
61
+ self.suppressed = False
38
62
 
39
63
  def someApplicationActivated_(self, notification: Any) -> None:
40
64
  # NSLog(f"active {notification} {__file__}")
41
65
  whichApp = notification.userInfo()[NSWorkspaceApplicationKey]
42
66
 
43
- if whichApp == NSRunningApplication.currentApplication():
67
+ if (
68
+ whichApp == NSRunningApplication.currentApplication()
69
+ and not self.suppressed
70
+ ):
44
71
  if self.currentlyRegular:
45
72
  # NSLog("show editor window")
46
73
  self.mainWindow.setIsVisible_(True)
@@ -89,7 +116,9 @@ class SometimesBackground:
89
116
  NSLog("I am not on the active space, closing the window")
90
117
  self.mainWindow.close()
91
118
  else:
92
- NSLog("I am not on the active space, but that's OK, leaving window open.")
119
+ NSLog(
120
+ "I am not on the active space, but that's OK, leaving window open."
121
+ )
93
122
  else:
94
123
  NSLog("I am on the active space; not closing.")
95
124
  self.onSpaceChange()
@@ -143,7 +172,7 @@ def dockIconWhenVisible(
143
172
  mainWindow: NSWindow,
144
173
  hideIconOnOtherSpaces: bool = True,
145
174
  onSpaceChange: Callable[[], None] = lambda: None,
146
- ):
175
+ ) -> DockIconManager:
147
176
  """
148
177
  When the given main window is visible, we should have a dock icon (i.e.: be
149
178
  NSApplicationActivationPolicyRegular). When our application is activated,
@@ -152,4 +181,6 @@ def dockIconWhenVisible(
152
181
  then closed, or when our application is hidden, we should hide our dock
153
182
  icon (i.e.: be NSApplicationActivationPolicyAccessory).
154
183
  """
155
- SometimesBackground(mainWindow, hideIconOnOtherSpaces, onSpaceChange).startObserving()
184
+ background = SometimesBackground(mainWindow, hideIconOnOtherSpaces, onSpaceChange)
185
+ background.startObserving()
186
+ return background
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quickmacapp
3
- Version: 2025.7.22
3
+ Version: 2026.2.3
4
4
  Summary: Make it easier to write Mac apps in Python
5
5
  Description-Content-Type: text/x-rst
6
6
  License-File: LICENSE
@@ -0,0 +1,12 @@
1
+ quickmacapp/__init__.py,sha256=jmUN0AXWo6UtzitqPrGOudBwHIP1JuXlQ0e30VUCgkY,403
2
+ quickmacapp/_background.py,sha256=uRyYqnRQnVs2Thc-tXVjJjrMdk98KRSaXmmSUMpBdq4,6834
3
+ quickmacapp/_interactions.py,sha256=eLv_mVf5Jr-puNizlR8tDL_DlLy1Rc82XQ80o0GP5R4,3439
4
+ quickmacapp/_notifications.py,sha256=DNm4-vOF0wQNUUTBHqp3-RKXVQK98ef53isxwsWqyj8,16965
5
+ quickmacapp/_quickapp.py,sha256=VmX8mc9bfmWJtNSH2Jd63ZgZDQIhyyNTq4vXO7vUzXw,9646
6
+ quickmacapp/notifications.py,sha256=UCigVIurf-zWAqVXUYjTtz_xMjcoI23dqyJ4OzZurQM,10275
7
+ quickmacapp/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ quickmacapp-2026.2.3.dist-info/licenses/LICENSE,sha256=7RIBNNvrnKHR3lw9z3KXv3Q6RRjhyxtNQoMnoUsf3_M,1091
9
+ quickmacapp-2026.2.3.dist-info/METADATA,sha256=A5EyARrKOaOP4MqKRZZaIqo0HZg962Qx0_zZY2uXJaA,1343
10
+ quickmacapp-2026.2.3.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
11
+ quickmacapp-2026.2.3.dist-info/top_level.txt,sha256=_iJkekUYnuWhCZbFSQyo2d5_6B7OoPwx7k527bokzeA,12
12
+ quickmacapp-2026.2.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.9.0)
2
+ Generator: setuptools (80.10.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,12 +0,0 @@
1
- quickmacapp/__init__.py,sha256=WAfaenkgALceVKrSmVBoEOJER-SX65r4WjkaBGtmO24,363
2
- quickmacapp/_background.py,sha256=M_ob3EF8v-Z_gpKuFDl2N9XrQz0eBLFfUp2XErDB3DU,5943
3
- quickmacapp/_interactions.py,sha256=eLv_mVf5Jr-puNizlR8tDL_DlLy1Rc82XQ80o0GP5R4,3439
4
- quickmacapp/_notifications.py,sha256=DNm4-vOF0wQNUUTBHqp3-RKXVQK98ef53isxwsWqyj8,16965
5
- quickmacapp/_quickapp.py,sha256=VmX8mc9bfmWJtNSH2Jd63ZgZDQIhyyNTq4vXO7vUzXw,9646
6
- quickmacapp/notifications.py,sha256=UCigVIurf-zWAqVXUYjTtz_xMjcoI23dqyJ4OzZurQM,10275
7
- quickmacapp/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- quickmacapp-2025.7.22.dist-info/licenses/LICENSE,sha256=7RIBNNvrnKHR3lw9z3KXv3Q6RRjhyxtNQoMnoUsf3_M,1091
9
- quickmacapp-2025.7.22.dist-info/METADATA,sha256=BNFvXnBhcDTHceZUL3KESVIVjCfqF-iHeBhluSVt9NU,1344
10
- quickmacapp-2025.7.22.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
- quickmacapp-2025.7.22.dist-info/top_level.txt,sha256=_iJkekUYnuWhCZbFSQyo2d5_6B7OoPwx7k527bokzeA,12
12
- quickmacapp-2025.7.22.dist-info/RECORD,,