Backup Search Engines
-
@luetage Not sure if I understood you correctly, but here's a snap of the console after starting up Vivaldi, then inspecting the speed dial:
I'm not running any other mods. I have no idea why the first three .js's are missing and if they are needed in the first place. The browser.html error looks odd.
-
@maze These errors are normal, everyone sees them. Are you trying to view search engines in the “Display All” category. If so, go instead to the “Search” section directly and click once at bottom on an empty part of the page. The additional buttons should load then.
-
@luetage I think got it! Sorry if this was said before and I skipped it accidentally, but the buttons only appear when using the site vivaldi://settings/search/ directly, then clicking some empty part.
The mistake was, I was entering the settings via ctrl+F12. I'm a fan of shortcuts.
But the pop-up settings doesn't seem to work with this.Thank you!
-
@maze Yeah, if you visit search settings directly, the mod has no chance to trigger. I might rework that. Honestly, I thought that both search and theme syncing would have been integrated native at this point and that’s why I haven’t really tried to improve on it over the last months. Seems like this isn’t going to be the case in the near future.
-
@luetage Okay, no problem.
Now that I figured that out I'm just happy it works now.
Cheers!
-
If you are not using the settings page as a tab, this mod will need to be added to the
window.html
(same as the theme import/export one) instead. You will find it in the same location asbrowser.html
-
I reworked this mod, updated original post. Will only work with settings in a tab and by directly visiting
vivaldi://settings/search
. The overviewvivaldi://settings/all
won't trigger the mod. -
@maze The new mod should theoretically work with your shortcut directly, try it out.
edit: oh, you opened the popup with the shortcut, that will not work. What works is generating a bookmark forvivaldi://settings/search
and opening that in a tab. -
@sjudenim I tried that by adding the script to the body of window.html, but it didn't work on the settings pop-up.
-
@luetage Thanks, when I open the settings via vivaldi://settings/search/ the buttons are already there, no need to click anywhere anymore. Nice!
-
It used to work, but it seems that it no longer does with the update from yesterday.
-
@sjudenim Yeah, as mentioned in the original post, you gotta use a tab for the new version. The reason is that the chrome api in use doesn’t trigger on popup windows. The old version will continue to work in the popup with your trick of applying it to window, because it checks for elements on click. There is the possibility to make it work both in tabs and windows and also in
settings/all
, but that would require additional independent checks and likely the use of language specific attributes. It’s far less overhead with the restrictions in place—and backups or restoring isn’t usually done on a daily basis, so I figured users can just switch to the tab version for the backup, while otherwise using the popup. -
@luetage as long as Vivaldi doesn't get this implemented as a built-in feature, the workaround is okay, as long as we know how to use it.
A bit OT: I always wondered why Vivaldi has no proper backup function, would be a major pro for Vivaldi if you could just click and backup/restore all of the customizations we've made. Sometimes I'm starting from scratch to get rid of some orphaned stuff that accumulates over time, and a backup of just what I customized would come in very handy then. Now it's a PITA to set it up all again. On several machines Win/Lin it takes some time to get it all back like I want it to be.
So, thanks for your scripts! Makes things a tad easier for me.
-
@maze Yeah, I wished Vivaldi would do it all native and automatic, including our modifications. While CSS can be enabled with an experiment nowadays, the file doesn’t sync to other devices/new installs, just like many other inbuilt settings and adjustments, like startpage background and dials, patterns, &c. All of it is being saved outside the profile. Javascript mods are an afterthought and I doubt they will ever find proper support from the team. Syncing themes and engines is a different story, these are preferences within Vivaldi and could be synced with just a few lines of code. It puzzles me why this hasn’t happened yet.
-
Is there any way to do this without directly modifying the browser.html?
I'm on NixOS and the application files are all read-only, inside the system's /nix store directory, for security/that's just how nixos works. I know there are ways to modify the installation so I can inject changes in that file & drop in the custom.js or whatever, but I'd much rather just use something local, inside ~/.config/vivaldi/Default or similar.
I saw this thread, and tried just renaming custom.js to
.user.js
and dragging it into the vivaldi://extensions/ window, and it did apparently install as a custom extension. But it doesn't seem to do anything at all when I directly visit vivaldi://settings/search; confirmed by watching the console in Devtools and reloading the page.I'd welcome even a temporary, ugly hack, as long as it meant I could still grab a plaintext backup of the search engines in some form, and without all the permissions needed to modify the actual application files. Even if it required some hellish setup that broke everything temporarily and took 10 minutes to configure, I'd be fine with that as I'd just want to back up search engines one single time before hopping to a new OS (re)installation. I even tried looking in the .log files where vivaldi actually does encode the search engines' data, but WOW HOLY CRAP what an absolute clusterf**k, I've never seen any data storage structure as ridiculously and unnecessarily complicated as those things. It looks like it keeps the full history of all the changes you make to your search engines forever, in a pure, 100% disorganized, totally minified/non-pretty-printed, chronological mass of sprawling JSON replete with arcane unicode characters and... what the actual f**k. Because of the extra non-ascii chars, it technically gets read by Linux as a binary file so I couldn't even reliably use jq with it to try & restore some order to the formatting.
-
@jdally987 You can just run the code from the browser devtools console…
Or just take&modify the necessary part to get the backup directly, w/o even having to go to settings & clicking a button:
chrome.storage.local.get({'SEARCH_ENGINE_COLLECTION': ''}, function(back) { const engines = back.SEARCH_ENGINE_COLLECTION; const engineCode = JSON.stringify(engines); console.log(engineCode); })
-
@potmeklecbohdan Oh sweet, thanks, I figured there was some way as simple as that.
When I run the snippet you posted though I get this:
Uncaught TypeError: Cannot read property 'local' of undefined at <anonymous>:1:16 (anonymous) @ VM78:1
And if I stick the whole contents of the custom.js (.user.js) in the console:
Uncaught TypeError: Cannot read property 'onUpdated' of undefined at <anonymous>:94:17
EDIT: nevermind! I hadn't bothered going to the settings/search page like you said. If I open up devtools after going into the settings page and THEN running the code, it works great. Thanks! That's freakin awesome. This has been such a headache for me for a while now and it was so easy..
-
@jdally987 Your problem was that you didn’t open the devtools for the user interface, but regular devtools ☛ https://forum.vivaldi.net/topic/16684/inspecting-the-vivaldi-ui-with-devtools/
And yeah, the mod is just a fancy way of running the command directly in the console. Messing with the chromium storage directly can seriously mess up your data should you make a mistake. I know that because at one point I deleted all my themes this way. Not tragic if you make regular backups, which you should.
You could try and install Vivaldi into your home folder, which will allow you to edit its contents, should you want to do any other javascript modifications to the UI, which can’t be done from the devtools. CSS mods can be installed native these days, so they pose no problems for you currently. -
-
I wanted to mention that the search engines backup, when stored as note, can potentially slow down quick commands input to a crawl. It’s a massive amount of text, especially if you have removed and added a lot of entries. Last I checked my backup had over 120k characters. This happens because removed engines are kept in storage by Vivaldi. If you are careful, you can edit the backup yourself and delete removed engines. Alternatively you can store it outside of Vivaldi, or deactivate the notes search type in
vivaldi://settings/qc/
.