How To: Notifications / Tray Icons for Electron Apps

Forum Forums General Software How To: Notifications / Tray Icons for Electron Apps

  • This topic has 1 reply, 2 voices, and was last updated Nov 2-7:13 am by Xecure.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #69974
    Member
    violet_spark

      Hi! Apologies if this is in the wrong place, first time posting here.

      We wanted to get notifications working in slack, and electron apps in general. We found some posts tangential to this in the search on these forums but figured we’d track down the “right” way to do it. We ended up finding this github issue from void linux. The original issue is about tray icons but the fix works for notifications too.

      Here’s what we did:

      1. We installed a notification daemon. we like dunst but whatever will work. Not sure if its necessary but we added it to our .desktop-session/startup file.
      2. Here’s the important bit. We added

      export $(dbus-launch)

      to the file

      /usr/local/bin/desktop-session.

      We added this after the line that says

      say "Exporting desktop Variables:"

      We aren’t dbus experts but best we can tell this sets some important environment variables for the session that electron uses to figure out how to talk to dbus for notifications, tray icons, and such.

      We’re using antiX 19, so not sure if this still applies to 21. But yeah, hope that’s helpful to someone!

      #69978
      Member
      Xecure
        Helpful
        Up
        1
        ::

        What you describe is a hack that is OK for antiX 19, but not for antiX 21.

        antiX 21’s desktop-session already includes an option DBUS_SESSION_LAUNCH (disabled by default). You just need to edit desktop-session.conf and activate the option as “true”, then restart session and it is done for all future sessions.

        This is not exclusive to electron apps, but to applications that use dbus sessions.

        NOTE: some users are against dbus, as any app that communicates with it can monitor all dbus communications through the dbus daemon. It makes life easier, but it can also be a source of spyware. As always, everything has advantages and disadvantages.

        antiX Live system enthusiast.
        General Live Boot Parameters for antiX.

      Viewing 2 posts - 1 through 2 (of 2 total)
      • You must be logged in to reply to this topic.