mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-06-11 16:57:43 +00:00
Right-click a running task icon to pin the app to the dock favourites bar. Pinned apps show a "Remove from Dock" action. The dock overlay renders as a LayerTop window so context menus and the dock itself stay above application windows. Menus use popupType Window to avoid clipping inside the narrow dock surface.
50 lines
1.2 KiB
QML
50 lines
1.2 KiB
QML
// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
|
|
// SPDX-License-Identifier: LGPL-2.0-or-later
|
|
|
|
import QtQuick
|
|
import QtQuick.Window
|
|
import QtQuick.Layouts
|
|
import QtQuick.Templates as T
|
|
|
|
import org.kde.plasma.components 3.0 as PC3
|
|
import org.kde.kirigami as Kirigami
|
|
|
|
Loader {
|
|
id: root
|
|
active: false
|
|
|
|
property list<Kirigami.Action> actions
|
|
property int menuPopupType: T.Popup.Item
|
|
|
|
function open() {
|
|
root.active = true;
|
|
root.item.open();
|
|
}
|
|
|
|
function close() {
|
|
if (root.item) {
|
|
root.item.close();
|
|
}
|
|
}
|
|
|
|
sourceComponent: PC3.Menu {
|
|
id: menu
|
|
title: "Context Menu"
|
|
popupType: root.menuPopupType
|
|
closePolicy: root.menuPopupType === T.Popup.Window
|
|
? (PC3.Menu.CloseOnPressOutside | PC3.Menu.CloseOnEscape)
|
|
: (PC3.Menu.CloseOnReleaseOutside | PC3.Menu.CloseOnEscape)
|
|
|
|
Repeater {
|
|
model: root.actions
|
|
delegate: PC3.MenuItem {
|
|
icon.name: modelData.iconName
|
|
text: modelData.text
|
|
enabled: modelData.enabled
|
|
onClicked: modelData.triggered()
|
|
}
|
|
}
|
|
|
|
onClosed: root.active = false
|
|
}
|
|
}
|