mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
swipe gesture working
This commit is contained in:
parent
55635e5687
commit
434501dcd9
3 changed files with 105 additions and 42 deletions
|
|
@ -31,15 +31,16 @@ PlasmaCore.Dialog {
|
|||
flags: Qt.X11BypassWindowManagerHint
|
||||
backgroundHints: PlasmaCore.Dialog.NoBackground
|
||||
|
||||
function closeWindowList() {
|
||||
hideAnim.running = true;
|
||||
property alias view: view
|
||||
|
||||
function open() {
|
||||
dialog.visible = true;
|
||||
showAnim.restart();
|
||||
}
|
||||
function close() {
|
||||
hideAnim.restart();
|
||||
}
|
||||
|
||||
onVisibleChanged: {
|
||||
if (visible) {
|
||||
showAnim.running = true;
|
||||
}
|
||||
}
|
||||
mainItem: Rectangle {
|
||||
width: workspace.virtualScreenSize.width
|
||||
height: workspace.virtualScreenSize.height
|
||||
|
|
@ -70,8 +71,9 @@ PlasmaCore.Dialog {
|
|||
id: view
|
||||
anchors.fill: parent
|
||||
cacheBuffer: 9999
|
||||
|
||||
cellWidth: units.gridUnit * 20
|
||||
cellHeight: units.gridUnit * 20 // (view.width / view.height)
|
||||
cellHeight: cellWidth / (view.width / view.height) + units.gridUnit * 3
|
||||
model: KWinScripting.ClientModel {
|
||||
id: clientModel
|
||||
exclusions: KWinScripting.ClientModel.NotAcceptingFocusExclusion |
|
||||
|
|
@ -79,7 +81,15 @@ PlasmaCore.Dialog {
|
|||
KWinScripting.ClientModel.DockWindowsExclusion |
|
||||
KWinScripting.ClientModel.SwitchSwitcherExclusion
|
||||
}
|
||||
MouseArea {
|
||||
parent: view.contentItem
|
||||
anchors.fill: parent
|
||||
onClicked: dialog.close()
|
||||
}
|
||||
onMovingChanged: {
|
||||
if (moving) {
|
||||
return;
|
||||
}
|
||||
if (contentY < -view.height/2) {
|
||||
hideAnim.running = true
|
||||
} else if (contentY >= -view.height/2 && contentY < 0) {
|
||||
|
|
@ -93,17 +103,33 @@ PlasmaCore.Dialog {
|
|||
delegate: MouseArea {
|
||||
width: view.cellWidth
|
||||
height: view.cellHeight
|
||||
PlasmaComponents.ToolButton {
|
||||
anchors.right: parent.right
|
||||
iconSource: "window-close"
|
||||
flat: false
|
||||
onClicked: model.client.closeWindow()
|
||||
visible: model.client.closeable
|
||||
}
|
||||
KWinScripting.ThumbnailItem {
|
||||
anchors.fill: parent
|
||||
//parentWindow: dialog.windowId
|
||||
client: model.client
|
||||
Rectangle {
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: units.smallSpacing
|
||||
}
|
||||
radius: 3
|
||||
|
||||
PlasmaComponents.ToolButton {
|
||||
id: closeButton
|
||||
anchors.right: parent.right
|
||||
iconSource: "window-close"
|
||||
onClicked: model.client.closeWindow()
|
||||
visible: model.client.closeable
|
||||
}
|
||||
KWinScripting.ThumbnailItem {
|
||||
anchors {
|
||||
left: parent.left
|
||||
top: parent.top
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
margins: units.smallSpacing
|
||||
topMargin: closeButton.height
|
||||
}
|
||||
//parentWindow: dialog.windowId
|
||||
client: model.client
|
||||
}
|
||||
|
||||
}
|
||||
onClicked: {
|
||||
workspace.activeClient = model.client
|
||||
|
|
@ -23,31 +23,33 @@ import org.kde.kwin 2.0;
|
|||
Item {
|
||||
id: root
|
||||
|
||||
function peekWindowList(amount) {
|
||||
|
||||
switcher.view.contentY = amount;
|
||||
switcher.visible = true;
|
||||
//panelLoader.item.raise();
|
||||
}
|
||||
|
||||
function showWindowList() {
|
||||
if (!mainItemLoader.item) {
|
||||
mainItemLoader.source = "switcher.qml";
|
||||
}
|
||||
mainItemLoader.item.visible = true;
|
||||
panelLoader.item.raise();
|
||||
switcher.open();
|
||||
//panelLoader.item.raise();
|
||||
}
|
||||
|
||||
function closeWindowList() {
|
||||
if (mainItemLoader.item) {
|
||||
mainItemLoader.item.closeWindowList()
|
||||
}
|
||||
switcher.close();
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: mainItemLoader
|
||||
Switcher {
|
||||
id: switcher
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: workspace
|
||||
onCurrentDesktopChanged: {
|
||||
if (!mainItemLoader.item) {
|
||||
if (!switcher) {
|
||||
mainItemLoader.source = "switcher.qml";
|
||||
}
|
||||
mainItemLoader.item.visible = true;
|
||||
switcher.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,38 +28,73 @@ PlasmaCore.Dialog {
|
|||
y: workspace.virtualScreenSize.height - height
|
||||
flags: Qt.X11BypassWindowManagerHint
|
||||
type: PlasmaCore.Dialog.Dock
|
||||
|
||||
backgroundHints: PlasmaCore.Dialog.NoBackground
|
||||
|
||||
mainItem: MouseArea {
|
||||
width: workspace.virtualScreenSize.width
|
||||
height: units.iconSizes.medium
|
||||
property int startY
|
||||
property bool dragging
|
||||
|
||||
|
||||
onPressed: {
|
||||
startY = mouse.y;
|
||||
dragging = false
|
||||
}
|
||||
onPositionChanged: {
|
||||
if (Math.abs(mouse.y - startY) > height) {
|
||||
dragging = true;
|
||||
}
|
||||
if (dragging) {
|
||||
root.peekWindowList(-workspace.virtualScreenSize.height - mouse.y);
|
||||
}
|
||||
}
|
||||
onReleased: {
|
||||
if (dragging) {
|
||||
if (mouse.y < -workspace.virtualScreenSize.height/2) {
|
||||
root.showWindowList();
|
||||
} else {
|
||||
root.closeWindowList();
|
||||
}
|
||||
return;
|
||||
}
|
||||
var button = layout.childAt(mouse.x, mouse.y);
|
||||
print("AAAA"+button.source)
|
||||
if (button) {
|
||||
button.click();
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: theme.backgroundColor
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: layout
|
||||
anchors.fill: parent
|
||||
PlasmaComponents.ToolButton {
|
||||
PlasmaCore.IconItem {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
icon.name: "applications-other"
|
||||
onClicked: root.showWindowList();
|
||||
source: "box"
|
||||
function click() { root.showWindowList();}
|
||||
}
|
||||
|
||||
PlasmaComponents.ToolButton {
|
||||
PlasmaCore.IconItem {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
icon.name: "go-home"
|
||||
onClicked: {
|
||||
source: "start-here-kde"
|
||||
function click() {
|
||||
root.closeWindowList();
|
||||
workspace.slotToggleShowDesktop();
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaComponents.ToolButton {
|
||||
PlasmaCore.IconItem {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
icon.name: "window-close"
|
||||
source: "paint-none"
|
||||
enabled: workspace.activeClient
|
||||
onClicked: workspace.activeClient.closeWindow();
|
||||
function click() { workspace.activeClient.closeWindow();}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue