Skip to content

Instantly share code, notes, and snippets.

@activey
Created October 14, 2013 11:28
Show Gist options
  • Save activey/6974242 to your computer and use it in GitHub Desktop.
Save activey/6974242 to your computer and use it in GitHub Desktop.
const DBus = imports.dbus;
const NotificationRemoteInterface = {
name: 'org.freedesktop.Notifications', //interface name
methods: [
{ //method name and signature
name: 'Notify',
inSignature: 'susssasa{sv}i',
outSignature: 'u'
}
]
};
let NotificationProxy = DBus.makeProxyClass(NotificationRemoteInterface);
let notification_proxy = new NotificationProxy(DBus.session,
'org.freedesktop.Notifications',
'/org/freedesktop/Notifications');
const Gtk = imports.gi.Gtk;
Gtk.init (null, null);
let builder = new Gtk.Builder ();
builder.add_from_file ("test.glade")
let errlog = builder.get_object ("textview_log");
let test =1;
builder.get_object("window1").connect ("destroy", function () {
Gtk.main_quit();
});
builder.get_object("button1").connect("clicked", function () {
let textArea = builder.get_object("textview1");
let buffer = textArea.get_buffer();
let start = buffer.get_start_iter();
let end = buffer.get_end_iter();
let text = buffer.get_text(start, end, false);
notification_proxy.NotifyRemote('my_app_sample' + test, //these are the params of the method called
10,
'dialog-info',
'Summary of the notification',
text,
[],
{},
10,
function(result, err){
log('This is the result: ' + result);
log('This is the error: ' + err);
let test = test + 1;
});
});
Gtk.main ();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment