[Greasemonkey] Re: unix users: is there an easy, cross-platform way to get the default editor?

Aaron Boodman zboogs at gmail.com
Sat Apr 16 14:09:11 EDT 2005

Actually, more generally, what should GM do when you press the edit
button in unix? In terms of command-line commands, please.

For windows, for example, this is what I'm doing (in pseudocode):

var userjs_ftype = exec("ftype .user.js");

if (userjs_ftype == null) {
  var txt_ftype = exec("ftype .txt");
  var txt_assoc = exec("assoc " + txt_ftype);
  exec("ftype .user.js = userscript");
  exec("assoc userscript = " + txt_assoc);

currentScript.launch(); // simulates double-clicking the file

If .user.js is not already registered, it registers it with the
filetype 'userscript' and the same editor that is used for .txt files.

This seems like the right behavior for unix and mac OSX users. But I'm
at a total loss as to what the right behavior for a unix users would
be. You tell me.


On 4/16/05, Aaron Boodman <zboogs at gmail.com> wrote:
> It seems to vary depending on the shell you use. And I'm not enough of
> a unix user to know if it varies additionally depending on the distro
> you use.

More information about the Greasemonkey mailing list