forked from Support/sp-hydra-veil-gui
34 lines
969 B
Python
Executable file
34 lines
969 B
Python
Executable file
import os
|
|
|
|
from PyQt6.QtWidgets import QSystemTrayIcon
|
|
from PyQt6.QtGui import QIcon
|
|
from PyQt6.QtCore import QSize
|
|
|
|
|
|
def init_system_tray(parent, icon_base_path):
|
|
if not QSystemTrayIcon.isSystemTrayAvailable():
|
|
return None
|
|
|
|
tray_icon = QIcon()
|
|
window_icon = QIcon()
|
|
|
|
tray_sizes = [22, 24]
|
|
for size in tray_sizes:
|
|
icon_path = os.path.join(
|
|
icon_base_path, f"hv-icon-{size}x{size}.png")
|
|
if os.path.exists(icon_path):
|
|
tray_icon.addFile(icon_path, QSize(size, size))
|
|
|
|
window_sizes = [32, 48, 64, 128]
|
|
for size in window_sizes:
|
|
icon_path = os.path.join(
|
|
icon_base_path, f"hv-icon-{size}x{size}.png")
|
|
if os.path.exists(icon_path):
|
|
window_icon.addFile(icon_path, QSize(size, size))
|
|
|
|
tray = QSystemTrayIcon(parent)
|
|
tray.setToolTip('HydraVeil')
|
|
tray.setIcon(tray_icon)
|
|
tray.setVisible(True)
|
|
parent.setWindowIcon(window_icon)
|
|
return tray
|