Created
September 30, 2014 03:29
-
-
Save sidorares/8d0587e384176f1be83d to your computer and use it in GitHub Desktop.
Unity integration for node-x11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Desktop Entry] | |
Name=Unity Launcher test | |
GenericName=Oooooooooooooooooooooooooooo | |
Comment=Aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | |
Exec=/home/laplace/ltest/test.js | |
Icon=system-software-update | |
Terminal=false | |
Type=Application | |
Categories=System;Settings; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
var dbus = require('dbus-native'); | |
var bus = dbus.sessionBus(); | |
var menu = require('./menu1'); | |
var dbusmenu = require('dbusmenu'); | |
var x11 = require('x11'); | |
var pro = 0.1 | |
function set() { | |
bus.connection.message({ | |
type: 4, | |
flags: 1, | |
signature: 'sa{sv}', | |
path: "/com/canonical/unity/launcherentry/353109048", | |
member: "Update", | |
interface: "com.canonical.Unity.LauncherEntry", | |
body: [ | |
//"application://gnome-terminal.desktop", | |
"application://launcher-test.desktop", | |
[ | |
["quicklist", ['s', '/some/wid/path']], | |
["progress-visible", ['b', true ]], | |
["progress", ['d', pro ]] | |
] | |
] | |
}); | |
pro += 0.05; | |
if (pro < 0.9) | |
setTimeout(set, 1000); | |
} | |
setTimeout(set, 1000); | |
x11.createClient(function(err, display) { | |
var X = display.client; | |
var wid = X.AllocID(); | |
X.CreateWindow(wid, display.screen[0].root, 100, 100, 400, 300); | |
X.MapWindow(wid); | |
var mainmenu = dbusmenu.createMenu(bus, wid, '/some/wid/path', menu); | |
//mainmenu.on('clicked', function(id, menuitem) { | |
// console.log(id, menuitem); | |
//}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment