Closed saiduc closed 2 years ago
This occurs if the window is closed. I still haven't found a solution to this without setting actions to notifications. The ideal is to click and the window appears without the need for an action.
Currently I can see that the actions
in org.freedesktop.Notifications.Notify
are empty. Is the easiest thing to do to set the action to be a function that surfaces the window? Perhaps the on_show
function in main_windows.py
? I am happy to work on this if you cannot currently.
Currently I can see that the
actions
inorg.freedesktop.Notifications.Notify
are empty. Is the easiest thing to do to set the action to be a function that surfaces the window? Perhaps theon_show
function inmain_windows.py
? I am happy to work on this if you cannot currently.
I will be very grateful and happy with your contribution. Can I wait with commit? Say yes 😁😁😁
Currently I can see that the
actions
inorg.freedesktop.Notifications.Notify
are empty. Is the easiest thing to do to set the action to be a function that surfaces the window? Perhaps theon_show
function inmain_windows.py
? I am happy to work on this if you cannot currently.
Look at the notify_test bench. It's a solution used the actions of the notification, may not work as I would like. When clicking on the body of the notification, the notification is closed, only if you click on the button It works. That is, if the notification goes to the notification area when clicking, the window will not open. Did you understand?
Yes, I understand, I will look at that in the next few days 😄
I can take a look at this if it's ok, @saiduc. A solution with QtDBus
and with dbus
is possible.
I can take a look at this if it's ok, @saiduc. A solution with
QtDBus
and withdbus
is possible.
😍😍 Thank you very much. Now I'm at work, as soon as possible I do the merge and build.
I found it ridiculously difficult to get QtDBus to work with interface signals and slots. Would QSystemTrayNotify work, or would you prefer a direct dbus solution instead?
I found it ridiculously difficult to get QtDBus to work with interface signals and slots. Would QSystemTrayNotify work, or would you prefer a direct dbus solution instead?
If your solution works I don't see why not use it. Soon I do the merge and test in gnome
The solution with QSystemTray.message didn't work on gnome. I will keep Qdbus for now
The solution with QSystemTray.message didn't work on gnome. I will keep Qdbus for now
The solution with QSystemTray.message didn't work on gnome. I will keep Qdbus for now
Okay, I'll try to find a better solution and test in the weekend.
Thanks @BaderSZ for doing this, I hadn't gotten round to it yet.
@saiduc No problem. I use the app often enough and thought I'd help out since I had the time.
@rafatosta could you give me more info on the issue. Is this just the same issue @saiduc had, or something else:
I use AwesomeWM, so I'll install GNOME (hopefully I don't have to use Wayland) and figure out what the exact problem is. Googling shows we're not the only ones.
@saiduc No problem. I use the app often enough and thought I'd help out since I had the time.
@rafatosta could you give me more info on the issue. Is this just the same issue @saiduc had, or something else:
- Did the tray icon show up or not?
- Did the notification show?
- Did the clicking not work?
I use AwesomeWM, so I'll install GNOME (hopefully I don't have to use Wayland) and figure out what the exact problem is. Googling shows we're not the only ones.
Notifications only appeared in the notification center. The popup didn't appear and the event didn't work either.
My investigation so far:
Gio.Notification
.This is definitely solvable, but I can't find a proper way check if GNOME is the desktop environment, especially since newer versions don't set environment variables. I'll keep thinking and hope I find a good answer.
My investigation so far:
- The geniuses in the GNOME design team decided that modern GNOME won't show any tray icons without an extension like Appindicator.
- If we want popup style notifications in GNOME, we'll likely have to implement
Gio.Notification
.This is definitely solvable, but I can't find a proper way check if GNOME is the desktop environment, especially since newer versions don't set environment variables. I'll keep thinking and hope I find a good answer.
Gio is exclusive to GTK. And yes, the icon on Tray is not something native to Gnome.
Gio is exclusive to GTK. And yes, the icon on Tray is not something native to Gnome.
Yes. I can try to figure out a solution around that (there are a few examples without having to create a GtkApplication). It also adds a dependency.
There is an option to copy Telegram, but that would remove the power of DE, do not disturb will not work as expected. In addition to the "so-called visual consistency" of the DEs.
I did take a look at Telegram Desktop, but their solution is a bit long, and in another language. It uses Gio too.
I did take a look at Telegram Desktop, but their solution is a bit long, and in another language. It uses Gio too.
Very interesting the implementation of Telegram... is using dbus. The image I sent is by implementing a widget that works as a notification.
Look at this about the lib gi
https://wiki.archlinux.org/title/Desktop_notifications#Python
No need for a GtkApplication
Doc: https://developer-old.gnome.org/glibmm/stable/classGio_1_1DBus_1_1Connection.html
We would have to use DBus anyways. Thanks for the links, I'll try something out soon. :)
With Gi it has the same behavior as what I already implemented =( Run this code and see the behavior
from gi.repository import Notify, GLib import gi gi.require_version('Notify', '0.7')
loop = GLib.MainLoop()
class Notification(): def init(self, summary, body): Notify.init('Yum Extender') icon = "yumex-dnf" self.notification = Notify.Notification.new(summary, body, icon) self.notification.set_timeout(5000) # timeout 5s self.notification.add_action( 'open', 'Open Yum Extender', self.callback) self.notification.add_action('apply', 'Apply Updates', self.callback) self.notification.connect('closed', self.on_closed)
def show(self):
self.notification.show()
def callback(self, widget, action):
print("notify-action", action)
def on_closed(self, widget):
print("fim")
loop.quit()
def main(): notify = Notification('New Updates', '33 available updates ')
notify.show()
def on_notify_action(widget, action): print(action)
if name == 'main': main() loop.run()
Did you implement the changes in the desktop file?
[Desktop Entry]
...
StartupNotify=true
DBusActivatable=true
X-GNOME-UsesNotifications=true
Did you implement the changes in the desktop file?
[Desktop Entry] ... StartupNotify=true DBusActivatable=true X-GNOME-UsesNotifications=true
I'll look into this further and update the .desktop. Thanks
Now I remembered why I didn't use Dbus for notifications. I couldn't get it to work, this error always appears. I was never able to identify and resolve this error.
Run this code and send the answer, please.
Busy day, sorry.
Run this code and send the answer, please.
Works fine for me, but i am on X11. I'll testing a few solutions now and get back to you. Granted, it's midnight where I'm from, so you might see a response when you wake up. :smile:
Busy day, sorry.
Run this code and send the answer, please. https://pastebin.com/wbZ2JHSf
Works fine for me, but i am on X11. I'll testing a few solutions now and get back to you. Granted, it's midnight where I'm from, so you might see a response when you wake up. smile
Here it didn't even work on X11. I think I have a solution for this, in a few minutes I will commit.
Here it didn't even work on X11. I think I have a solution for this, in a few minutes I will commit.
Sure. I was thinking of making a floating QWidget (similar to this) instead.
Here it didn't even work on X11. I think I have a solution for this, in a few minutes I will commit.
Sure. I was thinking of making a floating QWidget (similar to this) instead.
Yes, it's an excellent idea. My suggestion is to keep both, dbus and via Qwidget and let the user choose (like Telegram-Desktop), what do you think?
That works, but then we'd have to build a settings dialog as well. Which one should be the default?
That works, but then we'd have to build a settings dialog as well. Which one should be the default?
Let's see which works best first, don't you think?
That works, but then we'd have to build a settings dialog as well. Which one should be the default?
Let's see which works best first, don't you think?
I posted a workaround to the problem. It's not ideal, but it works
@BaderSZ
I created this mini project with the same structure as zapzap so that we can test the implementations more easily. Because it is a web page that triggers notifications, which makes it excellent.
sweet. testing then pushing.
The solution is to define a desktop-entry variable in Hint. I took advantage of it and remodeled it as I allowed it to be more general and customizable.
Credit for implementing notifications: https://gist.github.com/KurtJacobson/7a7739bcc97e374ce133a64646a6f5fc
Dbus Protocol Documentation https://specifications.freedesktop.org/notification-spec/latest/ar01s09.html
Great! if it works, it works.
Great! if it works, it works.
I'll build it in flatpak and as soon as I finish I'll send the link
Great! if it works, it works.
flatpak install --user https://dl.flathub.org/build-repo/83955/com.rtosta.zapzap.flatpakref
Thanks for your great work on this project. I am using v2.2 from Flathub on Fedora 35, Gnome Version 41.3 in Wayland. The application correctly runs in the background and shows notifications for new messages.
Clicking on the message does not surface the ZapZap window, and instead I have to click on the icon in the tray.