feat(terra): launcher most-used sort, power buttons, SUPER opens rail

- Launcher sorts by launch count by default (persisted in quickshell's
  state dir); Ctrl+S or the sort chip toggles A–Z.
- Logout/Reboot/Shutdown in the footer, each needing a confirming click.
- SUPER now opens the launcher with the rail expanded; closing the
  launcher collapses the rail again unless it was already open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-25 01:26:44 +02:00
co-authored by Claude Opus 5.5
parent f84611bc6e
commit 896368ef56
5 changed files with 186 additions and 24 deletions
@@ -17,6 +17,10 @@ Item {
property int selectedIndex: 0
property bool showIcons: true
property alias query: searchInput.text
property string sortMode: "usage"
// Power action awaiting its confirming second click; "" when none.
property string armedPower: ""
readonly property var selectedApp: apps.length > 0 && selectedIndex >= 0 && selectedIndex < apps.length
? apps[selectedIndex] : null
@@ -25,9 +29,29 @@ Item {
signal moveRequested(int delta)
signal launchRequested(int index)
signal dismissRequested
signal sortToggleRequested
signal powerRequested(string action)
function focusSearch() { searchInput.forceActiveFocus(); }
function clearSearch() { searchInput.text = ""; }
function disarmPower() { root.armedPower = ""; }
// First click arms, second (within the timeout) fires: a stray click must
// not end the session.
function pressPower(action) {
if (root.armedPower === action) {
root.armedPower = "";
root.powerRequested(action);
} else {
root.armedPower = action;
}
}
Timer {
running: root.armedPower !== ""
interval: 3000
onTriggered: root.disarmPower()
}
implicitWidth: 1080
implicitHeight: 620
@@ -121,6 +145,11 @@ Item {
onTextChanged: root.selectionRequested(0)
Keys.onPressed: event => {
if (event.key === Qt.Key_S && (event.modifiers & Qt.ControlModifier)) {
root.sortToggleRequested();
event.accepted = true;
return;
}
switch (event.key) {
case Qt.Key_Down:
case Qt.Key_Tab:
@@ -162,16 +191,24 @@ Item {
}
}
Rectangle {
MouseArea {
id: sortChip
Layout.preferredWidth: 84
Layout.preferredHeight: 22
color: Theme.accentAlpha(0.12)
border.width: 1
border.color: Theme.hair
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: root.sortToggleRequested()
Rectangle {
anchors.fill: parent
color: sortChip.containsMouse ? Theme.accentAlpha(0.28) : Theme.accentAlpha(0.12)
border.width: 1
border.color: sortChip.containsMouse ? Theme.accent : Theme.hair
}
Text {
anchors.centerIn: parent
text: "LIVE INDEX"
text: root.sortMode === "usage" ? "SORT: USED" : "SORT: A–Z"
color: Theme.accent
font.family: Theme.microFont
font.pixelSize: 7
@@ -191,7 +228,7 @@ Item {
height: 424
panelId: "IDX"
title: "APPLICATION TABLE"
meta: root.query.length > 0 ? "FILTER ACTIVE" : "A–Z / LOCAL"
meta: (root.query.length > 0 ? "FILTER ACTIVE" : "LOCAL") + (root.sortMode === "usage" ? " / MOST USED" : " / A–Z")
ListView {
id: appList
@@ -587,13 +624,46 @@ Item {
KeyHint { keyText: "↑ ↓"; actionText: "SELECT" }
KeyHint { keyText: "ENTER"; actionText: "EXECUTE" }
KeyHint { keyText: "ESC"; actionText: "ABORT" }
KeyHint { keyText: "CTRL+S"; actionText: "SORT" }
Item { Layout.fillWidth: true }
MicroText { text: "QRY:" + (root.query.length > 0 ? "ACTIVE" : "IDLE") }
MicroText { text: "CRC // A7F2" }
Rectangle {
Layout.preferredWidth: 76
Layout.preferredHeight: 4
color: Theme.accent
Rectangle { Layout.preferredWidth: 1; Layout.preferredHeight: 22; color: Theme.hair }
Repeater {
model: [
{ action: "logout", label: "LOGOUT" },
{ action: "reboot", label: "REBOOT" },
{ action: "shutdown", label: "SHUTDOWN" }
]
MouseArea {
id: powerButton
required property var modelData
readonly property bool armed: root.armedPower === modelData.action
Layout.preferredWidth: 96
Layout.preferredHeight: 26
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: root.pressPower(modelData.action)
Rectangle {
anchors.fill: parent
color: powerButton.armed ? Theme.hot : powerButton.containsMouse ? Theme.accentAlpha(0.28) : Theme.accentAlpha(0.10)
border.width: 1
border.color: powerButton.armed ? Theme.hot : powerButton.containsMouse ? Theme.accent : Theme.hair
}
Text {
anchors.centerIn: parent
text: powerButton.armed ? "CONFIRM" : powerButton.modelData.label
color: powerButton.armed ? Theme.surface : Theme.accent
font.family: Theme.microFont
font.pixelSize: 8
font.bold: true
font.letterSpacing: 1
}
}
}
}
}