Good ways to export all keyboard hotkeys?
-
The code starting with chrome.storage sounds like a good solution -- I love text-based solutions that I can archive and transport without wading through menus. But where do I type that code? I tried the URL bar, preceded by javascript: (since that works with other code snippets I've collected here and there). But nothing happened.
-
@codairem Hello and Welcome to the Vivaldi Community
You'll need to run the code in the JS Console in the "UI Inspector". Please read this first:
https://forum.vivaldi.net/topic/16684/inspecting-the-vivaldi-ui-with-devtoolsThen you should be able to run the command under Console. The result will be a block of JSON you can then paste into your favorite JSON editor to do what you will with
Do note that this is only good for a "backup" of your keys so you won't have to remember all of them when creating a new install. It's not much good for a proper backup you can easily restore back into settings - Unfortunately... hopefully one day we will get the ability to backup and Sync hotkeys as well.
-
Hi,
Those at Preferences aren't them all?
KeyBoard Shortcuts Actions
https://forum.vivaldi.net/topic/83213/guide-internal-v-files? -
@Pathduck Thank you for the illuminating reply. In the end what worked best was to wipe out the installation of vivaldi on the new computer and copy over the .config/vivaldi directory from the old one (this is under linux). That gave me book marks and key bindings (hotkeys). To get passwords syncing worked although it took three attempts, not sure why.
-
@codairem Well, you did ask for advice how to run this command to export the hotkeys, not how to duplicate all your settings on a new system
-
You're right, Pathduck, but the answer to the first question will be useful. (As an aside, it's fantastic that you can customize vivaldi so much, but then it should be trivial to move all customizations to another host.)
-
So after trying to get the javascript to work i just gave up and regex-ed it out of the raw html.
followed this to get access to and find the right html element.
https://forum.vivaldi.net/post/655170set up hotkey to open settings and dev menu on opened settings tab
navigate to keyboard hotkey section of settings
clicked select element button in top left corner of dev menu (or you can just search for the div below)
clicked the header you use to collapse the window hotkeys
right click the div above that one
<div class="keystrokes">
for me in 2023copy > copy element
pasted it in vscode a and saved as a .html file
used vscode Format Document command palette command to break it into lines
used Find in File and these regex replacements to turn all set commands into the form
command_name: "hotkey"
find in file:
^.*"combo-command_.*>(.*?)<.*([\n].*){3,4}.*data-raw="(.*?)".*
replace with:$1: "$3"
replace allfind in file:
.*[<>]+.*[\r\n]
replace with: ``
replace allsaved to my notes system elsewhere.
vivaldi please wtf.
-
@nicksettoon Good job - but this is an old topic now. Since some versions ago hotkeys are saved in the file
Preferences
in JSON format, not in the (obscure) storage format it used to be.So since JSON is a pretty standardized format, you should be able to load that file into any good JSON editor and export the relevant section. Or simply copy that Preferences file to another install should also work (in theory at least, YMMV).
You should also be able to insert any exported section of JSON into the right part of the file with a good editor. All of this requires at least a basic knowledge of JSON - since you have VSCode I'm assuming you know some about this?
Using the jq command is also a good way to export the relevant section:
jq '.vivaldi.actions' Preferences > actions.json
This will export a JSON array intoactions.json
You can even import this directly into the file:
jq '.vivaldi.actions = input' Preferences actions.json > Preferences.tmp
It's generally a good idea to use temp files when working with
jq
but if you're REALLY brave you can do an inline replace:
jq '.vivaldi.actions = input' Preferences actions.json | sponge Preferences
Obviously none of these things should be done on a running instance of Vivaldi, make a copy of the file first.
So you might argue, if this is now much easier and in a standard JSON format - why isn't there yet proper Sync of hotkeys? Well, we don't know why they haven't implemented this yet, but it's hopefully coming Real Soon Now
-
my hero. (vivaldi team are also my heroes, despite my chagrin)
yeah json is preferable. good to know this is a feature now and that search engines or vivaldi documentation or both are still lacking.
definitely going to automate this myself and just forget about waiting for active sync. i don't like browser accounts anyway. i'd never be syncing hotkeys on an open browser, just looking to import them into the default browser 'manually' should i need to rebuild my base profile with a new schema.
-
@Pathduck I was wondering where I can find the file that you are referencing. Specifically on an OSX system.
-
@fzf
Hi, open Help > About, there is the path to your profile folder "Default", there is the file "Preferences".
As @Pathduck mention you need a Json viever/editor to work with these files.
@Pathduck
Hi, as far as I can see there is no .vivaldi.actions so thejq
command create a empty .json file.Cheers, mib
-
As far as I can tell after putting the file under source control is that the Preferences file is not updated when you update your settings at least for keyboard settings. For instance when I change the "New Window" keyboard shortcut in Vivaldi Settings I would expect the following setting in Preferences to change but it does not, do we know where the overrides are stored?
"COMMAND_NEW_WINDOW": { "shortcuts": [ "meta+n" ] },
-
@fzf Hi - it does update for me, I tried changing New Window to
Ctrl+Shift+Alt+N
and it was reflected in the file at once.Maybe there's OS differences, no idea. Maybe you'll need to close the browser before the file is unlocked to be written to, although I didn't.
-
Okay I realized my mistake, I tried to symlink to the Preferences file but it looks like whenever there is an update Vivaldi will destroy the symlink somehow instead of updating the file. You are correct the file itself does get updated. Now I have to figure out a way to automate updating that section of the Preferences file.
-
ironically the time i spent trying to find a quick way to do this task exceeds way passed the time it actually takes to do it manually
screw this
-
@elvisvan One way to do it is to keep the old profile around with sync disabled, load it in a standalone and then have the settings windows side by side to input the shortcuts. Doesnβt take long, albeit I wish there were a way to clear all keyboard shortcuts in settings.