diff --git a/README.md b/README.md new file mode 100644 index 0000000..79d375a --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +# 🐾 MeowRelay plasmoid + +Almost fully ported MeowRelay configurator to native kde plasmoid + +![Plasmoid](https://git.meowfox.net/MeowRelay/kde-widget/src/branch/main/screenshots/screenshot.png) + +## Installation + +``` +git clone https://git.meowfox.net/MeowRelay/kde-widget.git && mv -f ./kde-widget/com.umorist47.meowrelaygui $HOME/.local/share/plasma/plasmoids && rm -r kde-widget +``` diff --git a/com.umorist47.meowrelaygui/contents/ui/Compact.qml b/com.umorist47.meowrelaygui/contents/ui/Compact.qml new file mode 100644 index 0000000..857c6b0 --- /dev/null +++ b/com.umorist47.meowrelaygui/contents/ui/Compact.qml @@ -0,0 +1,105 @@ +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls +import org.kde.kirigami as Kirigami +import org.kde.plasma.core as PlasmaCore +import org.kde.plasma.components as PlasmaComponents +import org.kde.plasma.extras as PlasmaExtras +import org.kde.plasma.plasmoid + +Item{ + Layout.minimumWidth: govnoLayout.implicitWidth + Layout.minimumHeight: Kirigami.Units.iconSizes.medium + + Layout.maximumWidth: govnoLayout.implicitWidth + Layout.maximumHeight: Layout.minimumHeight + + Layout.preferredWidth: govnoLayout.implicitWidth + Layout.preferredHeight: Layout.minimumHeight + + MouseArea { + id: mouseArea + //property bool wasExpanded + + Accessible.name: Plasmoid.title + Accessible.role: Accessible.Button + //Accessible.description: desc + + //onPressed: wasExpanded = root.expanded + //onClicked: root.expanded = !wasExpanded + + onClicked: Plasmoid.activated(); + + Keys.onPressed: { + switch (event.key) { + case Qt.Key_Space: + case Qt.Key_Enter: + case Qt.Key_Return: + case Qt.Key_Select: + Plasmoid.activated(); + break; + } + } + + // ΠΈΠΊΠΎΠ½ΠΊΠΈ Π½Π΅ Π±ΡƒΠ΄Π΅Ρ‚ Π±Π΅Π· этой Π·Π°Π»ΡƒΠΏΡ‹ + anchors.fill: parent + anchors.leftMargin: 0 + + activeFocusOnTab: true + hoverEnabled: true + + Component { + id: meowIconComponent + Kirigami.Icon { + Layout.preferredWidth: Kirigami.Units.gridUnit * 1.5 + Layout.preferredHeight: Kirigami.Units.gridUnit * 1.5 + Layout.alignment: Qt.AlignVCenter + source: Qt.resolvedUrl("../images/dogfood.svg") + isMask: true + active: mouseArea.containsMouse + } + } + Component { + id: genericLabelComponent + Label { + property string labelText: "yaebalrot" + text: labelText === "yaebalrot" ? "" : labelText + color: text === "error" ? "red" : Kirigami.Theme.textColor + font.pointSize: Kirigami.Theme.mediumFont.pointSize + verticalAlignment: Text.AlignVCenter + } + } + + property var configArray: Plasmoid.configuration.ExtraLayout === true ? Plasmoid.configuration.StringLayoutPlacement.split(" ") : ["meow_icon"] + RowLayout { + id: govnoLayout + anchors.fill: parent + spacing: Kirigami.Units.smallSpacing + + Repeater { + model: mouseArea.configArray + + Loader { + id: govnoebanoe + // Logic to choose WHICH component to spawn + sourceComponent: (modelData === "meow_icon") ? meowIconComponent : genericLabelComponent + + // Logic to pass DATA to that component + Binding { + target: govnoebanoe.item // The Label we just created + property: "labelText" // The property on the Label + value: root[modelData] // The live variable in root + when: govnoebanoe.status === Loader.Ready && modelData !== "meow_icon" + } + Layout.fillHeight: true + } + } + } + // Kirigami.Icon { + // anchors.fill: parent + // source: Qt.resolvedUrl("../images/dogfood.svg") + // isMask: true + // active: mouseArea.containsMouse + // } + } +} diff --git a/screenshots/screenshot.png b/screenshots/screenshot.png new file mode 100644 index 0000000..a6139f6 Binary files /dev/null and b/screenshots/screenshot.png differ