jlebon / textern

A Firefox add-on for editing text in your favourite external editor!
GNU General Public License v3.0
138 stars 21 forks source link

feature request: ability to turn off notifications, or use dialog instead #65

Open archenemies opened 4 years ago

archenemies commented 4 years ago

Textern is the only program I use that displays notifications, and this only happens when it needs to tell me that the text is already being edited.

  1. I would prefer to be able to turn this feature off. By default, Firefox shows the notification as a box that I have to use the mouse to close. However, one of the main reasons that I use Textern is so that I don't have to use the mouse when editing text.

  2. Alternatively, Firefox has a way to show dialog boxes instead of notifications. This is how it usually communicates to me, for example if it asking me which printer I want to use, or where a file should be saved, then a dialog box is used. Dialogs are also used for most error messages. It is somewhat odd for Textern to use notifications for error messages. What is accomplished by doing this?

  3. I think the best would be, if an editor is already open, for Textern to just focus it. But this would be technically difficult since it requires Textern to know the identity of the editor window.

I recommend solution number 2.

archenemies commented 4 years ago

I tried changing webex/background.js and webex/content.js, replacing the following text in notifyError(error):

browser.notifications.create({
    type: "basic",
    title: "Textern",
    message: "Error: " + error + "."
});

with:

window.alert("Error: " + error + ".");

This works with some messages, like "Error: no text field selected." - I get an alert rather than a notification. However, when I try to edit a textarea twice, which is how I usually end up with an annoying notification, I don't get an alert, but the browser console is opened instead. Maybe background.js lacks a window variable? Anyway, I'm stuck here, but this is essentially the change that I would recommend.

To test my changes to Textern, I had to learn about firefox-developer-edition and xpinstall.signatures.required=false.