<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[sidebar windowId]]></title><description><![CDATA[<p dir="auto">*this is continuing discussion from chromium bur report, and since it's not related exacly to chromium issue itself, I'm opening this thread... *</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forums.opera.com/uid/49654">@kroppy</a><br />
when you call<br />
<strong>chrome.windows.getCurrent</strong><br />
at very "start" of your panel script, it will fetch ID of the window that is currently focused and in which code is executed.<br />
And that is the window in which user opened sidebar.<br />
Even if user starts with multiple windows and every of those windows have opened sidebar automatically, still, there is enough time for your code in <strong>every individually sidebar</strong> records it's parent window id.<br />
Because those windows are opened one by one (in short period, but not in infinitely small moment)<br />
so...</p>
<p dir="auto">var thisWindowId;</p>
<p dir="auto">chrome.windows.getCurrent(function(win) {<br />
thisWindowId = <a href="http://win.id" target="_blank" rel="noopener noreferrer nofollow ugc">win.id</a>;<br />
chrome.windows.onFocusChanged.addListener(function(newWinID) {<br />
if (thisWindowId === newWinID)  //this sidebar instance is in focused window<br />
});<br />
});</p>
<p dir="auto">also you can use <em>thisWindowId</em> in <em>tabs.onUpdated(tab)</em>, <em>onActivated</em>.... etc....<br />
moste of them will give <strong>tab.windowId</strong> that you can compare to your <em>thisWindowId</em> and choose what to do with that tab, eg. is it in this window or not<br />
if method that you need doesn't give <strong>tab.windowId</strong>, it will surly give <em><a href="http://tab.id" target="_blank" rel="noopener noreferrer nofollow ugc">tab.id</a></em>, and from there you can find windowId</p>
]]></description><link>https://forums.opera.com/topic/11488/sidebar-windowid</link><generator>RSS for Node</generator><lastBuildDate>Tue, 11 Aug 2026 14:52:42 GMT</lastBuildDate><atom:link href="https://forums.opera.com/topic/11488.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 25 Aug 2015 15:09:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to sidebar windowId on Wed, 26 Aug 2015 19:46:30 GMT]]></title><description><![CDATA[<p dir="auto">I'm asking myself why that happens... In chrome there was no way to tell since all extensions where just in a popup (or a separate popup window), so active window was usually the current one, so maybe it's a recent fix in chromium 46, but I can't tell if that is the case. Or maybe just a bug in Opera.  <img src="https://forums.opera.com/assets/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=qqje97jok90" class="not-responsive emoji emoji-emoji-one emoji--confused_face" title=":confused:" alt="😕" /></p>
]]></description><link>https://forums.opera.com/post/83034</link><guid isPermaLink="true">https://forums.opera.com/post/83034</guid><dc:creator><![CDATA[kroppy]]></dc:creator><pubDate>Wed, 26 Aug 2015 19:46:30 GMT</pubDate></item><item><title><![CDATA[Reply to sidebar windowId on Wed, 26 Aug 2015 17:40:09 GMT]]></title><description><![CDATA[<p dir="auto">uhmmm...btw, current window is window in which code is currently executing...so not necessarily focused one...<br />
why there is different behavior between dev and stable, I'm not sure...<br />
maybe Stable is doing some more actions when switching between windows... so <strong>getCurrent</strong> is fired while some process are still hooked on stable</p>
]]></description><link>https://forums.opera.com/post/83026</link><guid isPermaLink="true">https://forums.opera.com/post/83026</guid><dc:creator><![CDATA[[[global:former_user]]]]></dc:creator><pubDate>Wed, 26 Aug 2015 17:40:09 GMT</pubDate></item><item><title><![CDATA[Reply to sidebar windowId on Wed, 26 Aug 2015 15:09:01 GMT]]></title><description><![CDATA[<p dir="auto">Opsss i copied and pasted "onFocusChanged" instead of "sidebarAction.onFocus" in my previous post. Can't edit since I went to eat, and now it's too late <img src="https://forums.opera.com/assets/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61b.png?v=qqje97jok90" class="not-responsive emoji emoji-emoji-one emoji--face_with_tongue" title=":P" alt="😛" /></p>
]]></description><link>https://forums.opera.com/post/83018</link><guid isPermaLink="true">https://forums.opera.com/post/83018</guid><dc:creator><![CDATA[kroppy]]></dc:creator><pubDate>Wed, 26 Aug 2015 15:09:01 GMT</pubDate></item><item><title><![CDATA[Reply to sidebar windowId on Wed, 26 Aug 2015 14:19:48 GMT]]></title><description><![CDATA[<p dir="auto">"onFocusChanged" don't worry I'm not using it anyway, yes it gives this same, but on click and it's not buggy, it works perfectly (at least on pc). I only pointed out that chrome.windows.getCurrent will give you different windowId in dev and stable Opera. Which I'm after. I consider it as "solved" but only in dev version, hopefully it will work when Opera 33 hits stable. <img src="https://forums.opera.com/assets/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f199.png?v=qqje97jok90" class="not-responsive emoji emoji-emoji-one emoji--up_button" title=":up:" alt="🆙" />  :happy:</p>
]]></description><link>https://forums.opera.com/post/83010</link><guid isPermaLink="true">https://forums.opera.com/post/83010</guid><dc:creator><![CDATA[kroppy]]></dc:creator><pubDate>Wed, 26 Aug 2015 14:19:48 GMT</pubDate></item><item><title><![CDATA[Reply to sidebar windowId on Wed, 26 Aug 2015 13:45:55 GMT]]></title><description><![CDATA[<p dir="auto">you don't need to use sidebarAction.onFocus<br />
it's new and probably buggy still (not ready for mac yet, from docu)<br />
when you have onFocusChanged already for windows</p>
]]></description><link>https://forums.opera.com/post/83008</link><guid isPermaLink="true">https://forums.opera.com/post/83008</guid><dc:creator><![CDATA[[[global:former_user]]]]></dc:creator><pubDate>Wed, 26 Aug 2015 13:45:55 GMT</pubDate></item><item><title><![CDATA[Reply to sidebar windowId on Wed, 26 Aug 2015 12:45:27 GMT]]></title><description><![CDATA[<p dir="auto">I did a little test with stable and all sidebars get this same windowId as active window. I have no doubt here.</p>
<p dir="auto">This seems to be fixed in dev 33 version, it looks like they finally linked current windowId with sidebar, so I'm not sure if it's worth a further investigation here, but I double checked it with opr.sidebarAction.onFocus.addListener with log inside.</p>
<p dir="auto">If you have a moment you can compare dev and stable and see the results for yourself.<br />
Paste that at the top of your sidebar's script:</p>
<p dir="auto">opr.sidebarAction.onFocus.addListener(function(window) {<br />
chrome.windows.getCurrent({populate:false}, function(current_win){<br />
console.log("You focused sidebar in window with id: "+window.id+" sidebar window id: "+current_win.id);<br />
});<br />
});</p>
<p dir="auto">In opera stable you will see that both ids are equal when focus is changed, in dev you will get correct id, where sidebar is and the one from focused window.</p>
<p dir="auto">I discovered that thanks to you, so I'm glad I checked dev, since it's been a while since I used it.<br />
:cheers:</p>
]]></description><link>https://forums.opera.com/post/83004</link><guid isPermaLink="true">https://forums.opera.com/post/83004</guid><dc:creator><![CDATA[kroppy]]></dc:creator><pubDate>Wed, 26 Aug 2015 12:45:27 GMT</pubDate></item><item><title><![CDATA[Reply to sidebar windowId on Wed, 26 Aug 2015 06:50:53 GMT]]></title><description><![CDATA[<p dir="auto">I think your problem is in alert, try using console.log (it behaves differently, not good to test these things with alert)<br />
In my first video, I'm using stable.... didn't want to break work, so for second video i used developer<br />
on my side it works fine in stable just like in dev</p>
]]></description><link>https://forums.opera.com/post/82993</link><guid isPermaLink="true">https://forums.opera.com/post/82993</guid><dc:creator><![CDATA[[[global:former_user]]]]></dc:creator><pubDate>Wed, 26 Aug 2015 06:50:53 GMT</pubDate></item><item><title><![CDATA[Reply to sidebar windowId on Wed, 26 Aug 2015 01:47:10 GMT]]></title><description><![CDATA[<p dir="auto">You made me scratch my head for hours here. But I found the problem.<br />
And it's not in my code.<br />
When I use:<br />
chrome.windows.getCurrent(function(window){alert(<a href="http://window.id" target="_blank" rel="noopener noreferrer nofollow ugc">window.id</a>);});</p>
<p dir="auto">All I get, are alerts with the same id.<br />
So I watched your video ten times, and noticed no difference between what I do.<br />
But after a while I realized that you use Opera dev!</p>
<p dir="auto">So I checked Dev 33 and baaaam!</p>
<p dir="auto">Problem f*cking solved!</p>
<p dir="auto">In opera dev 33, chrome.windows.getCurrent gives me frigging different ids !!!!!<br />
Now I know that problem is that in CURRENT STABLE version there is NO WAY to get current windowId, where the sidebar is! Check it out for yourself!<br />
The bug was just here, chrome.windows.getCurrent, returns ACTIVE windowId on startup.</p>
<p dir="auto">Cheers and thanks for your time<br />
:happy:</p>
]]></description><link>https://forums.opera.com/post/82979</link><guid isPermaLink="true">https://forums.opera.com/post/82979</guid><dc:creator><![CDATA[kroppy]]></dc:creator><pubDate>Wed, 26 Aug 2015 01:47:10 GMT</pubDate></item><item><title><![CDATA[Reply to sidebar windowId on Tue, 25 Aug 2015 21:33:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forums.opera.com/uid/49654">@kroppy</a><br />
well, let's try this way  :wizard:</p>
<p dir="auto">I don't know how you did logic in your extension, this is example from my code</p>
<p dir="auto">this is for <a href="https://www.youtube.com/watch?v=wjVLkK7IPKk&amp;feature=youtu.be" target="_blank" rel="noopener noreferrer nofollow ugc">individual opening</a></p>
<p dir="auto">...and this is when users <a href="https://www.youtube.com/watch?v=qqNXcXbRJzo" target="_blank" rel="noopener noreferrer nofollow ugc">starts with multiple windows </a></p>
<p dir="auto">every sidebar is aware of it's parent window  :smurf:</p>
]]></description><link>https://forums.opera.com/post/82967</link><guid isPermaLink="true">https://forums.opera.com/post/82967</guid><dc:creator><![CDATA[[[global:former_user]]]]></dc:creator><pubDate>Tue, 25 Aug 2015 21:33:22 GMT</pubDate></item><item><title><![CDATA[Reply to sidebar windowId on Tue, 25 Aug 2015 17:35:05 GMT]]></title><description><![CDATA[<p dir="auto">Hey there <img src="https://forums.opera.com/assets/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=qqje97jok90" class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face" title=":)" alt="🙂" /> Sorry for late response, I will be here just for a moment since I have something to do, but I will be back in few hours <img src="https://forums.opera.com/assets/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61b.png?v=qqje97jok90" class="not-responsive emoji emoji-emoji-one emoji--face_with_tongue" title=":P" alt="😛" /></p>
<p dir="auto">chrome.windows.getCurrent<br />
Yes I'm using this when sidebar opens, each sidebar gets this same windowId because this windowId is not the id where the sidebar is, it's from Chrome's API and unfortunately it's not related to sidebar's window. You can check it with my extension if you want.<br />
Open few windows with my extension, exit opera (using ctrl+Shift+x), or from menu-&gt;exit opera.<br />
Start Opera; In result you will get tabs from active window in all windows with sidebars, "cloned".</p>
<p dir="auto">Problem is here:<br />
"still, there is enough time for your code in every individually sidebar records it's parent window id."</p>
<p dir="auto">Where do I get that parent window id? There is no way to guess in which window sidebar is. It does not matter if window is active or not.<br />
onFocusChanged does not help me, correct tabs will be only in first focused window, since all sidebars do exactly the same code and all will think they are in focused window which is not true.<br />
I'm not sure if you get what I mean. There is no connection between chrome's API and sidebar's API...<br />
Only from here:<br />
opr.sidebarAction.onFocus.addListener<br />
or here<br />
opr.sidebarAction.onBlur.addListener<br />
Both are not good on Opera's start since there is no action from user.</p>
]]></description><link>https://forums.opera.com/post/82958</link><guid isPermaLink="true">https://forums.opera.com/post/82958</guid><dc:creator><![CDATA[kroppy]]></dc:creator><pubDate>Tue, 25 Aug 2015 17:35:05 GMT</pubDate></item></channel></rss>