forked from Shinonome/dots-hyprland
wbar: add updates indicator
This commit is contained in:
@@ -11,8 +11,10 @@ BarPopup {
|
||||
id: root
|
||||
default property var menuData
|
||||
property var model: [
|
||||
{iconName: "start-here", text: "Start", action: () => {print("hello")}}
|
||||
{ iconName: "start-here", text: "Start", action: () => {print("hello")} },
|
||||
{ type : "separator" },
|
||||
]
|
||||
readonly property bool hasIcons: model.some(item => item.iconName !== undefined && item.iconName !== "")
|
||||
padding: 2
|
||||
|
||||
contentItem: ColumnLayout {
|
||||
@@ -21,18 +23,35 @@ BarPopup {
|
||||
|
||||
Repeater {
|
||||
model: root.model
|
||||
delegate: WButton {
|
||||
id: btn
|
||||
Layout.fillWidth: true
|
||||
delegate: DelegateChooser {
|
||||
role: "type"
|
||||
DelegateChoice {
|
||||
roleValue: "separator"
|
||||
Rectangle {
|
||||
Layout.topMargin: 2
|
||||
Layout.bottomMargin: 2
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: 1
|
||||
color: Looks.colors.bg0Border
|
||||
}
|
||||
}
|
||||
DelegateChoice {
|
||||
roleValue: undefined
|
||||
WButton {
|
||||
id: btn
|
||||
Layout.fillWidth: true
|
||||
|
||||
required property var modelData
|
||||
icon.name: modelData.iconName ? modelData.iconName : ""
|
||||
monochromeIcon: modelData.monochromeIcon ?? true
|
||||
text: modelData.text ? modelData.text : ""
|
||||
required property var modelData
|
||||
forceShowIcon: root.hasIcons
|
||||
icon.name: modelData.iconName ? modelData.iconName : ""
|
||||
monochromeIcon: modelData.monochromeIcon ?? true
|
||||
text: modelData.text ? modelData.text : ""
|
||||
|
||||
onClicked: {
|
||||
if (modelData.action) modelData.action();
|
||||
root.close();
|
||||
onClicked: {
|
||||
if (modelData.action) modelData.action();
|
||||
root.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user