Merge branch 'custom-buttons'

This commit is contained in:
LemmyCook 2025-09-04 08:40:00 -04:00
commit 902cdc39e0
15 changed files with 835 additions and 398 deletions

View file

@ -16,6 +16,7 @@ Singleton {
"Bluetooth": bluetoothComponent,
"Brightness": brightnessComponent,
"Clock": clockComponent,
"CustomButton": customButtonComponent,
"DarkModeToggle": darkModeToggle,
"KeyboardLayout": keyboardLayoutComponent,
"MediaMini": mediaMiniComponent,
@ -33,6 +34,16 @@ Singleton {
"Workspace": workspaceComponent
})
property var widgetMetadata: ({
"CustomButton": {
"allowUserSettings": true,
"icon": "favorite",
"leftClickExec": "",
"rightClickExec": "",
"middleClickExec": ""
}
})
// Component definitions - these are loaded once at startup
property Component activeWindowComponent: Component {
ActiveWindow {}
@ -52,6 +63,9 @@ Singleton {
property Component clockComponent: Component {
Clock {}
}
property Component customButtonComponent: Component {
CustomButton {}
}
property Component darkModeToggle: Component {
DarkModeToggle {}
}
@ -100,20 +114,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") {