Custom buttons: WIP implementing custom properties
This commit is contained in:
parent
3ba6899e69
commit
7f34ca4122
7 changed files with 154 additions and 33 deletions
|
|
@ -16,6 +16,7 @@ Singleton {
|
|||
"Bluetooth": bluetoothComponent,
|
||||
"Brightness": brightnessComponent,
|
||||
"Clock": clockComponent,
|
||||
"CustomButton": customButtonComponent,
|
||||
"DarkModeToggle": darkModeToggle,
|
||||
"KeyboardLayout": keyboardLayoutComponent,
|
||||
"MediaMini": mediaMiniComponent,
|
||||
|
|
@ -33,6 +34,15 @@ Singleton {
|
|||
"Workspace": workspaceComponent
|
||||
})
|
||||
|
||||
property var widgetMetadata: ({
|
||||
"CustomButton": {
|
||||
allowUserSettings: true,
|
||||
icon: "favorite",
|
||||
execute: ""
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
// Component definitions - these are loaded once at startup
|
||||
property Component activeWindowComponent: Component {
|
||||
ActiveWindow {}
|
||||
|
|
@ -52,6 +62,9 @@ Singleton {
|
|||
property Component clockComponent: Component {
|
||||
Clock {}
|
||||
}
|
||||
property Component customButtonComponent: Component {
|
||||
CustomButton {}
|
||||
}
|
||||
property Component darkModeToggle: Component {
|
||||
DarkModeToggle {}
|
||||
}
|
||||
|
|
@ -100,20 +113,25 @@ Singleton {
|
|||
|
||||
// ------------------------------
|
||||
// Helper function to get widget component by name
|
||||
function getWidget(name) {
|
||||
return widgets[name] || null
|
||||
function getWidget(id) {
|
||||
return widgets[id] || null
|
||||
}
|
||||
|
||||
// Helper function to check if widget exists
|
||||
function hasWidget(name) {
|
||||
return name in widgets
|
||||
function hasWidget(id) {
|
||||
return id in widgets
|
||||
}
|
||||
|
||||
// Get list of available widget names
|
||||
// Get list of available widget id
|
||||
function getAvailableWidgets() {
|
||||
return Object.keys(widgets)
|
||||
}
|
||||
|
||||
// Helper function to check if widget has user settings
|
||||
function widgetHasUserSettings(id) {
|
||||
return (widgetMetadata[id] !== undefined) && (widgetMetadata[id].allowUserSettings === true)
|
||||
}
|
||||
|
||||
function getNPillDirection(widget) {
|
||||
try {
|
||||
if (widget.barSection === "leftSection") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue