Open minego opened 4 months ago
I have my settings in an external file. Here's how I set it up on NixOS.
http-server
from nixpkgs.surfingkeys.js
.http-server -p 8085 -c-1 ~/dotfiles/surfingkeys/surfingkeys.js
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:
I have my settings in an external file. Here's how I set it up on NixOS.
- Install
http-server
from nixpkgs.- Copy your Surfingkeys settings to
surfingkeys.js
.- Set server to autostart on login:
http-server -p 8085 -c-1 ~/dotfiles/surfingkeys/surfingkeys.js
- 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:
- Edit the file using your text editor and save.
- Open Surfingkeys settings (;e) (confirm settings updated if you like)
- 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.
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.
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.
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.