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