mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-26 14:32:52 -05:00
plugins/desktop-widgets: create a new "desktop" widget plugin type
- Draggable per-monitor background layer widgets - Add basic dms version checks on plugins - Clock: built-in clock desktop plugin - dgop: built-in system monitor desktop plugin
This commit is contained in:
49
quickshell/Modules/Plugins/DesktopPluginComponent.qml
Normal file
49
quickshell/Modules/Plugins/DesktopPluginComponent.qml
Normal file
@@ -0,0 +1,49 @@
|
||||
import QtQuick
|
||||
import qs.Common
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property var pluginService: null
|
||||
property string pluginId: ""
|
||||
|
||||
property real widgetWidth: 200
|
||||
property real widgetHeight: 200
|
||||
property real minWidth: 100
|
||||
property real minHeight: 100
|
||||
|
||||
property var pluginData: ({})
|
||||
|
||||
Component.onCompleted: loadPluginData()
|
||||
onPluginServiceChanged: loadPluginData()
|
||||
onPluginIdChanged: loadPluginData()
|
||||
|
||||
Connections {
|
||||
target: pluginService
|
||||
function onPluginDataChanged(changedPluginId) {
|
||||
if (changedPluginId !== pluginId)
|
||||
return;
|
||||
loadPluginData();
|
||||
}
|
||||
}
|
||||
|
||||
function loadPluginData() {
|
||||
if (!pluginService || !pluginId) {
|
||||
pluginData = {};
|
||||
return;
|
||||
}
|
||||
pluginData = SettingsData.getPluginSettingsForPlugin(pluginId);
|
||||
}
|
||||
|
||||
function getData(key, defaultValue) {
|
||||
if (!pluginService || !pluginId)
|
||||
return defaultValue;
|
||||
return pluginService.loadPluginData(pluginId, key, defaultValue);
|
||||
}
|
||||
|
||||
function setData(key, value) {
|
||||
if (!pluginService || !pluginId)
|
||||
return;
|
||||
pluginService.savePluginData(pluginId, key, value);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user