-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add require_interaction option to make notification sticky. #10
Conversation
Thanks for the pull request! I'll take a look as soon as I can. In the meantime, I'm pretty certain that I heard notification sounds when I tested in Firefox. There's a link in the README to this page, which suggests you can turn them on and off in the OS X settings: |
Thank you! I saw that in the readme, but I'm using Chrome and was hoping to avoid running a second browser. It seems that the Firefox behavior is just an implementation inconsistency. |
@brenns10 Thanks again for the PR. This is a great option, and the code works for me as specified in both 2.7 and 3. How would you feel about calling the option |
Hey @mdagost! The name doesn't matter to me. I chose it to match the option |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
README.md
Outdated
```python | ||
import jupyternotify | ||
ip = get_ipython() | ||
ip.register_magics(jupyternotify.JupyterNotifyMagics(ip, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you put ip on its own line?
ip.register_magics(jupyternotify.JupyterNotifyMagics(
ip,
option_name="option_value"
))
README.md
Outdated
|
||
The following options exist: | ||
- `require_interaction` - Boolean, default False. When this is true, | ||
notifications will remain on screen untill dismissed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: untill
should be until
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, looks like this will only work in Chrome. Could you just add a note in the doc for this option to that effect?
jupyternotify/jupyternotify.py
Outdated
super(JupyterNotifyMagics, self).__init__(shell) | ||
with open(resource_filename("jupyternotify", "js/init.js")) as jsFile: | ||
jsString = jsFile.read() | ||
display(Javascript(jsString)) | ||
self.options = json.dumps({ | ||
'requireInteraction': require_interaction, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please change these single quotes to double quotes so the file is consistent?
Yep--agree. Let's leave it as require_interaction. I'm testing on Firefox at the moment but seem to have messed up my setup... |
Yeah, confirmed that this only works in Chrome at the moment. That's what the API docs suggest too. |
@parsing-science: I've made all the changes you requested! |
Except the note about Chrome. One more commit incoming! |
Thanks @brenns10 ! I'll merge this now and push a new version to PyPI. |
I have multiple monitors and don't immediately notice when a notification pops up. So, this adds the ability to make notifications "sticky", i.e. they won't go away until the user dismisses them manually. Default behavior remains the same -- the user has to manually enable this functionality. See README changes for documentation on how to enable it.
I was hoping to get notification sounds to work as well, but it appears that no browsers support it yet. Plus, I would have to figure out a place to stick a static sound file for jupyter to serve as the notification sound.