maweki / twitchlive-extension

TwitchLive-Panel Gnome Shell Extension displaying your favorite streamers
GNU General Public License v3.0
38 stars 8 forks source link

Notifications not working #78

Closed 18928172992817182 closed 3 years ago

18928172992817182 commented 3 years ago

Hello,

I have two machines with fedora 34 and gnome 40.1.0 and this extension causes some issues.

When a streamer goes live the extension breaks. Even though debugging gnome extensions turned out to be the worst experience ever (is there no remote debug port support? seriously?)

It turns out it is this causing it:

_streamerOnlineNotification@/home/gustaf/.local/share/gnome-shell/extensions/TwitchLive_Panel@extensions.maweki.de/extension.js:217:32 updateData/</</<@/home/gustaf/.local/share/gnome-shell/extensions/TwitchLive_Panel@extensions.maweki.de/extension.js:257:39 updateData/</<@/home/gustaf/.local/share/gnome-shell/extensions/TwitchLive_Panel@extensions.maweki.de/extension.js:256:96

When looking at this function it wants to do the following:

_streamerOnlineNotification(streamer) {
      let notification = new MessageTray.Notification(
        this.notification_source,
        _("%streamer% is live!").replace(/%streamer%/, streamer.streamer),
        _("Playing %game%").replace(/%game%/, streamer.game));

      notification.addAction(_("Watch!"), function(){
        // FIXME duplicate code from _execCmd
        let cmd = OPENCMD.replace(/%streamer%/g, streamer.streamer);
        GLib.spawn_command_line_async(cmd);
      });

      this.notification_source.notify(notification);
    };

However as per the MessageTray of Gnome 40 it does not want a Message tray object: https://github.com/GNOME/gnome-shell/blob/7f7b515b84b6320cd6459ab5fd7154c54f70c4ae/js/ui/main.js#L464

Instead it wants a string for details and a string for message.

Screenshot from 2021-07-03 19-59-17

I can make a fix for myself but I don't know how that would affect people using the extension below gnome 40 and if there is a way to check which version that is used in order to use the correct API.

Suggestions?

:)

18928172992817182 commented 3 years ago

I just noticed that in the code from Gnome I linked to above they are using showNotification. When I changed to that everything worked. Will create a pull request for that.

maweki commented 3 years ago

Even though debugging gnome extensions turned out to be the worst experience ever

It's like driving in the dark with lights off ... and tied hands ... sitting on the backseat ... while blindfolded. I see nothing changing. I talked to many people at many a GUADEC and I always get promises and promises. There are Blog entries full of promises how the situation will get better. But it never does.

Thanks for the PR. I think we still need a version check. Maybe you can add that. You can see how that works here:

https://github.com/maweki/twitchlive-extension/blob/master/prefs.js#L13-L14

https://github.com/maweki/twitchlive-extension/blob/master/prefs.js#L41-L44

18928172992817182 commented 3 years ago

I really found your comment funny. We clearly share the frustration about debugging extensions :smile:

I added the shell version check. Thank you for that example! Now I learned something new today :smiley:

I however do not have a PC with an older gnome version so I have not verified if the case for the old shell works but it really should. Just so you know.

maweki commented 3 years ago

I have not verified if the case for the old shell works but it really should.

We're all flying blind here. I will release it as soon as I find the time. Might be the weekend. Thank you for your contribution.