mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +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
|
||||
|
||||
PlasmaCore.FrameSvgItem {
|
||||
id: background
|
||||
imagePath: "widgets/background"
|
||||
enabledBorders: PlasmaCore.FrameSvg.BottomBorder
|
||||
height: childrenRect.height + fixedMargins.top/2 + fixedMargins.bottom
|
||||
Rectangle {
|
||||
id: krunner
|
||||
anchors.fill: parent
|
||||
height: childrenRect.height
|
||||
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 {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
top: parent.top
|
||||
topMargin: background.fixedMargins.top / 2
|
||||
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 ..."
|
||||
clip: true
|
||||
imagePath: "widgets/background"
|
||||
enabledBorders: PlasmaCore.FrameSvg.BottomBorder
|
||||
height: childrenRect.height + fixedMargins.top/2 + fixedMargins.bottom
|
||||
Behavior on height {
|
||||
NumberAnimation {
|
||||
duration: units.longDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
transform: Translate {
|
||||
y: root.locked ? -background.height : 0
|
||||
Behavior on y {
|
||||
NumberAnimation {
|
||||
duration: units.longDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Keys.onReturnPressed: {
|
||||
if (queryField.texr.length == 0)
|
||||
runnerWindow.visible = false;
|
||||
}
|
||||
Keys.onEnterPressed: {
|
||||
if (queryField.texr.length == 0)
|
||||
runnerWindow.visible = false;
|
||||
ColumnLayout {
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
top: parent.top
|
||||
topMargin: background.fixedMargins.top / 2
|
||||
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 int buttonHeight: width/4
|
||||
property bool reorderingApps: false
|
||||
property bool locked: applicationsView.contentY <= -applicationsView.headerItem.height + root.height
|
||||
|
||||
Containment.onAppletAdded: {
|
||||
addApplet(applet, x, y);
|
||||
|
|
@ -143,6 +144,9 @@ MouseEventListener {
|
|||
}
|
||||
|
||||
onPressAndHold: {
|
||||
if (krunner.showingResults) {
|
||||
return;
|
||||
}
|
||||
var pos = mapToItem(applicationsView.headerItem.favoritesStrip, mouse.x, mouse.y);
|
||||
//in favorites area?
|
||||
var item;
|
||||
|
|
@ -220,6 +224,9 @@ MouseEventListener {
|
|||
|
||||
}
|
||||
onReleased: {
|
||||
if (krunner.showingResults) {
|
||||
return;
|
||||
}
|
||||
applicationsView.interactive = true;
|
||||
dragDelegate.xTarget = Math.floor(mouse.x / root.buttonHeight) * root.buttonHeight;
|
||||
dragDelegate.yTarget = Math.floor(mouse.y / root.buttonHeight) * root.buttonHeight;
|
||||
|
|
@ -236,6 +243,9 @@ MouseEventListener {
|
|||
scrollDownIndicator.opacity = 0;
|
||||
}
|
||||
onClicked: {
|
||||
if (krunner.showingResults) {
|
||||
return;
|
||||
}
|
||||
var pos = mapToItem(applicationsView.headerItem.favoritesStrip, mouse.x, mouse.y);
|
||||
|
||||
//in favorites area?
|
||||
|
|
@ -281,6 +291,7 @@ MouseEventListener {
|
|||
id: feedbackWindow
|
||||
}
|
||||
KRunner {
|
||||
id: krunner
|
||||
z: 1000
|
||||
anchors {
|
||||
top: parent.top
|
||||
|
|
|
|||
Loading…
Reference in a new issue