diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..a450114 Binary files /dev/null and b/.DS_Store differ diff --git a/context_menu_icon.png b/context_menu_icon.png index 1914264..32ee7c8 100644 Binary files a/context_menu_icon.png and b/context_menu_icon.png differ diff --git a/index.js b/index.js index 84e46ce..dc73118 100644 --- a/index.js +++ b/index.js @@ -19,7 +19,7 @@ const MODES = { WINDOW: 'Window' } -let WORDS_CHANGE_INTERVAL_IN_MS = 5000; +let WORDS_CHANGE_INTERVAL_IN_MS = 10000; let mainWindow; let tray; @@ -97,26 +97,29 @@ function createTray() { label: 'Language', submenu: createLanguageSubmenu() }, - { - label: 'Mode', - submenu: [ - { - label: 'Window', - type: 'radio', - checked: true, - click: () => { - switchMode('Window'); - } - }, - { - label: 'Menu Bar', - type: 'radio', - click: () => { - switchMode('Menu Bar'); + ...(process.platform === 'darwin' ? [ + { + label: 'Mode', + submenu: [ + { + label: 'Window', + type: 'radio', + checked: currentMode === MODES.WINDOW, + click: () => { + switchMode(MODES.WINDOW); + } + }, + { + label: 'Menu Bar', + type: 'radio', + checked: currentMode === MODES.MENU_BAR, + click: () => { + switchMode(MODES.MENU_BAR); + } } - } - ] - }, + ] + } + ] : []), { label: 'Changing speed', submenu: createWordSpeedChangingSubMenu() @@ -273,7 +276,15 @@ function displayPhrase(index) { function displayPhraseInTray(index) { try { const phrase = phrases[index]; - tray.setTitle(phrase); + if (process.platform === 'win32') { + const contextMenu = Menu.buildFromTemplate([ + { label: phrase, enabled: false }, + { label: 'Quit', click: () => app.quit() } + ]); + tray.setContextMenu(contextMenu); + } else { + tray.setTitle(phrase); + } } catch (error) { showError('Failed to display phrase in tray.', error); } @@ -344,9 +355,8 @@ app.whenReady().then(() => { app.dock.hide(); mainWindow.setVisibleOnAllWorkspaces(true, { visibleOnFullScreen: true }); mainWindow.setAlwaysOnTop(true, 'screen-saver'); - } - else{ - win.setAlwaysOnTop(true, 'screen-saver'); + } else { + mainWindow.setAlwaysOnTop(true, 'screen-saver'); } app.on('activate', function () { diff --git a/package.json b/package.json index 69eea64..0b6cca8 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "main": "index.js", "scripts": { "start": "NODE_ENV=development electron .", - "build": "sudo electron-builder" + "build": "sudo electron-builder", + "build:win": "sudo electron-builder --win" }, "build": { "appId": "com.elmanhuseynov.vocabularify", @@ -29,7 +30,15 @@ } ], "win": { - "target": "nsis", + "target": [ + { + "target": "nsis", + "arch": [ + "x64", + "ia32" + ] + } + ], "icon": "build/icon.ico" }, "mac": {