Chris Vogel @me@chrichri.ween.de

not yet

intent

no sarcasm, no irony

hashtag

#packetfence, #yunohost, #flohmarkt, #librem5, #ShotOnLibrem5, #microblogpub, #Lite3DP, #deskhop, #espressi

matrix

@chrichri:ween.de

  • Notes
  • Articles
  • Remote follow
Chris Vogel's avatar
Chris Vogel
@me@chrichri.ween.de

Receiving SMS plays a long tune on my #Librem5. For a few persons I'd like to have this tune played also if they send me a message using #matrix.

A problem is that the #fractal flatpak does not use #feedbackd yet to signal new messages and on #PureOS #Byzantium there's no way to define different sounds for different notification events.

So I started testing a small script to read notifications and trigger feedback for messages coming from an account containing some string:

#!/usr/bin/python3 import gi import time gi.require_version('Lfb', '0.0') from gi.repository import Lfb from gi.repository import GLib import dbus from dbus.mainloop.glib import DBusGMainLoop def print_notification(bus, message): keys = ["app_name", "replaces_id", "app_icon", "summary", "body", "actions", "hints", "expire_timeout"] args = message.get_args_list() if len(args) == 8: notification = dict([(keys[i], args[i]) for i in range(8)]) if "account_i_want_to_be_notified_for_like_it_would_be_sms" in notification["summary"]: print( notification["summary"], ': ', notification["body"] ) event.trigger_feedback() Lfb.init('org.sigxcpu.lfbexample') event = Lfb.Event.new('message-new-sms') loop = DBusGMainLoop(set_as_default=True) session_bus = dbus.SessionBus() session_bus.add_match_string("type='method_call',interface='org.freedesktop.Notifications',member='Notify',eavesdrop=true") session_bus.add_message_filter(print_notification) GLib.MainLoop().run()
  • permalink
  • interact from your instance
  • 8 months ago
  • 6 likes
  • 4 shares
  • 2 replies
Likes
@langfingaz@social.tchncs.de @danialbehzadi@persadon.com @oliv@toot.iopush.net @pak0st@fosstodon.org @hadrianweb@fosstodon.org @jayvii@social.jayvii.de @cocolinofan@mastodon.social
Shares
@paoloredaelli@mastodon.uno @DrewNaylor@mastodon.online @linmob@fosstodon.org @fisherdude@mastodon.social
Guido Günther's avatar
Guido Günther
@agx@librem.one

in reply to this object

@me Good news: Fractal (and other clients) don't need to use feedbackd directly. They just needs to set the `im.received` `category` on the notification: (https://specifications.freedesktop.org/notification-spec/latest/categories.html) and #phosh handles the details.

This is supported by about all notification client libs (libnotify, glib/gio (https://docs.gtk.org/gio/method.Notification.set_category.html)

Maybe file an issue with Fractal for that? Given that Fractal uses glib/gio it's a one line change.

Gio.Notification.set_category docs.gtk.org
  • permalink
  • 8 months ago
Chris Vogel's avatar
Chris Vogel
@me@chrichri.ween.de

in reply to this object

@agx@librem.one I opened the issue here. Thanks for pointing this out!

Also read with great interest your test about chatty and ntfy.

set `im.received` category for notifications (#1508) · Issues · World / fractal · GitLab GitLab
  • permalink
  • 8 months ago
  • 3 likes
Powered by microblog.pub 2.0.0+ynh2 and the ActivityPub protocol. Admin.