mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-05-23 23:06:56 +00:00
feat: Implement Control Center custom button basic framework
This commit is contained in:
@@ -35,7 +35,8 @@ RowLayout {
|
||||
"widgetId": modelData.id,
|
||||
"section": "quickSettings",
|
||||
"sectionWidgetIndex": index,
|
||||
"sectionWidgetsCount": Settings.data.controlCenter.shortcuts.left.length
|
||||
"sectionWidgetsCount": Settings.data.controlCenter.shortcuts.left.length,
|
||||
"widgetSettings": modelData
|
||||
}
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
}
|
||||
@@ -70,7 +71,8 @@ RowLayout {
|
||||
"widgetId": modelData.id,
|
||||
"section": "quickSettings",
|
||||
"sectionWidgetIndex": index,
|
||||
"sectionWidgetsCount": Settings.data.controlCenter.shortcuts.right.length
|
||||
"sectionWidgetsCount": Settings.data.controlCenter.shortcuts.right.length,
|
||||
"widgetSettings": modelData
|
||||
}
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import qs.Commons
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
// Dummy comment to force re-evaluation
|
||||
Item {
|
||||
id: root
|
||||
|
||||
// Widget properties
|
||||
property string widgetId: "CustomButton"
|
||||
property var widgetSettings: {} // This will be populated from settings
|
||||
|
||||
// Use settings or provide defaults
|
||||
readonly property string customIcon: widgetSettings.icon || "heart"
|
||||
readonly property string exec: widgetSettings.exec || ""
|
||||
readonly property string tooltipText: widgetSettings.tooltipText || "Custom Button"
|
||||
|
||||
implicitWidth: button.implicitWidth
|
||||
implicitHeight: button.implicitHeight
|
||||
|
||||
NIconButton {
|
||||
id: button
|
||||
icon: customIcon
|
||||
tooltipText: tooltipText
|
||||
onClicked: {
|
||||
if (exec) {
|
||||
Quickshell.execDetached(["sh", "-c", exec])
|
||||
Logger.i("CC:CustomButton", `Executing command: ${exec}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user