我在一个项目上工作,这将创建从gjs脚本通知。没有错误,但不显示通知。有什么建议吗?代码:
#!/usr/bin/gjs
const Gio = imports.gi.Gio;
var Application = new Gio.Application({applicationId:"sk.project.app", flags:32});
var Notification = new Gio.Notification();
Notification.set_body("message here");
Application.send_notification(null, Notification);发布于 2020-07-18 22:57:20
为了显示GNotification,您必须在/usr/share/applications/或~/.local/share/applications/中有一个关联的.desktop文件。
这个文件应该有X-GNOME-UsesNotifications密钥,并且按照惯例应该被命名为sk.project.app.desktop。
如果发送时未设置图标,桌面将使用该文件中定义的应用程序图标。
[Desktop Entry]
Type=Application
Name=My Application
Exec=/path/to/myapp.js
Terminal=false
Icon=sk.project.app
X-GNOME-UsesNotifications=truehttps://stackoverflow.com/questions/62961507
复制相似问题