waffles: context menus for app buttons

This commit is contained in:
end-4
2025-12-07 00:04:24 +01:00
parent 13968db31c
commit 6c460b209c
13 changed files with 155 additions and 20 deletions
@@ -14,6 +14,10 @@ import qs.modules.waffle.looks
WButton {
id: root
required property DesktopEntry desktopEntry
property bool pinnedStart: LauncherApps.isPinned(root.desktopEntry.id);
property bool pinnedTaskbar: TaskbarApps.isPinned(root.desktopEntry.id);
implicitWidth: 96
implicitHeight: 84
horizontalPadding: 0
@@ -43,4 +47,52 @@ WButton {
WToolTip {
text: root.desktopEntry.name
}
altAction: () => {
appMenu.popup()
}
WMenu {
id: appMenu
downDirection: true
WMenuItem {
visible: root.pinnedStart
icon.name: "arrow-up-left"
text: Translation.tr("Move to front")
onTriggered: {
LauncherApps.moveToFront(root.desktopEntry.id);
}
}
WMenuItem {
visible: root.pinnedStart
icon.name: "arrow-left"
text: Translation.tr("Move left")
onTriggered: {
LauncherApps.moveLeft(root.desktopEntry.id);
}
}
WMenuItem {
visible: root.pinnedStart
icon.name: "arrow-right"
text: Translation.tr("Move right")
onTriggered: {
LauncherApps.moveRight(root.desktopEntry.id);
}
}
WMenuItem {
icon.name: root.pinnedStart ? "pin-off" : "pin"
text: root.pinnedStart ? Translation.tr("Unpin from Start") : Translation.tr("Pin to Start")
onTriggered: {
LauncherApps.togglePin(root.desktopEntry.id);
}
}
WMenuItem {
icon.name: root.pinnedTaskbar ? "pin-off" : "pin"
text: root.pinnedTaskbar ? Translation.tr("Unpin from taskbar") : Translation.tr("Pin to taskbar")
onTriggered: {
TaskbarApps.togglePin(root.desktopEntry.id);
}
}
}
}