Skip to content

Commit acbbc70

Browse files
committed
Windows fix
1 parent 879f251 commit acbbc70

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

utils/notifications.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,27 @@
66
import asyncio
77
import logging
88
from typing import Optional
9-
from desktop_notifier import DesktopNotifier, Urgency, Button, ReplyField
9+
from desktop_notifier import DesktopNotifier, Icon, Urgency, Button, ReplyField
1010
from pathlib import Path
1111

1212
logger = logging.getLogger(__name__)
1313

1414

15+
def _encodeforge_notification_icon() -> Icon | None:
16+
"""Real filesystem path only — Nuitka breaks desktop_notifier's DEFAULT_ICON (importlib.resources → as_uri)."""
17+
path = Path(__file__).resolve().parent.parent / "resources" / "icons" / "app-icon.png"
18+
return Icon(path=path) if path.is_file() else None
19+
20+
1521
class NotificationManager:
1622
"""Manages desktop notifications for EncodeForge"""
1723

1824
def __init__(self, app_name: str = "EncodeForge"):
1925
self.notifier = DesktopNotifier(
2026
app_name=app_name,
21-
notification_limit=10
27+
notification_limit=10,
28+
app_icon=_encodeforge_notification_icon(),
2229
)
23-
24-
# Set app icon if available
25-
icon_path = Path(__file__).parent.parent / "resources" / "icons" / "app-icon.png"
26-
if icon_path.exists():
27-
self.notifier.app_icon = str(icon_path)
2830

2931
async def notify_success(self, title: str, message: str):
3032
"""Show success notification"""

0 commit comments

Comments
 (0)