-
-
Notifications
You must be signed in to change notification settings - Fork 361
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
Tray Support #101
Comments
Actually libui-node does not support them, because they are not implemented in libui (see this issue there: andlabs/libui#216). You can try to 👍🏻 that issue to get them implemented there. |
I don't think working with other node packages is going to work that well. I looked quickly and there doesn't seem to be anything cross platform and I assume all the solutions have their own blocking event loop and implementation into JSX is going to be non trivial. |
If |
I don't think that would be that good and it could get out of hand quickly. @JackPyro what exactly do you mean by tray? There's this https://github.com/mikaelbr/node-notifier which can send notifications. But if you want a tray icon it doesn't seem like there's anything good that works. |
Would be nice if it has system tray support |
@kusti8 More like this: I've got my answer, so feel free to close this issue. |
What about using https://github.com/zaaack/node-systray? |
Seems nice |
But there's not C++ code, neither C, how could it work? |
Seems like it uses https://github.com/zaaack/systray-portable which is Go
code.
…On Tue, Jun 5, 2018, 7:01 AM Andrea Parodi ***@***.***> wrote:
But there's not C++ code, neither C, how could it work?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#101 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AJW73Hiaymuu6SHgH8XNQLbOKFAQndXHks5t5mUZgaJpZM4TyV7S>
.
|
ah ok not it make sense |
https://github.com/zaaack/systray-portable seems to include precompiled binaries for each OS though. Would it be possible to include the binary when libui is compiled? |
@Darkle, if you mean in libui-node:
libui-node is and will remain only a binding library to what libui implements. But what's wrong using systray-portable directly in app code? |
Once you get down the road of adding random binaries to stuff like libui-node or proton native, it gets to be a mess, not just because you have to manage one more build scheme, but also because you end up bloating it with people asking why not this binary also. I'll make a page in the docs to address third party solutions such as this, but they should be separate. |
We should start an awesome-desktop-js list... |
Electron supports creating Tray menu out of the box. |
Example for node-systray with proton-native: import React, { Component } from 'react';
import SysTray from 'systray';
import fs from "fs";
import { render, Window, App, Box, TextInput, Menu } from 'proton-native';
const systray = new SysTray({
menu: {
// you should using .png icon in macOS/Linux, but .ico format in windows
icon: new Buffer(fs.readFileSync("/.../icon.png")).toString('base64'),
title: "Test",
tooltip: "Tips",
items: [{
title: "Item",
tooltip: "Item Tooltip",
enabled: true
}, {
title: "Exit",
tooltip: "bb",
enabled: true
}]
},
debug: false,
copyDir: true
})
systray.onClick(action => {
if (action.seq_id === 0) {
console.log("Hi!");
} else if (action.seq_id === 1) {
systray.kill()
}
});
const stop = ()=>{
systray.kill(false)
};
class Example extends Component {
render() {
return (
<App onShouldQuit={stop}>
<Menu>
<Menu.Item type="Quit"/>
</Menu>
<Window onClose={stop} title="Proton Native Rocks!" size={{w: 400, h: 400}} menuBar={false}>
<Box>
<TextInput>Hi</TextInput>
</Box>
</Window>
</App>
);
}
}
render(<Example />); |
@Darkle Do you mind if I make the awesome list starting with your notes? |
@styfle Yeah sure thing. |
@styfle I also have a gist where I collected link, articles and interesting snippets of code, mainly about libuv and GUI event loops https://gist.github.com/parro-it/842ff46a86142c30b1f94f97bb738418. |
@mischnic re:
Why would you kill systray here, but not the node process? |
@Darkle because this is called when the window or app is closed, so the node process is already stopping, so the last thing we need to stop is the systray. The event loop gets stopped when you have a last Window left or the app quits through Menu. |
Ah ok. There might be some people that are expecting different behaviour though. It's fairly common for apps that have a system tray icon to remain open after you close their apps main window. When you add info to the proton-native docs about this systray module, it might be a good idea to mention this as well, in case people expect their app to stick around after the window closes because of the systray icon. |
@Darkle @parro-it I got a list started here: https://github.com/styfle/awesome-desktop-js Feel free to send a PR 👍 |
Is Tray supported or gonna be supported in future versions?
The text was updated successfully, but these errors were encountered: