-
Notifications
You must be signed in to change notification settings - Fork 60
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
[Enhancement Request] Expand --command
Parameter Functionality in yad
Notifications
#275
Comments
Please note that I have also tried the following: export PIPE=$(mktemp -u --tmpdir "${0##*/}".XXXXXXXX)
mkfifo "$PIPE"
yad --notification \
--listen \
--no-middle \
--text="WinApps Launcher" \
--image="AppIcon.svg" \
--command="bash -c '\
menu_entries=\"menu:\$(generate_menu_entries)\"; \
exec 3<> \$PIPE; \
echo \"\$menu_entries\" >&3; \
echo \"action:\"menu\"\" >&3'" <&3 Where function generate_menu_entries() {
echo "Resume!bash -c resume_windows!${ICONS_PATH}/Resume.svg|\
Hibernate!bash -c hibernate_windows!${ICONS_PATH}/Hibernate.svg"
}
export -f generate_menu_entries Unfortunately, this approach causes the menu to update but does not display the menu the first time the user left-clicks the icon. Additionally, all subsequent left-clicks open the menu without updating the menu entries beforehand. This is because |
I would like to propose a solution to extend the functionality of Key advantages of this approach include:
Example: yad --notification \
--listen \
--no-middle \
--text="Example YAD Notification" \
--image="Example.svg" \
--menu='Option 1!bash -c fnOption1!Option1.svg|Option 2!bash -c fnOption2!Option2|Option 3!bash -c fnOption3!Option3' \
--command="bash -c 'fnExample1'"
--command="menu"
--command="bash -c 'fnExample2'" <&3 |
Thank you for your continued development of this amazing package!
I am currently working on a simple application that uses a
yad
notification. As discussed in this issue, I am trying to programmatically update theyad
notification menu entries (options) immediately before displaying the menu to the user following a left-click on theyad
notification icon. I understand that the code to be executed when the user left-clicks theyad
notification icon can be specified using the--command
argument.According to the relevant
yad
documentation:I have tried various combinations of commands to execute an initial command (e.g.,
--command="bash -c 'generate_menu_entries' && menu"
), but these attempts have been unsuccessful.The current bash code I am using to generate the
yad
notification is as follows:The actual menu entries are determined at runtime, and are communicated to the
yad
notification using a pipe (e.g.,echo "menu:Resume!bash -c resume_windows!${ICONS_PATH}/Resume.svg" >&3
).Upon reviewing the
yad
source code, particularly lines 155 to 172 ofsrc/notification.c
, it seems that thepopup_menu_cb
function can only be executed if--command
exactly specifies "menu" (via a case-insensitive string comparison).It would be extremely helpful if the functionality of the
--command
parameter could be expanded to allow expressions such as--command="bash -c 'update_yad_notification_menu' && menu"
(or similar syntax to achieve the desired effect). This would enable running additional functions before and/or after requesting the notification menu to be displayed.Thank you!
The text was updated successfully, but these errors were encountered: