python-eel / Eel

A little Python library for making simple Electron-like HTML/JS GUI apps
MIT License
6.29k stars 582 forks source link

How to keep the application icon on the dock #680

Open BingoBob7 opened 1 year ago

BingoBob7 commented 1 year ago

Describe the problem When I run my app the script icon appears on the dock briefly then disappears. Then the same thing with the Chrome icon. Then my app opens and functions fine. But there is no dock icon indicating that it's still running. It also makes it difficult to switch to the app. How can I make my icon stay on the dock?

Code snippet(s)

import eel
eel.init('web')
eel.start('index.html', size=(500, 900), position=(0,0))
<html>
<head>
    <title>Test</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="icon" href="favicon.ico">
    <script type="text/javascript" src="/eel.js"></script>
</head>
<body>
    <h1>Hello World</h1>
</body>
</html>
python3 -m eel main.py web  --onefile --noconsole --icon=web/favicon.ico

Desktop:

thatfloflo commented 1 year ago

I think this may be associated in part with the --noconsole argument to pyinstaller. If you remove that, I presume the console window stays visible in the dock? Beside this, the real thing I can imagine happening is probably that the browser window that opens is opened in an already running browser process, therefore doesn't get its own icon in the doc. Does it appear when you look through the opened instances of your browser, which presumably is on the dock already? If this is the case, you can try running in app mode (e.g. specify "chrome-app" as the browser). Chrome (and Edge) usually force separation when they run in app mode, so that could help.