Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to sync locally hosted Greasemonkey scripts across multiple machines?

I wish to have access to my Greasemonkey scripts across all machines I use. I already enabled the 'Enable Firefox Sync for User Scripts' setting on Greasemonkey's settings dialog, but then I read that it only syncs externally hosted scripts.

Then I attempted to set up synching with the following method:

  1. I moved Greasemonkey's 'gm_scripts' folder (located in %appdata%\Mozilla\Firefox\Profiles\<profile name>) to a OneDrive folder.
  2. I created a symlink in the original place pointing to the OneDrive folder mentioned above: mklink /D gm_scripts "%userprofile%\SkyDrive\App Profile Synching\GreaseMonkey\gm_scripts"
  3. I set up the same symlink on another machine, and checked that the symlink works.

As a result, my scripts continue to show up fine in the original machine. But they don't show up at all on the second machine. This seems to indicate that Greasemonkey have some script list in another location.

How can I solve this issue, or what other methods are available to implement the syncing of my own Greasemonkey scripts across multiple machines?

like image 712
Leaky Avatar asked Feb 17 '15 10:02

Leaky


People also ask

Where are Greasemonkey scripts stored?

They're stored in an IndexedDB ( https://github.com/greasemonkey/greasemonkey/blob/master/src/bg/user-script-registry.js#L287 ) which is a format with very little (AFAIK?) tooling. (Because there's very few options for persistence for a WebExtension.)

Is Tampermonkey the same as Greasemonkey?

Tampermonkey is used to run so-called userscripts (sometimes also called Greasemonkey scripts) on websites. Userscripts are small computer programs that change the layout of a page, add or remove new functionality and content, or automate actions.

How do I check my Greasemonkey scripts?

To access Greasemonkey's management pane, click on the downward arrow on the right side of the button Greasemonkey to the right of your URL bar and select Manage User Scripts. This opens a tab with a list of your scripts.

What language does Greasemonkey use?

Technical details. Greasemonkey user scripts are written in JavaScript and manipulate the contents of a web page using the Document Object Model interface.


1 Answers

Just to follow up: The original method presented in the question ended up working perfectly fine, after explicitly setting up the 'gm_scripts' folder as 'available offline'. I am now using this method for approximately a month, and the edited scripts are syncing quickly, without any hiccups, between two machines.

So, my initial suspicion of Greasemonkey storing some configuration data in another place proved to be false (or it is irrelevant for the purpose of syncing).

Consequently: If anyone is looking for a syncing method of their own, locally hosted userscripts (which, AFAIK, are not supported in Greasemonkey's Firefox profile syncing feature):

  • Moving the 'gm_scripts' folder to a cloud storage folder, and setting up symlinks in the original place is a working solution.

Important: The only scenario tested and found working in this Q/A is when the 'gm_scripts' folder only contains locally stored userscripts, and Greasemonkey's Firefox profile syncing feature is turned off. I have not tested what happens if the 'gm_scripts' folder contains both locally stored userscripts and copies of externally hosted userscripts.

like image 156
Leaky Avatar answered Sep 20 '22 14:09

Leaky