plasma-framework/scriptengines/javascript/tests/script-nowplaying/contents/code/main.js

23 lines
553 B
JavaScript
Raw Normal View History

plasmoid.dataUpdate = function(a, b)
{
label.text = "Playing " + b.Title + " by " + b.Artist + ". time: " +
parseInt(b.Position/60) + ":" + (parseInt(b.Position)%60);
}
plasmoid.stop = function()
{
print("stopping");
}
layout = new LinearLayout(plasmoid);
layout.orientation = Vertical;
label = new Label();
layout.addItem(label);
stop = new PushButton();
stop.text = "Stop";
layout.addItem(stop);
stop["clicked()"].connect(plasmoid.stop);
plasmoid.dataEngine("nowplaying").connectSource("org.mpris.amarok", plasmoid, 500);