blob: 0292a58fe973d3292a5a19af7de18dc49b4d4f05 (
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
|
#!/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_floder = os.path.join(app_path, "app")
icon_path = os.path.join(app_path, "icon.png")
# Start the Zalo application
process = subprocess.Popen([electron22_path, app_floder])
def option1():
os.system(f'{electron22_path} {app_floder}')
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()
|