mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-31 00:42:50 -05:00
Compare commits
3 Commits
ec8ab47462
...
53f5240d41
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
53f5240d41 | ||
|
|
27f0df07af | ||
|
|
ad940b5884 |
@@ -966,6 +966,17 @@ Item {
|
|||||||
return success ? `PLUGIN_DISABLE_SUCCESS: ${pluginId}` : `PLUGIN_DISABLE_FAILED: ${pluginId}`;
|
return success ? `PLUGIN_DISABLE_SUCCESS: ${pluginId}` : `PLUGIN_DISABLE_FAILED: ${pluginId}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggle(pluginId: string): string {
|
||||||
|
if (!pluginId)
|
||||||
|
return "ERROR: No plugin ID specified";
|
||||||
|
|
||||||
|
if (!PluginService.availablePlugins[pluginId])
|
||||||
|
return `PLUGIN_NOT_FOUND: ${pluginId}`;
|
||||||
|
|
||||||
|
const success = PluginService.togglePlugin(pluginId);
|
||||||
|
return success ? `PLUGIN_TOGGLE_SUCCESS: ${pluginId}` : `PLUGIN_TOGGLE_FAILED: ${pluginId}`;
|
||||||
|
}
|
||||||
|
|
||||||
function list(): string {
|
function list(): string {
|
||||||
const plugins = PluginService.getAvailablePlugins();
|
const plugins = PluginService.getAvailablePlugins();
|
||||||
if (plugins.length === 0)
|
if (plugins.length === 0)
|
||||||
|
|||||||
@@ -365,6 +365,7 @@ Item {
|
|||||||
onContentItemReady: contentItem => {
|
onContentItemReady: contentItem => {
|
||||||
contentItem.widthChanged.connect(() => layoutTimer.restart());
|
contentItem.widthChanged.connect(() => layoutTimer.restart());
|
||||||
contentItem.heightChanged.connect(() => layoutTimer.restart());
|
contentItem.heightChanged.connect(() => layoutTimer.restart());
|
||||||
|
layoutTimer.restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
onActiveChanged: layoutTimer.restart()
|
onActiveChanged: layoutTimer.restart()
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
pragma ComponentBehavior: Bound
|
pragma ComponentBehavior: Bound
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Modals.Common
|
import qs.Modals.Common
|
||||||
@@ -51,7 +52,9 @@ Item {
|
|||||||
if (tabIndex === NotepadStorageService.currentTabIndex && hasUnsavedChanges()) {
|
if (tabIndex === NotepadStorageService.currentTabIndex && hasUnsavedChanges()) {
|
||||||
root.pendingAction = "close_tab_" + tabIndex;
|
root.pendingAction = "close_tab_" + tabIndex;
|
||||||
root.confirmationDialogOpen = true;
|
root.confirmationDialogOpen = true;
|
||||||
confirmationDialog.open();
|
confirmationDialogLoader.active = true;
|
||||||
|
if (confirmationDialogLoader.item)
|
||||||
|
confirmationDialogLoader.item.open();
|
||||||
} else {
|
} else {
|
||||||
performCloseTab(tabIndex);
|
performCloseTab(tabIndex);
|
||||||
}
|
}
|
||||||
@@ -101,7 +104,9 @@ Item {
|
|||||||
root.pendingFileUrl = fileUrl;
|
root.pendingFileUrl = fileUrl;
|
||||||
root.pendingAction = "load_file";
|
root.pendingAction = "load_file";
|
||||||
root.confirmationDialogOpen = true;
|
root.confirmationDialogOpen = true;
|
||||||
confirmationDialog.open();
|
confirmationDialogLoader.active = true;
|
||||||
|
if (confirmationDialogLoader.item)
|
||||||
|
confirmationDialogLoader.item.open();
|
||||||
} else {
|
} else {
|
||||||
performLoadFromFile(fileUrl);
|
performLoadFromFile(fileUrl);
|
||||||
}
|
}
|
||||||
@@ -170,7 +175,9 @@ Item {
|
|||||||
saveToFile(fileUrl);
|
saveToFile(fileUrl);
|
||||||
} else {
|
} else {
|
||||||
root.fileDialogOpen = true;
|
root.fileDialogOpen = true;
|
||||||
saveBrowser.open();
|
saveBrowserLoader.active = true;
|
||||||
|
if (saveBrowserLoader.item)
|
||||||
|
saveBrowserLoader.item.open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,10 +185,14 @@ Item {
|
|||||||
if (hasUnsavedChanges()) {
|
if (hasUnsavedChanges()) {
|
||||||
root.pendingAction = "open";
|
root.pendingAction = "open";
|
||||||
root.confirmationDialogOpen = true;
|
root.confirmationDialogOpen = true;
|
||||||
confirmationDialog.open();
|
confirmationDialogLoader.active = true;
|
||||||
|
if (confirmationDialogLoader.item)
|
||||||
|
confirmationDialogLoader.item.open();
|
||||||
} else {
|
} else {
|
||||||
root.fileDialogOpen = true;
|
root.fileDialogOpen = true;
|
||||||
loadBrowser.open();
|
loadBrowserLoader.active = true;
|
||||||
|
if (loadBrowserLoader.item)
|
||||||
|
loadBrowserLoader.item.open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,7 +200,9 @@ Item {
|
|||||||
if (hasUnsavedChanges()) {
|
if (hasUnsavedChanges()) {
|
||||||
root.pendingAction = "new";
|
root.pendingAction = "new";
|
||||||
root.confirmationDialogOpen = true;
|
root.confirmationDialogOpen = true;
|
||||||
confirmationDialog.open();
|
confirmationDialogLoader.active = true;
|
||||||
|
if (confirmationDialogLoader.item)
|
||||||
|
confirmationDialogLoader.item.open();
|
||||||
} else {
|
} else {
|
||||||
createNewTab();
|
createNewTab();
|
||||||
}
|
}
|
||||||
@@ -249,6 +262,10 @@ Item {
|
|||||||
onLoadFailed: error => {}
|
onLoadFailed: error => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LazyLoader {
|
||||||
|
id: saveBrowserLoader
|
||||||
|
active: false
|
||||||
|
|
||||||
FileBrowserModal {
|
FileBrowserModal {
|
||||||
id: saveBrowser
|
id: saveBrowser
|
||||||
|
|
||||||
@@ -290,7 +307,9 @@ Item {
|
|||||||
} else if (root.pendingAction === "open") {
|
} else if (root.pendingAction === "open") {
|
||||||
Qt.callLater(() => {
|
Qt.callLater(() => {
|
||||||
root.fileDialogOpen = true;
|
root.fileDialogOpen = true;
|
||||||
loadBrowser.open();
|
loadBrowserLoader.active = true;
|
||||||
|
if (loadBrowserLoader.item)
|
||||||
|
loadBrowserLoader.item.open();
|
||||||
});
|
});
|
||||||
} else if (root.pendingAction.startsWith("close_tab_")) {
|
} else if (root.pendingAction.startsWith("close_tab_")) {
|
||||||
Qt.callLater(() => {
|
Qt.callLater(() => {
|
||||||
@@ -307,6 +326,11 @@ Item {
|
|||||||
root.fileDialogOpen = false;
|
root.fileDialogOpen = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LazyLoader {
|
||||||
|
id: loadBrowserLoader
|
||||||
|
active: false
|
||||||
|
|
||||||
FileBrowserModal {
|
FileBrowserModal {
|
||||||
id: loadBrowser
|
id: loadBrowser
|
||||||
@@ -334,6 +358,11 @@ Item {
|
|||||||
root.fileDialogOpen = false;
|
root.fileDialogOpen = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LazyLoader {
|
||||||
|
id: confirmationDialogLoader
|
||||||
|
active: false
|
||||||
|
|
||||||
DankModal {
|
DankModal {
|
||||||
id: confirmationDialog
|
id: confirmationDialog
|
||||||
@@ -436,7 +465,9 @@ Item {
|
|||||||
createNewTab();
|
createNewTab();
|
||||||
} else if (root.pendingAction === "open") {
|
} else if (root.pendingAction === "open") {
|
||||||
root.fileDialogOpen = true;
|
root.fileDialogOpen = true;
|
||||||
loadBrowser.open();
|
loadBrowserLoader.active = true;
|
||||||
|
if (loadBrowserLoader.item)
|
||||||
|
loadBrowserLoader.item.open();
|
||||||
} else if (root.pendingAction === "load_file") {
|
} else if (root.pendingAction === "load_file") {
|
||||||
performLoadFromFile(root.pendingFileUrl);
|
performLoadFromFile(root.pendingFileUrl);
|
||||||
} else if (root.pendingAction.startsWith("close_tab_")) {
|
} else if (root.pendingAction.startsWith("close_tab_")) {
|
||||||
@@ -473,7 +504,9 @@ Item {
|
|||||||
confirmationDialog.close();
|
confirmationDialog.close();
|
||||||
root.confirmationDialogOpen = false;
|
root.confirmationDialogOpen = false;
|
||||||
root.fileDialogOpen = true;
|
root.fileDialogOpen = true;
|
||||||
saveBrowser.open();
|
saveBrowserLoader.active = true;
|
||||||
|
if (saveBrowserLoader.item)
|
||||||
|
saveBrowserLoader.item.open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -491,3 +524,4 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -556,6 +556,33 @@ Singleton {
|
|||||||
return loadPlugin(pluginId, true);
|
return loadPlugin(pluginId, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function togglePlugin(pluginId) {
|
||||||
|
let instance = pluginInstances[pluginId];
|
||||||
|
|
||||||
|
// Lazy instantiate daemon plugins on first toggle
|
||||||
|
// This respects the daemon lifecycle (not instantiated on load)
|
||||||
|
// while supporting toggle functionality for slideout-capable daemons
|
||||||
|
if (!instance && pluginDaemonComponents[pluginId]) {
|
||||||
|
const comp = pluginDaemonComponents[pluginId];
|
||||||
|
const newInstance = comp.createObject(root, {
|
||||||
|
"pluginId": pluginId,
|
||||||
|
"pluginService": root
|
||||||
|
});
|
||||||
|
if (newInstance) {
|
||||||
|
const newInstances = Object.assign({}, pluginInstances);
|
||||||
|
newInstances[pluginId] = newInstance;
|
||||||
|
pluginInstances = newInstances;
|
||||||
|
instance = newInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (instance && typeof instance.toggle === "function") {
|
||||||
|
instance.toggle();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function savePluginData(pluginId, key, value) {
|
function savePluginData(pluginId, key, value) {
|
||||||
SettingsData.setPluginSetting(pluginId, key, value);
|
SettingsData.setPluginSetting(pluginId, key, value);
|
||||||
pluginDataChanged(pluginId);
|
pluginDataChanged(pluginId);
|
||||||
|
|||||||
Reference in New Issue
Block a user