Martin Kadlec blogging

The Switcher - My first public Opera 15+ only extension

I decided it was about time to dig into the new APIs in Opera 15+ and build some new extension with it. I started with fully featured bookmarks extension but stopped when Opera announced they are going to implement the bookmarks themselves. So my bookmarks extension is going to end up in my half-done-not-ever-touching-again extensions folder :D

Thinking about another idea while working in my favorite program for programming Sublime Text I realized I really like the feature where you can press CTRL+P, write first few letters of a name of an opened file and press enter to open it. And because we should quite soon have a new API in Blink Opera which allows developers to map a keyboard shortcut to open extension popup I decided to make an extension that would do something similar like Sublime Text does except I will be doing it with tabs and theirs titles/urls.

The shortcut to open the pop is is CTRL+M

https://addons.opera.com/en/extensions/details/the-switcher/
Source code: https://github.com/BS-Harou/The-Switcher

Screen of Switcher extension
Enjoy and let me know what you think :)

Comments
Please login to post comments.
Avatar
30.08.2014 14:06
http://static.martinkadlec.eu/switcher.2014-08-30.nex

- Favicons in the list thanks to Lukasz Wiktor (There is an option to disable them if anyone wants to)
- More compact list (dimensions are more like in ST3 now)
- Sublime-text like scrollbar
- Fixed bug when active tab wasn't changed if you switched browser windows
- Popup loading time improved a tiny bit
Avatar
12.08.2014 11:25

Originally posted by mtaki14:

Something happened and in the latest developer build I can access the extension through the keyboard shortcut only when on the Speed Dial page. Any ideas?


Hi and thanks for the report! I can reproduce the problem in Opera 25 and I can reproduce the same problem in at least one other extension so the keyboard shortcuts seems to be broken. I will report this to Opera devs.

Edit: Turns out the bug is already reported as DNA-24471 and confirmed by Opera Devs.
Avatar
11.08.2014 22:55
Something happened and in the latest developer build I can access the extension through the keyboard shortcut only when on the Speed Dial page. Any ideas?
Avatar
09.07.2014 16:25
I have still some plans, but I guess I can update what I've got now ready :) We'll do it later today!

Edit: done, the update is waiting for review :)
Edit 2: published :)
Avatar
09.07.2014 13:50
I really like TheSwitcher.2014-06-13.1.nex. Are you going to update Add-Ons with it or are you still tweaking things?
Avatar
25.06.2014 20:34
I'm afraid it is not possible to use an extension popup without a button. I agree the performance needs to be a bit better :)
Avatar
25.06.2014 17:45
Hi, I love your extension but I have some suggestions for improvement. I would like to see the ability to use it while having the extension icon hidden. If you are using the hotkey, I find that having the icon visible takes unnecessary space without really providing anything in terms of functionality. Also I would like to see some improvement to its performance, as it starts getting noticeably slow when you have many tabs open.
Avatar
13.06.2014 17:27
http://static.martinkadlec.eu/TheSwitcher.2014-06-13.1.nex

- Option to set number of remember closed tabs
- Selected tab will be closed if you press delete
Avatar
31.05.2014 21:00
Finally new dev. build :)
http://static.martinkadlec.eu/TheSwitcher.2014-05-31.1.nex

I implemented few of the suggested improvements:
- Tabs are sorted in most recent order when search field is empty
- Last max 10 closed tabs are in the list
- Currently selected tab is not in the list
- First (the most recent) tab is automatically selected
- The list contains all tabs (from all windows)

I will appreciate any feedback :)
Avatar
11.12.2013 11:12
A further idea of my own would be if you had a second shortcut which also brought up the list but on key release activated (switched to) that tab. If you don't release and press a second time it moves one down in the list.

Suppose for example your second keyboard shortcut was Ctrl+k, if I pressed Ctrl+k and released both keys it switched to the last focussed tab. If I pressed Ctrl+k(release k)+k and then released both keys it would move back two in my most recently used history. Additionally Ctrl+Shift+k could go through the list in reverse.

This would effectively allow the list to also function as an actual tab cycler. ;)

P.S. You may wish to exclude the closed tabs in the cycling.
Avatar
11.12.2013 11:12

Originally posted by BS-Harou:

I will take all the ideas into consideration but it might take some time before I'll actually get to it and I don't want to make any promises.

More than fair.
Avatar
11.12.2013 10:12
Quick Tabs also keeps track of tabs from multiple Windows and thus allows you to switch to a tab in another Window.
Avatar
11.12.2013 10:12
I say, use whichever extension works for you best right now. I definitely won't get offended if you use extension that better suits your needs :D Also I don't think keeping Opera in mind will make much difference as I don't see many differences related to this extension right now that could cause trouble.

I will take all the ideas into consideration but it might take some time before I'll actually get to it and I don't want to make any promises.
Avatar
11.12.2013 09:12
For comparison, I have been looking at similar extensions in the Chrome extensions catalog. One I found is called Quick Tabs (direct install link). Whilst very similar to your extension it has a few extra ideas which I think are helpful.

Firstly, the author does a couple of things to make the list (prior to searching) useful right away:

1. The default list of tabs is in MRU (most recently used) order, meaning the last tabs you looked at are near the top. For me at least these are usually the ones I am most interested in. It also makes it somewhat similar to the old Presto Opera tab cycler.

2. He does not show the currently selected tab in the list, since you don't need to switch to it. ;)

3. The first entry is preselected. When combined with 1. and 2. this means pressing CTRL+M and Enter quickly switches to last selected tab (the most common tab I am trying to get back to).

Another feature is keeping track of limited number of closed tabs and displaying them faded out at the bottom of the list (as metude requested above). This means the user can search these as well and reopen them by clicking them or pressing enter if they are selected. It is also possible to close tabs from inside the extension itself (something you hinted at adding).

A nice final touch is that the extension's icon lists the number of currently open tabs, which helps give you a visual warning on if you are starting to have too many open (It also reminds me of Remco's old tab counter extension for Opera Presto).

Now, I'm unsure what the best way to proceed is. :( I would prefer use an extension maintained by you since you are a long term Opera fan and contributor and hence I know that during development you will keep Opera in mind. That said, his version better suits my current needs. So my question is, would you consider some/any of his ideas in your version? He has an open license so you could even look at his code and perhaps use some of it directly (assuming that is feasible). Or in reverse you could work with him (assuming he is open to this) and add anything that you feel that you do better.

P.S. His version is not without issues. Some of the keyboard shortcuts he defines within the extension do not work on Mac.
Avatar
10.12.2013 12:12
Thanks!!!!
Avatar
10.12.2013 12:12

Originally posted by BS-Harou:

I haven't actually tried hiding the button and using CTRL+M, but if it doesn't work I'm afraid it is not possible :(



I would have guessed it would be possible as I am also using Recent Tabs and hide its button and it is still able to show its tab cycler UI.

Then again I have not really looked into this topic in any detail.
Avatar
10.12.2013 11:12

Originally posted by ruario:

Perhaps have Esc close the switcher window?

https://files.myopera.com/BS-Harou/files/switcher.2013-12-10.1.nex

I'm uploading it to addons catalog now.
The escape key will close the windows unless you did search with zero results. In that case, pressing esc will clear the input box first.
Avatar
10.12.2013 10:12
Perhaps have Esc close the switcher window?
Avatar
29.11.2013 11:11
Thank you Ruarí :)
Avatar
29.11.2013 09:11
One of my favourite features in older (Presto) Opera was the ability to use the panel to locate and switch to tabs based on title search. Thanks for restoring this functionality!

P.S. "Martin Kadlec is cool" ;)
Avatar
29.11.2013 09:11

Originally posted by BS-Harou:

Yeah, I was thinking about adding some more features like closing tabs with delete key and searching in content of the tabs (though the second idea would be a bit complicated for performance reasons).



It might help with performance to limit to searching the first few hundred (or thousand) characters of the page. This is what Stash searching does.
Avatar
02.09.2013 18:09

Originally posted by alf5000:

could you make it work even when the extension-button is hidden? (I'm a keyboard guy)


And this extension is meant for keyboard guys :D I haven't actually tried hiding the button and using CTRL+M, but if it doesn't work I'm afraid it is not possible :(
Avatar
02.09.2013 17:09
very good extension!

could you make it work even when the extension-button is hidden? (I'm a keyboard guy)
Avatar
02.09.2013 15:09

Originally posted by mubaidr:

Both Omni bar API and Commands API works fine in Opera Devs should update Opera Extension documentations.


Last time I checked, it works in O17 when the extension is installed from *.nex file, but not when it is installed from unpacked directory.
Avatar
02.09.2013 15:09

Originally posted by BS-Harou:

Last time I checked, it works in O17 when the extension is installed from *.nex file, but not when it is installed from unpacked directory.



Commands API works for sure :cheers:(when it is installed from unpacked directory), can't say anything on Omni Bar API.
Avatar
02.09.2013 14:09
Very nice extension! :)

Originally posted by BS-Harou:

btw, I ported it for Chrome where it works already with the shortcut. As both CTRL+P and CTRL+SHIFT+P are taken in Chrome I used CTRL+M instead:



Both Omni bar API and Commands API works fine in Opera :up: Devs should update Opera Extension documentations.

(BTW I have tested both myself, I am using commands API in my extension and a bookmark extension from Chrome store that uses omni bar API worked fine for me, though I don't remember its name)
Avatar
02.09.2013 12:09
Thanks.
Avatar
02.09.2013 11:09

Originally posted by ZAHEK:

-I think it would be better if it remembers last 10/15 pages instead 5

I'd like to make this configurable in options page.

Originally posted by ZAHEK:

Or should it be possible to search in bookmarks or speed dials

I think when you start typing into addressbar bar you get already all the history/speeddial results. I'd like to keep my extension related only to tabs. One of the reasons is also performance, because the Damerau–Levenshtein is quite expensive operation.

Originally posted by ZAHEK:

Is it possible to open popup in the middle of top ,below adress bar, instead under button?

I'm afraid this is not possible :(
Avatar
02.09.2013 10:09
Thanks for extension Martin. It works very nice. Now I checked it and gave me some idea :)

-I think it would be better if it remembers last 10/15 pages instead 5 :) Even , it is pretty good if it sources tabs from history of course if possible.
Becouse if we open 10-20 pages yes it is so usefull but pls think that Opera is open but no any open tab. Afterthat we are pusching Ctrl+M and start to type, all regarding websites coming us :)
It would be awesome.

Or should it be possible to search in bookmarks or speed dials :)

- Is it possible to open popup in the middle of top ,below adress bar, instead under button?
Avatar
30.08.2013 11:08
that is nice idea. noted ;)
Avatar
30.08.2013 10:08
Releasd: https://addons.opera.com/tr/extensions/details/the-switcher/?display=en#feedback-container

Thanks.

How about adding latest 5 closed tabs in the list and if it's selected opening it in new tab?
Avatar
30.07.2013 14:07
maybe worth waiting for the omnibar API?
Avatar
29.07.2013 19:07
btw, I ported it for Chrome where it works already with the shortcut. As both CTRL+P and CTRL+SHIFT+P are taken in Chrome I used CTRL+M instead:

https://files.myopera.com/BS-Harou/files/The%20Switcher.crx
Avatar
29.07.2013 18:07

Originally posted by cvm:

Rozsirenie mi pripomina Blitz Full Screen URL Launcher z Google Chrome


Ono se těžko bude hledat něco, co už pro Chrome neexistuje, ale dovolím si říct, že pro přepínání tabů funguje moje rozšíření mnohem lépe. Blitz nijak nefiltruje a nejde používat šipky nahoru a dolu pro vyběr tabu. Nehledě na to, že je ošklivější :) (I když teda já jsem vzhled zkopíroval ze Sublimu tak se nemam moc čim chlubit)
Avatar
29.07.2013 17:07
Rozsirenie mi pripomina Blitz Full Screen URL Launcher z Google Chrome, ale tam namiesto hladania sa zobrazovala editovatelna URL adresa. :whistle:
https://chrome.google.com/webstore/detail/blitz-full-screen-url-lau/eaemaefgnoddejclbjbkdjhnejojlnda
Avatar
29.07.2013 13:07
Interesting idea.If keyboard shortcut works , can be nice. It is just for search on tabs? Right?
Avatar
29.07.2013 13:07
Today I found an extension to manage extensions in Chrome store :) It is also nice and works with Opera.
https://chrome.google.com/webstore/detail/extensions-manager-aka-sw/lpleipinonnoibneeejgjnoeekmbopbc?hl=en
Avatar
29.07.2013 13:07

Originally posted by ZAHEK:

It is just for search on tabs? Right?


Yeah, I was thinking about adding some more features like closing tabs with delete key and searching in content of the tabs (though the second idea would be a bit complicated for performance reasons).