mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-05 20:28:25 +02:00
41 lines
1.2 KiB
QML
41 lines
1.2 KiB
QML
import QtQuick
|
|
import Quickshell.Io
|
|
|
|
// Base item for shell panels. Panels are not bar widgets, but the bar may host
|
|
// or toggle them and injects the same ambient context while doing so. The base
|
|
// owns the shared IPC-backed open/close lifecycle; panel implementations own
|
|
// their button behavior, keyboard navigation, and content.
|
|
Item {
|
|
id: root
|
|
|
|
property QtObject bar: null
|
|
property string moduleName: ""
|
|
property var settings: ({})
|
|
property string ipcTarget: ""
|
|
property bool manageIpc: true
|
|
property alias controller: panelController
|
|
|
|
readonly property bool opened: panelController.open
|
|
|
|
function open() { panelController.show() }
|
|
function close() { panelController.hide() }
|
|
function toggle() { opened ? close() : open() }
|
|
|
|
PanelController {
|
|
id: panelController
|
|
}
|
|
|
|
property IpcHandler _ipc: manageIpc ? ipcComponent.createObject(root) : null
|
|
|
|
property Component ipcComponent: Component {
|
|
IpcHandler {
|
|
target: root.ipcTarget
|
|
function open(): void { root.open() }
|
|
function close(): void { root.close() }
|
|
function show(): void { root.open() }
|
|
function hide(): void { root.close() }
|
|
function toggle(): void { root.toggle() }
|
|
}
|
|
}
|
|
}
|