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

Feature Request: Support for native messaging to allow loading a local config file #2106

Open
minego opened this issue Apr 19, 2024 · 4 comments

Comments

@minego
Copy link

minego commented Apr 19, 2024

I would really like to switch from tridactyl to Surfingkeys, because it appears to handle some things much better, like support for regex searching is amazing.

But, I find the method of updating the configuration to be really frustrating. I'd greatly prefer to be able to simply have a local configuration file, and point surfingkeys to it.

It seems that I can do this manually, but from my testing it seems that it doesn't automatically update each time the file changes? Is that expected, or perhaps I'm doing something wrong in my testing.

An alternative that would work well for my case would be to allow configuring via a policy, so I can override the policy with my settings. This would allow me to deploy a NixOS system, with chromium and a pre-configured Surfingkeys extension. That would be amazing.

@kevb1973
Copy link

I have my settings in an external file. Here's how I set it up on NixOS.

  1. Install http-server from nixpkgs.
  2. Copy your Surfingkeys settings to surfingkeys.js.
  3. Set server to autostart on login: http-server -p 8085 -c-1 ~/dotfiles/surfingkeys/surfingkeys.js
  4. In Surfingkeys settings, add http://127.0.0.1:8085/surfingkeys.js in the "Load Settings" box, then click save.

Feel free to change the port and path in step 3 to wherever your surfingkeys.js file is located. The -c-1 part disables the cache so it always shares the current version of the file.

After that, Surfingkeys will automatically load the file from the server.

To make changes to the config:

  1. Edit the file using your text editor and save.
  2. Open Surfingkeys settings (;e) (confirm settings updated if you like)
  3. Click save to apply updated settings and close the tab.

@minego
Copy link
Author

minego commented Apr 19, 2024

I have my settings in an external file. Here's how I set it up on NixOS.

  1. Install http-server from nixpkgs.
  2. Copy your Surfingkeys settings to surfingkeys.js.
  3. Set server to autostart on login: http-server -p 8085 -c-1 ~/dotfiles/surfingkeys/surfingkeys.js
  4. In Surfingkeys settings, add http://127.0.0.1:8085/surfingkeys.js in the "Load Settings" box, then click save.

Feel free to change the port and path in step 3 to wherever your surfingkeys.js file is located. The -c-1 part disables the cache so it always shares the current version of the file.

After that, Surfingkeys will automatically load the file from the server.

To make changes to the config:

  1. Edit the file using your text editor and save.
  2. Open Surfingkeys settings (;e) (confirm settings updated if you like)
  3. Click save to apply updated settings and close the tab.

I've been playing with doing a similar setup, but I'd really love to find a way to not need to do step 4, since that is the only part that I can't automate entirely. It seems that this is a pretty difficult thing to get setup though. Most extensions don't provide an easy way to do any of this.

Is your nix configuration viewable somewhere? I'd love to see how you handled starting http-server.

One option I've been considering is to have a wrapper for firefox or chromium that copies a base profile that has my settings in it to the new profile the first time it is run. But, that doesn't handle updates very gracefully.

@kevb1973
Copy link

Unfortunately, I don't do anything fancy with nix to start the server.. I just start it in my Hyprland config on login. If I used home-manager, I'd probably configure the autostarts there.

Step 4 only needs to be done once, but if your trying the have everything setup automatically by nix during install, I can see why having to manually enter it is undesirable. From what I've read so far, declaring extension configs is difficult as they are stored in an sql database in the firefox profile. Maybe it's possible to add your firefox profile to your config and have it copy it in place during install? Probably need home-manager for that though.

Aside from that, it would be nice if Surfingkeys was able detect a change in the config and load it automatically to save opening the settings page and clicking 'save' each time.

@minego
Copy link
Author

minego commented Apr 19, 2024

Yeah, most extensions make this very difficult...

The best option I have come up with is to make wrapper for the browser that will copy my settings from somewhere in my nixstore before starting the browser... But, that is very messy. Also, that approach means that anything that could possibly include any sensitive data (like the extension for my password manager) needs to NOT be included.

I'll keep playing with it. The solution that tridactyl uses is nice, but it is messy and error prone too.

I've even considered forking some extensions, including surfingkeys, to add support for loading the settings from a browser policy. It is pretty simple for an extension to do that, but from what I've found very few extensions have implemented this.

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

No branches or pull requests

2 participants