Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configuration file with custom key bindings #79

Closed
petergthatsme opened this issue Nov 19, 2017 · 15 comments
Closed

configuration file with custom key bindings #79

petergthatsme opened this issue Nov 19, 2017 · 15 comments

Comments

@petergthatsme
Copy link

petergthatsme commented Nov 19, 2017

First of all, thanks for writing this extension. I'm a long time vimperator user, but clearly that chapter is over with the latest firefox.

Is there a way to have tridactyl read a config file with custom key-bindings, and options that one could specify? If so, what should it be called and where should it live?

I typically have a zoo of *rc files that i share between machines and would ideally like to have one for tridactyl as well.

i'm on linux.
thanks!

@cmcaine
Copy link
Member

cmcaine commented Nov 20, 2017

WebExtensions are not permitted to read the filesystem directly, so we don't have a config file.

Binds that you make with :bind are persistent and are synchronised across your firefox profile if you have one. For instructions on how to use it, type :help. If there aren't any comments then your version of tridactyl is too old :)

In the future, we'll probably have a config page that displays a big textarea for adding excmds, etc. When we have a nativeMessenger, users who install that (it has to be a separate install) will be able to have tridactyl read a config file from an rc file.

@ghost
Copy link

ghost commented Nov 20, 2017

What could most likely be done is an options page (which I've been working on designing to make a Pull Request), and for those who prefer a configuration file a pair of "save config" and "upload config" buttons could be present on that page.

@johnbeard
Copy link
Contributor

@hppavilion1 - That is exactly how LeechBlock (NG) does it in FF, with an export/import button and text files.

On the other hand, cVim (Chromium) appears to be able to read right out of the filesystem with a line like this in the config. That kind of functionality presumably depends on the native messenger.

let configpath = '/path/to/your/.cvimrc

@McSinyx
Copy link

McSinyx commented Nov 21, 2017

Vim-vixen has a JSON config section in the add-on's preference page but a real config file would be great, too bad WebExtensions doesn't permit that.

@violet-fish
Copy link

I would also be really happy to be able to export configs so as to share them more easily between myself and other people.

@KevCui
Copy link

KevCui commented Dec 12, 2017

I found that tridactyl configuration data is stored in an sqlite db. Here is its location on my linux machine:
<Profile folder>/firefox/<your profile>/storage-sync.sqlite

This db is unencrypted. Basically, it's possible to "export" configuration data manually from this db.

And I wrote a simple bash script to help update configurations: https://gist.github.com/KevCui/296a9fbd6d3726b65b5ebd053b2d9c9d

Meanwhile, I'm waiting for the official support of import/export configurations 😉

@bovine3dom
Copy link
Member

bovine3dom commented Dec 12, 2017

May 2019 edit: I believe storage.js has been deprecated by Mozilla - you now need to use KevCui's method which is above ^


Original message:

@krazycavin if you do set storageloc local, all the settings will be stored in the local storage, which is a plain text file: <profile folder>\Firefox\Profiles\<profile>\browser-extension-data\[email protected]\storage.js

In fact, you can just add stuff to that file anyway, and it should overwrite any sync settings (as per https://github.com/cmcaine/tridactyl/blob/c2c5d2b5ef8a485254161fd6391295fe97cbf6a4/src/config.ts#L172).

I've never actually tested any of this, however...

@KevCui
Copy link

KevCui commented Dec 12, 2017

@bovine3dom I tried set storageloc local it works pretty well. Good to know 👍

@fakedrake
Copy link

Would it be possible to read the config by opening it in an iframe file:///home/xyz/.tridactyl and reading it from there?

@bovine3dom
Copy link
Member

Sourcing configuration from a JSON file with the native messenger would be pretty trivial. Is that what you mean? Otherwise, the vim-style rc files will have to wait until #314 is reviewed.

@fakedrake
Copy link

fakedrake commented Apr 30, 2018 via email

@bovine3dom
Copy link
Member

@fakedrake sorry, your reply got buried in a sea of notifications.

My intuition is that since the browser can navigate to local files we can have read access to the file without any fancy apis (through an iframe for example) but im not sure what can go wrong...

Nope, Mozilla block access to web extensions on file URIs on purpose so that Bob's Web Emoji extension can't steal your SSH keys.

I finally got around to chopping up #314 and RC files are now in master via #514.
There are some gotchas: set and friends persist so you need to put sanitise tridactyllocal tridactylsync at the top, and comments must be on their own lines, and it's very lightly tested so almost certainly has a few bugs.

@bovine3dom
Copy link
Member

Local storage is moving away from JSON, if anyone was using it: https://blog.mozilla.org/addons/2018/08/03/new-backend-for-storage-local-api/

@dhharris
Copy link

dhharris commented Sep 3, 2019

Hey @bovine3dom, is there a way to reload the config file in Firefox after making changes?

@cmcaine
Copy link
Member

cmcaine commented Sep 3, 2019

:source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants