gpt4 book ai didi

macos - 单击 growl 通知启动应用程序

转载 作者:行者123 更新时间:2023-11-29 09:14:18 25 4
gpt4 key购买 nike

使用 bash/shell 脚本,当登录尝试失败时,我有 growlnotify 告诉我,并在 growl 通知中显示坐在电脑前的人的照片。有什么方法可以在点击通知时使用 growlnotify 启动预览来显示图片吗?

最佳答案

您可以做的一件事是将 --url 选项传递给 growlnotify

拿起Vaz的例子:

(
# load some cat pics... I promise they are actually cat pics but
# I don't promise they won't go link-dead since I linked to google image caches
# or something.
img1=/tmp/catpic1; curl -L bit.ly/16IRub3 > $img1
img2=/tmp/catpic2; curl -L bit.ly/XUCzHW > $img2

# schedule growls... replace this of course with whatever
# actually sends your growls
for i in $img1 $img2; do
( growlnotify -s -m "oh noes $i" --image $i --url "file://ABSOLUTE_PATH/$i" ) &
sleep 4
done
)

请注意,我从参数中删除了 -w 以及随后的 open 命令。由于我们使用的是 --url,因此 growlnotify 会自行处理回调。您不需要暂停执行,此方法可能会解决 Vaz 为多个通知公开的问题。通过将 file://... 字符串传递给 --urlgrowlnotify 在单击后在系统的默认应用程序中打开引用的文件通知。

最后一个陷阱:--url 只有在您传递以 http:// 开头的字符串时才能正确处理 url。 “google.com”或“www.google.com”将不起作用。您的文件系统结构也是如此,您必须提供类似 file:///Users/you/Pictures/cats.jpg 的内容。

此功能从 1.4 版开始可用,但根据我的检查,man 中缺少此功能。

资料来源: https://code.google.com/p/growl/issues/detail?id=341 https://groups.google.com/d/msg/growldiscuss/nUdYxOevkxI/oYjxdhSEi98J

希望对您有所帮助!

关于macos - 单击 growl 通知启动应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7287814/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com