format and button fix
This commit is contained in:
@@ -22,20 +22,23 @@ Item {
|
||||
|
||||
screen: root.screen
|
||||
visible: LauncherState.open
|
||||
anchors { top: true; bottom: true; left: true; right: true }
|
||||
anchors {
|
||||
top: true
|
||||
bottom: true
|
||||
left: true
|
||||
right: true
|
||||
}
|
||||
exclusionMode: ExclusionMode.Ignore
|
||||
color: "transparent"
|
||||
|
||||
// Grant keyboard focus to this layer surface while open
|
||||
WlrLayershell.keyboardFocus: overlay.visible
|
||||
? WlrKeyboardFocus.Exclusive
|
||||
: WlrKeyboardFocus.None
|
||||
WlrLayershell.keyboardFocus: overlay.visible ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
|
||||
|
||||
onVisibleChanged: {
|
||||
if (visible) {
|
||||
searchField.text = ""
|
||||
selectedIndex = -1
|
||||
searchField.forceActiveFocus()
|
||||
searchField.text = "";
|
||||
selectedIndex = -1;
|
||||
searchField.forceActiveFocus();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,35 +46,40 @@ Item {
|
||||
property int selectedIndex: -1
|
||||
|
||||
readonly property var visibleApps: {
|
||||
const query = searchField.text.toLowerCase()
|
||||
const result = DesktopEntries.applications.values.filter(e =>
|
||||
!e.noDisplay && (!query || e.name.toLowerCase().includes(query)))
|
||||
result.sort((a, b) => a.name.localeCompare(b.name, undefined, { sensitivity: "base" }))
|
||||
return result
|
||||
const query = searchField.text.toLowerCase();
|
||||
const result = DesktopEntries.applications.values.filter(e => !e.noDisplay && (!query || e.name.toLowerCase().includes(query)));
|
||||
result.sort((a, b) => a.name.localeCompare(b.name, undefined, {
|
||||
sensitivity: "base"
|
||||
}));
|
||||
return result;
|
||||
}
|
||||
|
||||
function launchAt(i) {
|
||||
if (i < 0 || i >= visibleApps.length) return
|
||||
visibleApps[i].execute()
|
||||
LauncherState.open = false
|
||||
if (i < 0 || i >= visibleApps.length)
|
||||
return;
|
||||
visibleApps[i].execute();
|
||||
LauncherState.open = false;
|
||||
}
|
||||
|
||||
readonly property int itemHeight: 48
|
||||
onSelectedIndexChanged: {
|
||||
if (selectedIndex < 0) return
|
||||
const top = selectedIndex * itemHeight
|
||||
const bottom = top + itemHeight
|
||||
if (selectedIndex < 0)
|
||||
return;
|
||||
const top = selectedIndex * itemHeight;
|
||||
const bottom = top + itemHeight;
|
||||
if (top < flickable.contentY)
|
||||
flickable.contentY = top
|
||||
flickable.contentY = top;
|
||||
else if (bottom > flickable.contentY + flickable.height)
|
||||
flickable.contentY = bottom - flickable.height
|
||||
flickable.contentY = bottom - flickable.height;
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Qt.rgba(0, 0, 0, 0.55)
|
||||
|
||||
TapHandler { onTapped: LauncherState.open = false }
|
||||
TapHandler {
|
||||
onTapped: LauncherState.open = false
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.centerIn: parent
|
||||
@@ -85,8 +93,18 @@ Item {
|
||||
|
||||
scale: overlay.visible ? 1.0 : 0.92
|
||||
opacity: overlay.visible ? 1.0 : 0.0
|
||||
Behavior on scale { NumberAnimation { duration: 150; easing.type: Easing.OutCubic } }
|
||||
Behavior on opacity { NumberAnimation { duration: 120; easing.type: Easing.OutCubic } }
|
||||
Behavior on scale {
|
||||
NumberAnimation {
|
||||
duration: 150
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: 120
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
@@ -127,16 +145,16 @@ Item {
|
||||
Keys.onEscapePressed: LauncherState.open = false
|
||||
|
||||
Keys.onReturnPressed: {
|
||||
overlay.launchAt(Math.max(overlay.selectedIndex, 0))
|
||||
overlay.launchAt(Math.max(overlay.selectedIndex, 0));
|
||||
}
|
||||
|
||||
Keys.onDownPressed: {
|
||||
const last = overlay.visibleApps.length - 1
|
||||
overlay.selectedIndex = Math.min(overlay.selectedIndex + 1, last)
|
||||
const last = overlay.visibleApps.length - 1;
|
||||
overlay.selectedIndex = Math.min(overlay.selectedIndex + 1, last);
|
||||
}
|
||||
|
||||
Keys.onUpPressed: {
|
||||
overlay.selectedIndex = Math.max(overlay.selectedIndex - 1, -1)
|
||||
overlay.selectedIndex = Math.max(overlay.selectedIndex - 1, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,8 +166,8 @@ Item {
|
||||
|
||||
TapHandler {
|
||||
onTapped: {
|
||||
searchField.text = ""
|
||||
searchField.forceActiveFocus()
|
||||
searchField.text = "";
|
||||
searchField.forceActiveFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -194,9 +212,7 @@ Item {
|
||||
anchors.topMargin: 2
|
||||
anchors.bottomMargin: 2
|
||||
radius: 6
|
||||
color: appItem.isSelected
|
||||
? Colors.accent
|
||||
: appHover.hovered ? Colors.surface : "transparent"
|
||||
color: appItem.isSelected ? Colors.accent : appHover.hovered ? Colors.surface : "transparent"
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
@@ -219,7 +235,9 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
HoverHandler { id: appHover }
|
||||
HoverHandler {
|
||||
id: appHover
|
||||
}
|
||||
TapHandler {
|
||||
onTapped: overlay.launchAt(appItem.index)
|
||||
}
|
||||
@@ -238,7 +256,11 @@ Item {
|
||||
radius: 4
|
||||
color: btnHover.hovered ? Colors.surface : "transparent"
|
||||
|
||||
Behavior on color { ColorAnimation { duration: 80 } }
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: 80
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
@@ -246,12 +268,18 @@ Item {
|
||||
color: overlay.visible ? Colors.accent : Colors.fg
|
||||
font.pixelSize: 16
|
||||
|
||||
Behavior on color { ColorAnimation { duration: 80 } }
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: 80
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HoverHandler { id: btnHover }
|
||||
HoverHandler {
|
||||
id: btnHover
|
||||
}
|
||||
TapHandler {
|
||||
onTapped: LauncherState.toggle()
|
||||
onTapped: LauncherState.open = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user