Edit cli snap files using host $EDITOR safely

I would like to snap some cli applications which use $EDITOR to allow the user to modify files.

Now, while can be possible to just embed a simple editor in the snap and override $EDITOR, is there any nice way to make possible to edit a file using the host editor using a portal-like method?

Using xdg-open isn’t an option because:

  1. may be bound to a graphical application
  2. it’s normally returning earlier so the calling app may consider the editing done earlier.

We likely need snapd interfaces for this first, so moving to snapd to discuss alternatives there.

1 Like