Skip to content

Commit ef36ebb

Browse files
Test code for running a command and sending notifications... neither of which work the way I would like them to. Looks like I'm going to have to pull in C++.
1 parent 12da8cb commit ef36ebb

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

min-status-widget/contents/ui/main.qml

+27-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import QtQuick 1.1
22

3-
4-
53
Item {
64

75
Image {
@@ -19,12 +17,39 @@ Item {
1917
height: parent.height
2018
fillMode: Image.PreserveAspectFit
2119

20+
MouseArea {
21+
anchors.fill: parent
22+
onClicked: widgetImage.runCommand()
23+
}
24+
2225
function switchImages(){
2326
var nextImage = widgetImage.nextImage;
2427
widgetImage.nextImage = widgetImage.source;
2528
widgetImage.source = nextImage;
2629
}
2730

31+
function sendNotification(){
32+
console.log("Clicked!");
33+
var service = dataEngine("notifications").serviceForSource("notification");
34+
var operation = service.operationDescription("createNotification");
35+
operation["appName"] = "Min-Status-Widget";
36+
operation["appIcon"] = plasmoid.file("images", "ok.png");
37+
operation["summary"] = "Something Happened!";
38+
operation["body"] = "I'm assuming that this should be longer...";
39+
operation["timeout"] = 3000;
40+
41+
service.startOperationCall(operation);
42+
console.log(service.serviceReady(service));
43+
}
44+
45+
function runCommand(){
46+
widgetImage.source = widgetImage.workingImage;
47+
console.log("Running Command...");
48+
var result = plasmoid.runCommand("/home/jschindler/src/min-status-widget/resources/randomSuccess.sh");
49+
sendNotification();
50+
console.log(result);
51+
}
52+
2853
Timer {
2954
id: "myTimer"
3055
interval: 500; running: true; repeat: true

min-status-widget/metadata.desktop

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Icon=chronometer
66
X-Plasma-API=declarativeappletscript
77
X-Plasma-MainScript=ui/main.qml
88
X-Plasma-DefaultSize=65,65
9+
X-Plasma-RequiredExtensions=LaunchApp
910

1011
X-KDE-PluginInfo-Author=Jason Schindler
1112
X-KDE-PluginInfo-Email[email protected]

0 commit comments

Comments
 (0)