-
-
Notifications
You must be signed in to change notification settings - Fork 262
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
external_script: notifications #1585
external_script: notifications #1585
Conversation
button = event["button"] | ||
if button != self.button_refresh: | ||
self.py3.notify_user(self.output) | ||
self.py3.prevent_refresh() |
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.
One problem I see with this simple approach is that if a user added a custom on_click 1
handler, this will now execute both their handler and show notification. Maybe worth adding a flag show_click_notifications
, or instead of button_refresh
implement button_show_notification
(so condition changes to if button == self.button_show_notification
). Thoughts?
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.
This is already the case with all click enabled modules and is the expected behavior. I'd do nothing here.
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.
I already changed to button_show_notification
, it's disabled by default so won't suddenly conflict with custom on_click 1
handlers. I think we are good here.
button = event["button"] | ||
if button != self.button_refresh: | ||
self.py3.notify_user(self.output) | ||
self.py3.prevent_refresh() |
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.
This is already the case with all click enabled modules and is the expected behavior. I'd do nothing here.
py3status/modules/external_script.py
Outdated
@@ -21,6 +23,7 @@ | |||
(default False) | |||
|
|||
Format placeholders: | |||
{line} number of lines in the output |
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.
what about plural lines
instead? should more logical to me
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.
Well, to me too, I was following earlier comment 🙂 Changed back to lines
now.
Good enough and respects default behavior. This is in! Thanks |
In light of new Zen #1582, I'm submitting a simple implementation for the pattern I use with
external_script
. In my mind is good enough until we come up with some sophisticated support for notifications in core. This replaces #1439.Before:
After:
button_refresh
, i.e. left click shows notification and doesn't trigger refreshline
format placeholder to show the total number of lines in the output (could rename if you want,line
was proposed in external_script: show notification with full output on click, refresh only on button_refresh #1439).Why:
I use
external_script
with the same pattern for different purposes. Don't expect you to understand what exactly they are doing, just showing you a repeating pattern for which I'm implementing this PR.Examples of why I need this for
external_script
Check updates for official packages:
official updates: 3
(this is why I needline
placeholder)button_refresh
, but I want to refresh on middle clickCheck updates for unofficial packages:
unofficial updates: 3
Check updates for VCS packages:
VCS updates: 3
Check which packages need to be rebuild because of updated dependencies:
packages to rebuild: 3
Check which configs need to be updated because of updated packages:
configs to update: 3