mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-04 10:44:46 +00:00
darken the screen when results are in
hide on lock screen
This commit is contained in:
parent
5dd2df26de
commit
ec2e95258d
2 changed files with 84 additions and 38 deletions
|
|
@ -29,54 +29,89 @@ import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||||
|
|
||||||
import org.kde.milou 0.1 as Milou
|
import org.kde.milou 0.1 as Milou
|
||||||
|
|
||||||
PlasmaCore.FrameSvgItem {
|
Rectangle {
|
||||||
id: background
|
id: krunner
|
||||||
imagePath: "widgets/background"
|
anchors.fill: parent
|
||||||
enabledBorders: PlasmaCore.FrameSvg.BottomBorder
|
height: childrenRect.height
|
||||||
height: childrenRect.height + fixedMargins.top/2 + fixedMargins.bottom
|
color: listView.visible ? Qt.rgba(0, 0, 0, 0.8) : "transparent"
|
||||||
|
property alias showingResults: listView.visible
|
||||||
|
|
||||||
ColumnLayout {
|
MouseArea {
|
||||||
|
enabled: listView.visible
|
||||||
|
anchors.fill: parent
|
||||||
|
preventStealing: true
|
||||||
|
onClicked: queryField.text = "";
|
||||||
|
}
|
||||||
|
PlasmaCore.FrameSvgItem {
|
||||||
|
id: background
|
||||||
anchors {
|
anchors {
|
||||||
left: parent.left
|
left: parent.left
|
||||||
right: parent.right
|
right: parent.right
|
||||||
top: parent.top
|
top: parent.top
|
||||||
topMargin: background.fixedMargins.top / 2
|
|
||||||
leftMargin: background.fixedMargins.left / 2
|
|
||||||
rightMargin: background.fixedMargins.right / 2
|
|
||||||
}
|
}
|
||||||
PlasmaComponents.TextField {
|
clip: true
|
||||||
id: queryField
|
imagePath: "widgets/background"
|
||||||
clearButtonShown: true
|
enabledBorders: PlasmaCore.FrameSvg.BottomBorder
|
||||||
Layout.fillWidth: true
|
height: childrenRect.height + fixedMargins.top/2 + fixedMargins.bottom
|
||||||
Layout.alignment: Qt.AlignTop
|
Behavior on height {
|
||||||
|
NumberAnimation {
|
||||||
Keys.onEscapePressed: runnerWindow.visible = false
|
duration: units.longDuration
|
||||||
placeholderText: "Search ..."
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
transform: Translate {
|
||||||
Milou.ResultsView {
|
y: root.locked ? -background.height : 0
|
||||||
id: listView
|
Behavior on y {
|
||||||
queryString: queryField.text
|
NumberAnimation {
|
||||||
visible: count > 0
|
duration: units.longDuration
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
Layout.fillWidth: true
|
}
|
||||||
Layout.preferredHeight: listView.contentHeight
|
|
||||||
Layout.alignment: Qt.AlignTop
|
|
||||||
|
|
||||||
onActivated: queryField.text = ""
|
|
||||||
onUpdateQueryString: {
|
|
||||||
queryField.text = text
|
|
||||||
queryField.cursorPosition = cursorPosition
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onReturnPressed: {
|
ColumnLayout {
|
||||||
if (queryField.texr.length == 0)
|
anchors {
|
||||||
runnerWindow.visible = false;
|
left: parent.left
|
||||||
}
|
right: parent.right
|
||||||
Keys.onEnterPressed: {
|
top: parent.top
|
||||||
if (queryField.texr.length == 0)
|
topMargin: background.fixedMargins.top / 2
|
||||||
runnerWindow.visible = false;
|
leftMargin: background.fixedMargins.left / 2
|
||||||
|
rightMargin: background.fixedMargins.right / 2
|
||||||
|
}
|
||||||
|
PlasmaComponents.TextField {
|
||||||
|
id: queryField
|
||||||
|
clearButtonShown: true
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
|
||||||
|
Keys.onEscapePressed: runnerWindow.visible = false
|
||||||
|
placeholderText: "Search ..."
|
||||||
|
}
|
||||||
|
|
||||||
|
Milou.ResultsView {
|
||||||
|
id: listView
|
||||||
|
queryString: queryField.text
|
||||||
|
visible: count > 0
|
||||||
|
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: listView.contentHeight
|
||||||
|
Layout.alignment: Qt.AlignTop
|
||||||
|
|
||||||
|
onActivated: queryField.text = ""
|
||||||
|
onUpdateQueryString: {
|
||||||
|
queryField.text = text
|
||||||
|
queryField.cursorPosition = cursorPosition
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Keys.onReturnPressed: {
|
||||||
|
if (queryField.texr.length == 0)
|
||||||
|
runnerWindow.visible = false;
|
||||||
|
}
|
||||||
|
Keys.onEnterPressed: {
|
||||||
|
if (queryField.texr.length == 0)
|
||||||
|
runnerWindow.visible = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ MouseEventListener {
|
||||||
property alias appletsSpace: applicationsView.headerItem
|
property alias appletsSpace: applicationsView.headerItem
|
||||||
property int buttonHeight: width/4
|
property int buttonHeight: width/4
|
||||||
property bool reorderingApps: false
|
property bool reorderingApps: false
|
||||||
|
property bool locked: applicationsView.contentY <= -applicationsView.headerItem.height + root.height
|
||||||
|
|
||||||
Containment.onAppletAdded: {
|
Containment.onAppletAdded: {
|
||||||
addApplet(applet, x, y);
|
addApplet(applet, x, y);
|
||||||
|
|
@ -143,6 +144,9 @@ MouseEventListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
onPressAndHold: {
|
onPressAndHold: {
|
||||||
|
if (krunner.showingResults) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
var pos = mapToItem(applicationsView.headerItem.favoritesStrip, mouse.x, mouse.y);
|
var pos = mapToItem(applicationsView.headerItem.favoritesStrip, mouse.x, mouse.y);
|
||||||
//in favorites area?
|
//in favorites area?
|
||||||
var item;
|
var item;
|
||||||
|
|
@ -220,6 +224,9 @@ MouseEventListener {
|
||||||
|
|
||||||
}
|
}
|
||||||
onReleased: {
|
onReleased: {
|
||||||
|
if (krunner.showingResults) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
applicationsView.interactive = true;
|
applicationsView.interactive = true;
|
||||||
dragDelegate.xTarget = Math.floor(mouse.x / root.buttonHeight) * root.buttonHeight;
|
dragDelegate.xTarget = Math.floor(mouse.x / root.buttonHeight) * root.buttonHeight;
|
||||||
dragDelegate.yTarget = Math.floor(mouse.y / root.buttonHeight) * root.buttonHeight;
|
dragDelegate.yTarget = Math.floor(mouse.y / root.buttonHeight) * root.buttonHeight;
|
||||||
|
|
@ -236,6 +243,9 @@ MouseEventListener {
|
||||||
scrollDownIndicator.opacity = 0;
|
scrollDownIndicator.opacity = 0;
|
||||||
}
|
}
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
if (krunner.showingResults) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
var pos = mapToItem(applicationsView.headerItem.favoritesStrip, mouse.x, mouse.y);
|
var pos = mapToItem(applicationsView.headerItem.favoritesStrip, mouse.x, mouse.y);
|
||||||
|
|
||||||
//in favorites area?
|
//in favorites area?
|
||||||
|
|
@ -281,6 +291,7 @@ MouseEventListener {
|
||||||
id: feedbackWindow
|
id: feedbackWindow
|
||||||
}
|
}
|
||||||
KRunner {
|
KRunner {
|
||||||
|
id: krunner
|
||||||
z: 1000
|
z: 1000
|
||||||
anchors {
|
anchors {
|
||||||
top: parent.top
|
top: parent.top
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue