📜 ⬆️ ⬇️

Configuring Opera 15 with the "file" method

Foreword


Recently a preliminary version of Opera's favorite browser has been released.
A lot of copies are broken in the comments, a lot of complaints, a lot of discontent - it makes no sense to repeat everything that has already been written.

Reading the comments, the thought was formed in my head: everything, the final. No more normal browser.
And only rare answers pepelsbey instilled a faint glimmer of hope ... "what if?". With bated breath, I decided to download Opera Next, and, after installation, was awarded - not everything is so bad! With the amendment, of course, on the alpha version.

Only one thing saddened.
Using Opera, I am very used to single-key combinations of “1” and “2” for switching tabs - so much so that without them I can’t imagine working in a browser. And in Opera 15, they are not known to work, and moreover - the shortcut keys are not customizable.
')
You can close your eyes to many things, saying to yourself that this is the alpha version, and you just need to wait, but when you are at a basic operation — switching the tab — every time you catch yourself thinking, how uncomfortable it is, you just want to close the browser and never again open.

Sadness, sadness ...

Terrain orientation


When the first shock passed, the next thought was to look - or maybe not so bad, and the keys can be customized?

Looking into the Opera directory, I saw the following:

Not much compared to the old Opera, but there is something interesting - files with the extension ".pak". Obviously, it is here that you need to look - do not sew up hot keys in the executable file!

First of all, I downloaded Chrome, and made sure that there are similar files there. Well, once there is, and there are the sources of Chromium - it means voila, show must go on!

Show must go on! (or "We take in the file")


A quick Google search led to the Chromium-dev group, where the file format was briefly described, as well as to the Google code , where there are Python modules for working with this format.
A little bit finished modules with Google Code, got the opportunity to unpack and re-pack the archive:


What does Opera have under the hood?


Having unpacked opera.pak among different files, we see the target - the file with id 38273:
{ "Keybindings": { "Settings": { "AdvancedEnabled": false }, "Basic": { "AccessKeyToggle": ["Esc+Shift"], "AddBlankTab": ["Ctrl+T"], "AddToBookmarks": ["Ctrl+Shift+D", "Ctrl+D"], "Back": ["Alt+Left","Ctrl+Left"], "Bookmarks": ["Ctrl+Shift+B", "Ctrl+B", "Ctrl+Shift+2"], "CloseActiveTab": ["Ctrl+W","Ctrl+F4"], "ClosePrivateWindow": ["Ctrl+Shift+Q"], ..... "SelectPreviouslyActiveTab": ["Ctrl+Grave"], "SelectTabToTheRight": ["Ctrl+Tab"], "SelectTabToTheLeft": ["Ctrl+Shift+Tab"], "ShowContextMenu": ["Shift+F10"], ..... 

Replace the search strings with:
  "SelectTabToTheRight": ["Ctrl+Tab", "2"], "SelectTabToTheLeft": ["Ctrl+Shift+Tab", "1"], 

We collect the file, and we enclose it back to the Opera catalog - voila, my favorite rock buttons work!

P.S


In this way, you can configure other favorite combinations, although not all the actions described in the file currently work. And in general - if you dig - then I think the browser can be changed quite strongly. There would be time and desire.

And in the end I want to wish success to the Opera Software team. I hope the new browser will be worthy.
The unpacking-packing utility, slightly modified by me, can be found on Github .
(I'm new to Python, please don't kick in bydlokod).

Thanks for attention!

Source: https://habr.com/ru/post/181770/


All Articles