Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API tray.destroy is not working #17622

Closed
3 tasks done
rhythm-sharma opened this issue Mar 30, 2019 · 49 comments · Fixed by #18196
Closed
3 tasks done

API tray.destroy is not working #17622

rhythm-sharma opened this issue Mar 30, 2019 · 49 comments · Fixed by #18196

Comments

@rhythm-sharma
Copy link

rhythm-sharma commented Mar 30, 2019

Preflight Checklist

  • I have read the Contributing Guidelines for this project.
  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Issue Details

  • Electron Version:
    • 4.0.4
  • Operating System:
    • Ubuntu 18.10 x64

Expected Behavior

Observed in Zulip desktop app

  1. tray.destroy() api should destroy tray icon in panel
  2. show app tray icon option in general setting, it should destroy and create tray icon on toggle

Actual Behavior

Previous tray icon are not destroy on toggle and new icon created i.e tray.destroy API is not working

Screenshot from 2019-03-30 18-57-58

To Reproduce

$ git clone https://github.com/zulip/zulip-electron
$ cd zulip-electron
$ npm install
$ npm start

you can find code in zulip-electron/app/renderer/js/tray.js

function toggleTray() {
	let state;
	if (window.tray) {
		state = false;
		window.tray.destroy();
		if (window.tray.isDestroyed()) {
			window.tray = null;
		}
		ConfigUtil.setConfigItem('trayIcon', false);
	} else {
		state = true;
		createTray();
		if (process.platform === 'linux' || process.platform === 'win32') {
			renderNativeImage(unread).then(image => {
				window.tray.setImage(image);
				window.tray.setToolTip(unread + ' unread messages');
			});
		}
		ConfigUtil.setConfigItem('trayIcon', true);
	}
	const selector = 'webview:not([class*=disabled])';
	const webview = document.querySelector(selector);
	const webContents = webview.getWebContents();
	webContents.send('toggletray', state);
}

Screenshots

Image 2019-03-17 at 12 45 47 PM

@rhythm-sharma
Copy link
Author

@MarshallOfSound can you please review this ?

@chfanghr
Copy link

my work around:Spawn a new process to show tray

@chfanghr
Copy link

KDE and GNOME have the same ploblem that caused by the desktop itself,so the only thing we can do is to work around.

@rhythm-sharma
Copy link
Author

rhythm-sharma commented Mar 30, 2019

@chfanghr okay got you point, thanks for you help

@rhythm-sharma
Copy link
Author

KDE and GNOME have the same ploblem that caused by the desktop itself,so the only thing we can do is to work around.

i tried alt + f2 -> r, it solve this on temporary basis

@chfanghr
Copy link

chfanghr commented Mar 30, 2019 via email

@rhythm-sharma
Copy link
Author

@chfanghr
Though, I hit this Gnome Shell bug, and my Gnome crashed a couple of times, before I figured out what was happening!

@chfanghr
Copy link

you should try kde,at least it doesn't crash

@rhythm-sharma
Copy link
Author

rhythm-sharma commented Mar 30, 2019

@chfanghr i read about GtkStatusIcon in Tray documentation here under Platform limitations section, would you please tell me how to install it in ubuntu

@chfanghr
Copy link

Instructions here.Also ,you can use kubuntu image directly.

@chfanghr
Copy link

And you may have to replace your login manager with sddm.

@rhythm-sharma
Copy link
Author

I don't know much about GtkStatusicon, if you know something then tell me about it(how to install)

@chfanghr
Copy link

Oh sorry .GtkStatusion is a part of gnome so you don't have to install it Manually . As for libappindicator1 ,you can install it with apt .But actually it doesn't solve this issue.

@rhythm-sharma
Copy link
Author

Thanks, okay it cleared my concept

@chfanghr
Copy link

If you want a better Tray experience,you may want to try qt.But I wonder how they achieve it.

@rhythm-sharma
Copy link
Author

rhythm-sharma commented Mar 31, 2019

Hmm Zulip-desktop is based on electron a single person can't change the codebase 😄

@chfanghr
Copy link

Using KDE's native API sovle this issue,but that's annoying....

@rhythm-sharma
Copy link
Author

rhythm-sharma commented Mar 31, 2019

can you provide a link for KDE native API

@chfanghr
Copy link

https://api.kde.org/pykde-4.4-api/kdeui/KSystemTrayIcon.html

@chfanghr
Copy link

But now I have to manage my codebase in five languages...GOD DAME

@rhythm-sharma
Copy link
Author

that's really annoying 😆

@chfanghr
Copy link

Perhaps you can rewrite the application with PWA and wasm.Though you need chrome ,the user experience will be better on every platforms.

@chfanghr
Copy link

check this : https://techbase.kde.org/Projects/Plasma/NewSystemTray

@rhythm-sharma
Copy link
Author

rhythm-sharma commented Apr 2, 2019

@chfanghr i had exams so sorry for late responding, I think it would be a bad option for me to dive deeper into the OS because I do not know much about them, I think we should see how other apps(like skype etc based on electron) are solving this issue because it is a problem with electron and linux

@chfanghr
Copy link

chfanghr commented Apr 4, 2019

ok,did you make any progress?

@rhythm-sharma
Copy link
Author

rhythm-sharma commented Apr 4, 2019

No progress, Skype don't interfere with tray icon, though I saw some issue on tray icon is not showing up but they didn't solve the problem

@chfanghr
Copy link

chfanghr commented Apr 9, 2019

Update https://github.com/meetfranz/franz/issues/1377

@Bilb
Copy link

Bilb commented Aug 13, 2021

Just bumped from electron

  • "electron": "8.2.0",
    to
  • "electron": "^13.1.9",

and this bug started to appear. The destroy was working correctly before that.

Bilb added a commit to Bilb/session-desktop that referenced this issue Aug 13, 2021
aleksey-hoffman added a commit to aleksey-hoffman/sigma-file-manager that referenced this issue Aug 25, 2021
Tray.destroy() is not working on Linux due to:
electron/electron#17622

Which causes tray icon to duplicate on every init.
@github-actions
Copy link
Contributor

github-actions bot commented Oct 8, 2022

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@github-actions github-actions bot added the stale label Oct 8, 2022
@itsPG
Copy link

itsPG commented Oct 8, 2022

same on v17.4.11.

haven't tried the latest v21 though.

@github-actions github-actions bot removed the stale label Oct 9, 2022
@github-actions
Copy link
Contributor

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@github-actions github-actions bot added the stale label Jan 10, 2023
@itsPG
Copy link

itsPG commented Jan 10, 2023

Still reproducable on v17.4.11.

Hope someoe who encounters this issue could help us test the latest version.

I used a deprecated API and cannot upgrade right now.

@github-actions github-actions bot removed the stale label Jan 11, 2023
@github-actions
Copy link
Contributor

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@github-actions github-actions bot added the stale label Apr 12, 2023
@rak-phillip
Copy link

Not stale, able to repro on electron v20.3.8 in Ubuntu 22.04 Gnome. Would like to update to latest stable version of electron to confirm that this is still a problem.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 3, 2023

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@github-actions github-actions bot added the stale label Aug 3, 2023
@codebytere codebytere removed their assignment Aug 10, 2023
@electron-issue-triage
Copy link

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

@electron-issue-triage
Copy link

This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a supported version of Electron please open a new issue and include instructions for reproducing the issue.

@electron-issue-triage electron-issue-triage bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 10, 2023
@viktordw
Copy link

This was closed due to inactivity, but It seems this is still not resolved.
There is an active issue for keeweb project that is related to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: 👍 Does Not Block Stable
Development

Successfully merging a pull request may close this issue.