Skip to content

Commit

Permalink
Try windows taskbar
Browse files Browse the repository at this point in the history
  • Loading branch information
scosman committed Aug 12, 2024
1 parent 321bf4d commit 17adf80
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions desktop/desktop.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def close_splash():

if __name__ == "__main__":
# run the server in a thread, and shut down server when main thread exits
# use_colors=False to disable colored logs, as windows doesn't support them
config = uvicorn.Config(
server.app, host="127.0.0.1", port=8757, log_level="warning", use_colors=False
)
Expand All @@ -86,9 +87,18 @@ def close_splash():
).run_in_thread():
# TK without a window, to get dock events
root = tk.Tk()
root.withdraw() # hide the window
# Register callback for the dock icon to reopen the web app
root.createcommand("tk::mac::ReopenApplication", show_studio)
root.title("fune")
if sys.platform == "darwin":
root.withdraw() # remove the window, but will leave the dock icon
# Register callback for the dock icon to reopen the web app
root.createcommand("tk::mac::ReopenApplication", show_studio)
elif sys.platform == "Windows":
# Make the window transparent, so it does show up in the taskbar
root.attributes("-alpha", 0.0)
top = tk.Toplevel(root)
top.overrideredirect(1)
# Bind tapping the taskbar icon to show the window
root.bind("<Map>", show_studio)
run_taskbar()
root.after(10, show_studio)
root.after(10, close_splash)
Expand Down

0 comments on commit 17adf80

Please sign in to comment.