mkiol / GNotifier

Thunderbird add-on that replaces built-in notifications with the OS native notifications
https://addons.mozilla.org/thunderbird/addon/gnotifier/
GNU General Public License v3.0
164 stars 25 forks source link

Ability to define a user command for notifications #94

Closed ralsei closed 7 years ago

ralsei commented 8 years ago

I don't use libnotify, instead I use a custom lemonbar-based notification system.

It would be nice if you could use a custom command.

mkiol commented 8 years ago

I have some doubts. Adding possibility to execute shell command could have an impact on FF security. Probably it could be an issue in the Mozilla review process... Nevertheless I want to give it a try.

Could you please give me an example how to generate lemonbar notification?

ralsei commented 8 years ago

For me I just have a command "pop" echo a message to a FIFO, which lemonbar reads and outputs; the whole script is available here.

mkiol commented 8 years ago

Please check the latest xpi 1.9.6-pre1. I've added "Notification engine" and "Custom command" options. If you like, you can pass some data to your script using %title, %text or %image strings.

ralsei commented 8 years ago

Thanks!

Edit: I just tested it, and Firefox's default notifications still show up.

My settings are the default aside from setting the engine to "Custom" and setting the custom command to "pop %text".

"pop" is in ~/bin/pop if that makes a difference, albeit it's in my PATH.

mkiol commented 8 years ago

OK, try new one - 1.9.6-pre2

I just tested it, and Firefox's default notifications still show up.

That is strange. You should not see any other notifications...

"pop" is in ~/bin/pop if that makes a difference, albeit it's in my PATH.

In the latest xpi, I've added PATH to command execution, so hopefully will work now. If it doesn't help, try to test it with following command: echo "%title">test.txt

If you set the extensions.sdk.console.logLevel to "all", and run FF from command line, you should see command's stdout and stderr.

Edit: This is handy tool to generate test notifications.

ralsei commented 8 years ago

that option doesn't exist in about:config, and I still don't get anything, even with echo "%title" > /home/arc/test.

mkiol commented 8 years ago

Sorry for not mentioning it, but you need to create this option (right click on about:config, New->string... ). When you will be able to see stdout, please try command "set". I suspect that the problem is in the environment variables.

grimpy commented 8 years ago

Just tested this myself. I use this to give firefox urgent hint with following command

wmctrl -b add,demands_attention -r firefox
mkiol commented 8 years ago

@grimpy Cool! So, you can confirm that "custom command" option works, right?

grimpy commented 8 years ago

@mkiol yes works for me TM