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

Tray and window management #54

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

MaverickMartyn
Copy link
Contributor

Exactly what the title says.
Adds the tray support requested in issue #27 as well as some relevant window management.
The app can now run entirely in the tray, getting it out of the way when not actively in use.
Semi dependent on PR #53, as the tray icon will not work in builds, due to the bug fixed by that PR.

@MaverickMartyn
Copy link
Contributor Author

The latest addition, may or may not require some additional testing to ensure that the functionality is robust enough, but it seems to be working just fine.

module.exports = function createTrayMenu (hideAllWindowsCallback, showAllWindowsCallback) {
let tray = null
app.whenReady().then(() => {
tray = new Tray(path.join(__dirname, '..', 'build','icon.png'))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in macos tray icon don't fit to panel and has 100% size

image

can you resize icon to 20x20 (and 40x40 for @2) and use it in tray instance?
https://www.electronjs.org/docs/api/native-image#high-resolution-image

document.title = "Google Keep - "
+ document.querySelector('div.gb_sb').textContent
+ " - "
+ document.querySelector(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

app will crash if this selector becomes empty

})
}

app.on('window-all-closed', e => e.preventDefault())
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how i can close the app? cmd+q closes only window the same way as quit button in tray menu

const lastWindowState = config.get('lastWindowState')
module.exports = {
createMainWindow: function (handleResize, handleClose, handleClosed) {
return module.exports.createMainWindowWithUrl(handleResize, handleClose, handleClosed, 'https://keep.google.com')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please declare all functions at the top of this module and export them at the end together. to prevent call module.exports.createMainWindowWithUrl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants