spawning of windows
authorRobin Krens <robin@robinkrens.nl>
Tue, 24 Nov 2020 18:12:48 +0000 (19:12 +0100)
committerRobin Krens <robin@robinkrens.nl>
Tue, 24 Nov 2020 18:12:48 +0000 (19:12 +0100)
.gitignore [new file with mode: 0644]
contents/config/config.qml [new file with mode: 0644]
contents/config/main.xml [new file with mode: 0644]
contents/ui/ConfigGeneral.qml [new file with mode: 0644]
contents/ui/main.qml [new file with mode: 0644]
contents/ui/snowWindow.qml [new file with mode: 0644]
metadata.desktop [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..86950b3
--- /dev/null
@@ -0,0 +1 @@
+*.qmlc
diff --git a/contents/config/config.qml b/contents/config/config.qml
new file mode 100644 (file)
index 0000000..dca86fd
--- /dev/null
@@ -0,0 +1,11 @@
+import QtQuick 2.0
+
+import org.kde.plasma.configuration 2.0
+
+ConfigModel {
+    ConfigCategory {
+         name: i18n("Appearance")
+         icon: "view-list-icons"
+         source: "ConfigGeneral.qml"
+    }
+}
diff --git a/contents/config/main.xml b/contents/config/main.xml
new file mode 100644 (file)
index 0000000..9c334d6
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
+      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+      xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
+      http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
+  <kcfgfile name=""/>
+
+  <group name="Appearance">
+         <entry name="item_color" type="String">
+                 <label>Set item color shade</label>
+                 <default>red</default>
+         </entry>
+  </group>
+
+</kcfg>
diff --git a/contents/ui/ConfigGeneral.qml b/contents/ui/ConfigGeneral.qml
new file mode 100644 (file)
index 0000000..59e2cbf
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ *  Copyright 2020 Robin Krens <robin@robinkrens.nl>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  2.010-1301, USA.
+ */
+
+import QtQuick 2.0
+import QtQuick.Layouts 1.1 as QtLayouts
+import QtQuick.Controls 1.0 as QtControls
+
+import org.kde.plasma.core 2.0 as PlasmaCore
+import org.kde.plasma.extras 2.0 as PlasmaExtras
+
+Item {
+       id: iconsPage
+       width: childrenRect.width
+       height: childrenRect.height
+       implicitWidth: pageColumn.implicitWidth
+       implicitHeight: pageColumn.implicitHeight
+       property string cfg_item_color;
+
+       SystemPalette {
+               id: sypal
+       }
+
+       QtLayouts.ColumnLayout {
+
+               id: pageColumn
+
+               anchors.left: parent.left
+               PlasmaExtras.Heading {
+               text: i18nc("Heading for colors", "Item shade color")
+               color: syspal.text
+               level: 3
+       }
+
+       /* User can't specify an exact color, since i'm using
+        * gradients and alpha for colors */
+       QtControls.ComboBox {
+               id: dot
+               model: ["red", "green", "blue"];
+               currentIndex: dot.model.indexOf(cfg_item_color)
+               onActivated: cfg_item_color = model[index]
+       }
+
+    }
+}
diff --git a/contents/ui/main.qml b/contents/ui/main.qml
new file mode 100644 (file)
index 0000000..4b6503b
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ *   Copyright 2020 Robin Krens <robin@robinkrens.nl>
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU Library General Public License as
+ *   published by the Free Software Foundation; either version 2 or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details
+ *
+ *   You should have received a copy of the GNU Library General Public
+ *   License along with this program; if not, write to the
+ *   Free Software Foundation, Inc.,
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+import QtQuick 2.6
+import QtQuick.Layouts 1.0
+import QtQuick.Window 2.2
+
+//import org.kde.plasma.plasmoid 2.0 as Plasmoid
+//import org.kde.plasma.core 2.0 as PlasmaCore
+//import org.kde.plasma.components 2.0 as PlasmaComponents
+
+import QtQuick 2.3
+import QtQuick.Controls 1.2
+
+Item {
+       id: root;
+       Button {
+               anchors.centerIn: parent;
+               text: "Let it snow!";
+
+               onClicked: {
+                       var snow = [];
+                       for (var i = 0; i < 10; i++) {
+                               
+                               snow[i] = Qt.createComponent("snowWindow.qml");
+                               var snowWindow = snow[i].createObject(root);
+                               snowWindow.x = Math.random() * 500;
+                               snowWindow.y = Math.random() * 500;
+                               //snowWindow.opacity = 0.9;
+                               //snowWindow.flags = Qt.WA_TransparentForMouseEvents | Qt.X11BypassWindowManagerHint;
+
+                               //snowWindow.flags =  Qt.WA_TransparentForMouseEvents| Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint;
+                               snowWindow.showMaximized();
+                       }
+        }
+    }
+}
diff --git a/contents/ui/snowWindow.qml b/contents/ui/snowWindow.qml
new file mode 100644 (file)
index 0000000..fa51e65
--- /dev/null
@@ -0,0 +1,50 @@
+
+/*
+ *   Copyright 2020 Robin Krens <robin@robinkrens.nl>
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU Library General Public License as
+ *   published by the Free Software Foundation; either version 2 or
+ *   (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details
+ *
+ *   You should have received a copy of the GNU Library General Public
+ *   License along with this program; if not, write to the
+ *   Free Software Foundation, Inc.,
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+import QtQuick 2.6
+import QtQuick.Controls 1.4
+import QtQuick.Window 2.2
+
+ApplicationWindow {
+       
+       id: root;
+       
+       width: 30; height: 30;
+       x: 500; y: 500;
+       //color: "transparent";
+       opacity: 0.5;
+       title: qsTr("Snowy")
+
+       flags: Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint | Qt.WA_TransparentForMouseEvents | Qt.WA_TranslucentBackground | Qt.X11BypassWindowManagerHint;
+
+
+       //flags: Qt.WA_TranslucentBackground | Qt.X11BypassWindowManagerHint | Qt.WA_TransparentForMouseEvents;
+
+       //flags: Qt.WA_TranslucentBackground | Qt.WA_TransparentForMouseEvents| Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint;
+
+       //flags: Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint | Qt.WA_TransparentForMouseEvents | Qt.WA_TranslucentBackground;
+       //color: "transparent";
+
+    //         Text {
+    //         anchors.centerIn: parent
+    //         color: "red";
+    //         text: qsTr("Hello World.")
+    //         }
+}
diff --git a/metadata.desktop b/metadata.desktop
new file mode 100644 (file)
index 0000000..9f02ec9
--- /dev/null
@@ -0,0 +1,24 @@
+[Desktop Entry]
+Name=Snow Everywhere
+Keywords=snow;christmas;newyear;2020
+Comment=Let there be snow!
+Type=Service
+Icon=view-list-icons
+X-KDE-ServiceTypes=Plasma/Applet
+
+X-Plasma-API=declarativeappletscript
+X-Plasma-MainScript=ui/main.qml
+
+X-KDE-PluginInfo-Author=Robin Krens
+X-KDE-PluginInfo-Email=robin@robinkrens.nl
+X-KDE-PluginInfo-Name=nl.robinkrens.plasma.snoweverywhere
+X-KDE-PluginInfo-Version=0.1
+X-KDE-PluginInfo-Website=http://plasma.kde.org/
+X-KDE-PluginInfo-Category=Utilities
+X-KDE-PluginInfo-Depends=
+X-KDE-PluginInfo-License=GPL
+X-KDE-PluginInfo-EnabledByDefault=true
+X-KDE-FormFactors=desktop
+
+[Settings]
+FallbackTheme=breeze-dark