blob: d7eee13f8cdfbe27522fd500a1da7c19453d6eed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#!/bin/python
from pystray import Icon, MenuItem, Menu
from PIL import Image
import os
import subprocess
app_path = "/opt/zalo"
electron22_path = "/usr/bin/electron22"
# Paths to your Zalo application and icon
app_asar = os.path.join(app_path, "app.asar")
icon_path = os.path.join(app_path, "icon.png")
# Start the Zalo application
process = subprocess.Popen([electron22_path, app_asar])
def option1():
os.system(f'{electron22_path} {app_asar}')
def exit_action(icon, item):
process.kill()
icon.stop()
# Load the tray icon image
image = Image.open(icon_path)
# Create the tray menu
menu = Menu(
MenuItem('Mở Zalo', lambda: option1()),
MenuItem('Thoát', exit_action)
)
# Create the tray icon
icon = Icon("Custom Tray Icon", image, "Zalo", menu)
# Run the icon
icon.run()
|