1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 21:42:51 -05:00

dankbar: add generic bar widget IPC for popouts

fixes #750
This commit is contained in:
bbedward
2025-11-24 19:52:26 -05:00
parent d341a5a60b
commit fa98a27c90
5 changed files with 278 additions and 27 deletions

View File

@@ -563,4 +563,42 @@ Item {
target: "file"
}
IpcHandler {
function toggle(widgetId: string): string {
if (!widgetId)
return "ERROR: No widget ID specified";
if (!BarWidgetService.hasWidget(widgetId))
return `WIDGET_NOT_FOUND: ${widgetId}`;
const success = BarWidgetService.triggerWidgetPopout(widgetId);
return success ? `WIDGET_TOGGLE_SUCCESS: ${widgetId}` : `WIDGET_TOGGLE_FAILED: ${widgetId}`;
}
function list(): string {
const widgets = BarWidgetService.getRegisteredWidgetIds();
if (widgets.length === 0)
return "No widgets registered";
return widgets.join("\n");
}
function status(widgetId: string): string {
if (!widgetId)
return "ERROR: No widget ID specified";
if (!BarWidgetService.hasWidget(widgetId))
return `WIDGET_NOT_FOUND: ${widgetId}`;
const widget = BarWidgetService.getWidgetOnFocusedScreen(widgetId);
if (!widget)
return `WIDGET_NOT_AVAILABLE: ${widgetId}`;
if (widget.popoutTarget?.shouldBeVisible)
return "visible";
return "hidden";
}
target: "widget"
}
}