Skip to content
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

[feature][RFC] Add support for multiple actions #45

Open
mullender opened this issue Sep 17, 2019 · 2 comments
Open

[feature][RFC] Add support for multiple actions #45

mullender opened this issue Sep 17, 2019 · 2 comments

Comments

@mullender
Copy link

Looking for feedback on the following, I am considering creating a PR to add the capability of having multiple actions in a notification. Similar to what is described in this blog: https://blog.gaelfoppolo.com/user-notifications-in-macos-66c25ed5c692

Feature

Initially I would like to support having different actions for clicking the main content area (ContentsClicked), and clicking the action button (ActionButtonClicked). For example: clicking the main area would direct to more information, and clicking the action button would apply a change.

Ultimately it would be nice to also support the dropdown actions (AdditionalActionClicked)

Implementation

First, it is essential to keep the command line API backwards compatible.
e.g. currently clicking the main area of this notification opens example.com, but does not dismiss the notification: yo_scheduler -t "Hi" -a "http://example.com"
We do not want to break that.

main content actions

For adding an action for the main content I propose adding these command line options:

-ca, --content-action-path
-cB, --content-bash-action

if specified these would be executed when clicking the main content of the notification (and close the notification?), any actions specified for the action button would not apply to the main content in this case.
e.g.: yo_scheduler -t "Example 1" -ca "http://example.com/1" -b "example 2" -a "http://example.com/2"

Specifying -ca and -a but not -b would be an error.

additional action buttons

I think the best api for this might be to allow repeated action button flags:
yo_scheduler -t "Example 1" -ca "http://example.com/1" -b "example 2" -a "http://example.com/2" -b "example 3" -a "http://example.com/3" -b "example 4" -a "http://example.com/4" -b "example 5" -B "say 'I hope you enjoyed exampl5\!'"

@erikng
Copy link

erikng commented Sep 17, 2019

I like this idea but only concern is if an admin does this as root, there will be a potentially long tailed root process waiting for user to click the notification that might be able to be abused.

Perhaps this feature can only be scheduled as the user to limit its destruction? Only issue is if people are trying to do actions that require root, it wouldn't work.

@mullender
Copy link
Author

@erikng I am not sure I understand the concern, and how it differs from the current situation. What types of 'destruction' does this feature add, that are not already possible today?

If we schedule a notification with a dangerous bash command, that would be as bad today as it would be after this lands. Or perhaps I am not understanding it correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants