{"action":"created","issue":{"url":"https://api.github.com/repos/nwjs/nw.js/issues/5013","repository_url":"https://api.github.com/repos/nwjs/nw.js","labels_url":"https://api.github.com/repos/nwjs/nw.js/issues/5013/labels{/name}","comments_url":"https://api.github.com/repos/nwjs/nw.js/issues/5013/comments","events_url":"https://api.github.com/repos/nwjs/nw.js/issues/5013/events","html_url":"https://github.com/nwjs/nw.js/issues/5013","id":161588842,"number":5013,"title":"nw.js window.on() not registered if app started as hidden","user":{"login":"anjanapaulose","id":15088695,"avatar_url":"https://avatars.githubusercontent.com/u/15088695?v=3","gravatar_id":"","url":"https://api.github.com/users/anjanapaulose","html_url":"https://github.com/anjanapaulose","followers_url":"https://api.github.com/users/anjanapaulose/followers","following_url":"https://api.github.com/users/anjanapaulose/following{/other_user}","gists_url":"https://api.github.com/users/anjanapaulose/gists{/gist_id}","starred_url":"https://api.github.com/users/anjanapaulose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anjanapaulose/subscriptions","organizations_url":"https://api.github.com/users/anjanapaulose/orgs","repos_url":"https://api.github.com/users/anjanapaulose/repos","events_url":"https://api.github.com/users/anjanapaulose/events{/privacy}","received_events_url":"https://api.github.com/users/anjanapaulose/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"ghostoy","id":471928,"avatar_url":"https://avatars.githubusercontent.com/u/471928?v=3","gravatar_id":"","url":"https://api.github.com/users/ghostoy","html_url":"https://github.com/ghostoy","followers_url":"https://api.github.com/users/ghostoy/followers","following_url":"https://api.github.com/users/ghostoy/following{/other_user}","gists_url":"https://api.github.com/users/ghostoy/gists{/gist_id}","starred_url":"https://api.github.com/users/ghostoy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ghostoy/subscriptions","organizations_url":"https://api.github.com/users/ghostoy/orgs","repos_url":"https://api.github.com/users/ghostoy/repos","events_url":"https://api.github.com/users/ghostoy/events{/privacy}","received_events_url":"https://api.github.com/users/ghostoy/received_events","type":"User","site_admin":false},"assignees":[{"login":"ghostoy","id":471928,"avatar_url":"https://avatars.githubusercontent.com/u/471928?v=3","gravatar_id":"","url":"https://api.github.com/users/ghostoy","html_url":"https://github.com/ghostoy","followers_url":"https://api.github.com/users/ghostoy/followers","following_url":"https://api.github.com/users/ghostoy/following{/other_user}","gists_url":"https://api.github.com/users/ghostoy/gists{/gist_id}","starred_url":"https://api.github.com/users/ghostoy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ghostoy/subscriptions","organizations_url":"https://api.github.com/users/ghostoy/orgs","repos_url":"https://api.github.com/users/ghostoy/repos","events_url":"https://api.github.com/users/ghostoy/events{/privacy}","received_events_url":"https://api.github.com/users/ghostoy/received_events","type":"User","site_admin":false}],"milestone":null,"comments":14,"created_at":"2016-06-22T03:55:56Z","updated_at":"2016-07-29T04:21:32Z","closed_at":"2016-07-20T08:30:54Z","body":"I am using nw 0.14.5 version.\r\nI have to start the nw app in tray mode. I have defined the \"on\" function for \"focus\" as\r\n\r\nvar win= nw.Window.get();\r\n win.on(\"focus\", function(){\r\n win.show();\r\n });\r\n \r\n and  for tray click,\r\n \r\n  tray.on('click', function() {\r\n    win.show();\r\n    win.focus();\r\n  });\r\n \r\n Now when I click on tray, the app comes into view as normal. I also have a shortcut to this app in start menu. \r\n\r\n The issue is as follows:\r\n \r\n The app is started as tray. I clicked atleast once on tray and app has came into view atleast once. Minimize will reduce the app to tray.\r\n After this, if i try the startmenu shortcut, app comes into view as expected.\r\n \r\n But if the app is started as tray, and I have never clicked tray, which means the app has never come into view.\r\n In this case, if I try the start menu shortcut, the win.on(\"focus\") code is never getting triggered, failing the app to show up.\r\n \r\n If the app is already displayed atleast once, this issue is not seen. The window object itself is not defined unless the app is shown once.\r\n \r\n Is there any condition like the win.on(\"focus\") or such events are registered only when app is shown.\r\n Please suggest a solution to this.\r\n"},"comment":{"url":"https://api.github.com/repos/nwjs/nw.js/issues/comments/236091267","html_url":"https://github.com/nwjs/nw.js/issues/5013#issuecomment-236091267","issue_url":"https://api.github.com/repos/nwjs/nw.js/issues/5013","id":236091267,"user":{"login":"anjanapaulose","id":15088695,"avatar_url":"https://avatars.githubusercontent.com/u/15088695?v=3","gravatar_id":"","url":"https://api.github.com/users/anjanapaulose","html_url":"https://github.com/anjanapaulose","followers_url":"https://api.github.com/users/anjanapaulose/followers","following_url":"https://api.github.com/users/anjanapaulose/following{/other_user}","gists_url":"https://api.github.com/users/anjanapaulose/gists{/gist_id}","starred_url":"https://api.github.com/users/anjanapaulose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/anjanapaulose/subscriptions","organizations_url":"https://api.github.com/users/anjanapaulose/orgs","repos_url":"https://api.github.com/users/anjanapaulose/repos","events_url":"https://api.github.com/users/anjanapaulose/events{/privacy}","received_events_url":"https://api.github.com/users/anjanapaulose/received_events","type":"User","site_admin":false},"created_at":"2016-07-29T04:21:32Z","updated_at":"2016-07-29T04:21:32Z","body":"Ok, thanks for the clarification."}}
{"actor":{"display_login":"anjanapaulose"}}