Skip to content

Commit

Permalink
Fix QR code and change port windows for Linux
Browse files Browse the repository at this point in the history
- Fixed an issue with the QR code and change port windows where the icon was not displaying correctly, causing an error on Linux.
- Added platform-specific handling for setting window icons.
- Used PNG images instead of ICO for Linux compatibility.
  • Loading branch information
Lenochxd committed Dec 11, 2024
1 parent ed3663f commit a8d00ec
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions app/tray.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ def show_qrcode():
text_label = tk.Label(window, text=f"http://{local_ip}:{get_port()}/", font=("Helvetica", 13))
text_label.pack()

window.iconbitmap("static/icons/icon.ico")
if is_win:
window.iconbitmap("static/icons/icon.ico")
else:
icon_image = ImageTk.PhotoImage(file="static/icons/icon.ico")
window.iconphoto(False, icon_image)
window.lift()
window.focus_force()

Expand Down Expand Up @@ -168,7 +172,7 @@ def create_language_menu_item(lang):

def generate_tray_icon():
global icon
image = Image.open("static/icons/icon.ico")
image = Image.open("static/icons/icon.png")

menu = generate_menu(language, server_status=0)

Expand Down Expand Up @@ -211,7 +215,11 @@ def close_prompt(event=None):
prompt_window.title(text('change_server_port'))
prompt_window.geometry("300x160")
prompt_window.resizable(False, False)
prompt_window.iconbitmap("static/icons/icon_black.ico")
if is_win:
prompt_window.iconbitmap("static/icons/icon_black.ico")
else:
icon_image = ImageTk.PhotoImage(file="static/icons/icon_black.png")
prompt_window.iconphoto(False, icon_image)

frame = tk.Frame(prompt_window, padx=10, pady=10)
frame.pack(expand=True)
Expand Down
Binary file added static/icons/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/icons/icon_black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a8d00ec

Please sign in to comment.