📜 ⬆️ ⬇️

Why I could not switch from Firefox to Chrome and how I managed to do it

For some reason, I really wanted to switch to Google Chrome from my beloved Firefox, I wanted it unbearably, but it didn't work out. Just below - why he could not and how he could.

tl; dr: I lacked only two plugins
here are the links one , two



So it happened that Maxton was my first real browser. I was very fond of makston, makston, the very old one, on the i6 engine, still arouses positive emotions in me. It was the fault of the maxton that I was addicted to the possibility of hiding and showing a hotkey browser, sometimes called the boss-key, but I didn’t need to hide from anyone, just the browser was always the most used application for me, and it is incredibly convenient when you can quickly switch from the active application to the browser and back.

At the moment when life forced to leave the Maxton, this was originally the impetus for choosing Firefox instead of Chrome. Firestone has a great plugin for this, and chrome unfortunately not. Neither searching nor digging in manuals helped me find a way to do this.
')
I got used to firelis, he fell in love with me, for a long time we were close friends, and now it is more convenient for me to do some things in it. And it was he who hoisted me on the pinned tabs and how they are famously highlighted when something happened in them.



The reasons why I could not switch to Chrome, suddenly became twice as large. Chrome shows notifikatshku, but it is so imperceptible that people who use chrome for years did not even know that it exists. And you can not change, and people mourn this event on the network.

However, colleagues boasted all the time how cool it is in chrome, how wonderful it is, how he knows how a typing script and how different IDEs love him, I also wanted it, I am envious, but my two bad habits did not allow me to do this, because I pretended i don't need this your chrome. One fine moment, I realized that it was not me, I could not live like this anymore, I gathered my will into a fist, and began to read manuals, code samples and other delights of modern Internet. I started with something more important for me - toggla on hotkiyu (SPIK English, EU?).

I must admit that I had already googled this problem before, and earlier I could not find how to do it, but this time I was lucky. Somehow, I came across a plugin that added a “Keyboard Shortcuts” link to my chrome extensions page, which, miraculously, had the option to be global. And even almost always worked. Not all keys can be tied up (for example, my favorite alt + `was impossible, but alt + q is tolerable), but it was possible! The github in the mouth - found how, it turns out, for this purpose it is necessary to prescribe in the manifesto something like the following:

"commands": { "togglemeister-toggle": { "suggested_key": { "default": "Alt+Q", "mac": "Command+Shift+Q", "linux": "Alt+Q" }, "description": "Toggle Chrome Visibility", "global": true } } 

This is a miracle, not only does it add the ability to assign a command to a hotkey, so it also makes it possible to make it global.

Then we just have to catch this code in background.js, if the window is in focus, then hide the chrome, and if not, put in focus.

 chrome.commands.onCommand.addListener(function (command) { if (command === 'togglemeister-toggle') { chrome.windows.getCurrent({}, function (win) { if (!win.focused) { chrome.windows.getCurrent({}, function (win) { chrome.windows.update(win.id, {focused: true}, function () { }); }); } else { chrome.windows.getCurrent({}, function (win) { chrome.windows.update(win.id, {state: 'minimized'}, function () { }); }); } }); } }); 

We add icons, locales, and in production.

Hooray, one problem less, now I can switch to chrome. And it did, but here is the second problem with the fact that I did not see when I received a message in the gazebo with frivolous women, or a letter or maybe new articles appeared on the habr, as reported by the rss-reader in a beautiful illuminator.

Again, the Internet in the teeth, how to highlight the tab with updates. The search quickly brought me to despair and a dead end. Everything is gone, it is impossible to paint a tab, the notification cannot be changed, we make a coffin for the idea and get used not to be distracted at work on the RCC. And at the moment of despair it occurred to me that it was possible to replace the favicon. The exit is bad, but still the exit.
The code turned out to be hellish, but it worked, several suspensions on updates, and (oh my goodness what I did), by timeout, go through all the tabs once a second in order to check whether the tab header was updated or not.
If there is an update - a matter of technology, we take the current favicon, impose a dot kindly provided by a colleague, replace it, ignore this update so as not to go into the abyss of endless cycles, voila.



Well, a bunch of other things for updates. Not as cool as in ff, but better than nothing.

Once again, a reference to the chromostor, well, than the comic:
Togglemeister: https://chrome.google.com/webstore/detail/togglemeister-chrome-hotk/bodbpghclmdhnfijfjbgodgibdooljnl
Twinkledot: https://chrome.google.com/webstore/detail/twinkledot-tab-notifier/oabcnplfjbnkdpaihdoaapmficokiphh

And, of course, references to the githab:
github.com/enterdev/togglemeister-chrome
github.com/enterdev/twinkledot-chrome

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


All Articles