Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notification support? #5

Open
danielmeloalencar opened this issue Sep 12, 2022 · 4 comments
Open

Notification support? #5

danielmeloalencar opened this issue Sep 12, 2022 · 4 comments

Comments

@danielmeloalencar
Copy link
Contributor

Hello!
Do you intend to add notification support?

@wnayes
Copy link
Owner

wnayes commented Sep 19, 2022

I prototyped a bit of the implementation of the System Tray Protocol Specification in 47dfad7, but it seems like any app I tried is not actually using this protocol.

It may be that this specification is more commonly used.

@danielmeloalencar
Copy link
Contributor Author

danielmeloalencar commented Apr 6, 2024

You must register bond-wm as a notification service with dbus. Alternatively, I was able to perform notification using xfce4-notifyd. But first it was necessary to run

sudo apt install dbus-x11

sudo apt-get install libnotify-cil-dev

sudo apt install xfce4-notifyd

sudo service dbus start

export $(dbus-launch) (this is very important)

notify-send "Hello"

Tested with ubuntu 22.04 xorg

@danielmeloalencar
Copy link
Contributor Author

I prototyped a bit of the implementation of the System Tray Protocol Specification in 47dfad7, but it seems like any app I tried is not actually using this protocol.

It may be that this specification is more commonly used.

Maybe this can help:

const dbus = require('dbus-native');

// Connection to the D-Bus system message
const systemBus = dbus.systemBus();

if (!systemBus) {
    throw new Error('Could not connect to the DBus session bus.');
}

// Service name for the notify-daemon
const serviceName = 'org.freedesktop.Notifications';

// Object path for notifications
const objectPath = '/org/freedesktop/Notifications';

// Interface name for notifications
const interfaceName = 'org.freedesktop.Notifications';

// Getting a proxy to interact with the notifications service
const notifications = systemBus.getService(serviceName).getInterface(objectPath, interfaceName);

// Function to handle new notifications
function handleNotification(appName, summary, body) {
    console.log('New notification:');
    console.log('Application:', appName);
    console.log('Summary:', summary);
    console.log('Body:', body);
    console.log('---');
}

// Subscribe to receive notifications
notifications.on('Notification', handleNotification);

// Define the error handling function
notifications.on('error', function(err) {
    console.error('Error receiving notification:', err);
});

console.log('Waiting for notifications...');

// Keeps the process running
process.stdin.resume();

@danielmeloalencar
Copy link
Contributor Author

I believe that now with ChildWindow used in the Start Menu it is better to implement the notification UI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants