refactor: redo app launcher

This commit is contained in:
kossLAN 2025-10-16 18:30:10 -04:00
parent f59fe534cf
commit fbd9c212e5
Signed by: kossLAN
SSH key fingerprint: SHA256:bdV0x+wdQHGJ6LgmstH3KV8OpWY+OOFmJcPcB0wQPV8
6 changed files with 134 additions and 99 deletions

View file

@ -15,9 +15,9 @@
(system: fn system nixpkgs.legacyPackages.${system}); (system: fn system nixpkgs.legacyPackages.${system});
in { in {
packages = forEachSystem (system: pkgs: rec { packages = forEachSystem (system: pkgs: rec {
default = minmat; default = dots;
minmat = pkgs.stdenv.mkDerivation { dots = pkgs.stdenv.mkDerivation {
pname = "minmat"; pname = "dots";
version = "0.1.0"; version = "0.1.0";
src = ./shell; src = ./shell;

View file

@ -73,11 +73,11 @@ Variants {
Layout.fillHeight: true Layout.fillHeight: true
} }
VolumeIndicator { // VolumeIndicator {
bar: root // bar: root
Layout.preferredWidth: this.height // Layout.preferredWidth: this.height
Layout.fillHeight: true // Layout.fillHeight: true
} // }
PowerMenu { PowerMenu {
bar: root bar: root

View file

@ -34,44 +34,51 @@ Singleton {
LazyLoader { LazyLoader {
id: loader id: loader
activeAsync: persist.launcherOpen // activeAsync: persist.launcherOpen
active: persist.launcherOpen
PanelWindow { PanelWindow {
implicitWidth: 500
implicitHeight: 7 + searchContainer.implicitHeight + list.topMargin * 2 + list.delegateHeight * 10
color: "transparent" color: "transparent"
exclusiveZone: 0
WlrLayershell.keyboardFocus: WlrKeyboardFocus.Exclusive WlrLayershell.keyboardFocus: WlrKeyboardFocus.Exclusive
// WlrLayershell.namespace: "shell:launcher" // WlrLayershell.namespace: "shell:launcher"
StyledRectangle { anchors {
id: container top: true
bottom: true
left: true
right: true
}
WrapperRectangle {
clip: true
radius: 12
color: ShellSettings.colors.surface_translucent color: ShellSettings.colors.surface_translucent
margin: 6
border {
width: 1
color: ShellSettings.colors.active_translucent
}
anchors { anchors {
fill: parent horizontalCenter: parent.horizontalCenter
margins: 10 top: parent.top
} topMargin: screen.height / 2.75
Behavior on height {
NumberAnimation {
duration: 200
easing.type: Easing.OutCubic
}
} }
ColumnLayout { ColumnLayout {
anchors.fill: parent id: column
anchors.margins: 7 anchors.centerIn: parent
anchors.topMargin: 10
anchors.bottomMargin: 0
spacing: 0
StyledRectangle { StyledRectangle {
id: searchContainer id: searchContainer
Layout.fillWidth: true
implicitHeight: searchbox.implicitHeight + 15 implicitHeight: searchbox.implicitHeight + 15
radius: 6 radius: 6
// Width is largely determined by size of the searchContainer
Layout.preferredWidth: 500
RowLayout { RowLayout {
id: searchbox id: searchbox
anchors.fill: parent anchors.fill: parent
@ -79,8 +86,8 @@ Singleton {
TextInput { TextInput {
id: search id: search
Layout.fillWidth: true
color: ShellSettings.colors.highlight color: ShellSettings.colors.highlight
Layout.fillWidth: true
focus: true focus: true
Keys.forwardTo: [list] Keys.forwardTo: [list]
@ -113,14 +120,41 @@ Singleton {
ListView { ListView {
id: list id: list
Layout.fillWidth: true visible: opacity > 0
Layout.fillHeight: true opacity: matchesLength != 0 ? 1 : 0
clip: true clip: true
cacheBuffer: 0 // works around QTBUG-131106 cacheBuffer: 0 // works around QTBUG-131106
//reuseItems: true //reuseItems: true
Layout.fillWidth: true
Layout.preferredHeight: Math.min(matchesLength * delegateHeight, 500)
Behavior on opacity {
NumberAnimation {
duration: 200
easing.type: Easing.OutCubic
}
}
Behavior on Layout.preferredHeight {
NumberAnimation {
duration: 200
easing.type: Easing.OutCubic
}
}
property var matchesLength: model.values.length
model: ScriptModel { model: ScriptModel {
values: DesktopEntries.applications.values.map(object => { values: {
const stxt = search.text.toLowerCase(); const stxt = search.text.toLowerCase();
if (stxt === '')
return [];
return DesktopEntries.applications.values.map(object => {
// const stxt = search.text.toLowerCase();
const ntxt = object.name.toLowerCase(); const ntxt = object.name.toLowerCase();
let si = 0; let si = 0;
let ni = 0; let ni = 0;
@ -196,14 +230,12 @@ Singleton {
return s; return s;
return a.object.name.localeCompare(b.object.name); return a.object.name.localeCompare(b.object.name);
}).map(entry => entry.object) }).map(entry => entry.object);
}
onValuesChanged: list.currentIndex = 0 onValuesChanged: list.currentIndex = 0
} }
topMargin: 7
bottomMargin: list.count == 0 ? 0 : 7
add: Transition { add: Transition {
NumberAnimation { NumberAnimation {
property: "opacity" property: "opacity"
@ -269,6 +301,7 @@ Singleton {
readonly property real delegateHeight: 44 readonly property real delegateHeight: 44
delegate: MouseArea { delegate: MouseArea {
id: entryMouseArea
required property DesktopEntry modelData required property DesktopEntry modelData
implicitHeight: list.delegateHeight implicitHeight: list.delegateHeight
@ -281,6 +314,7 @@ Singleton {
RowLayout { RowLayout {
id: delegateLayout id: delegateLayout
anchors { anchors {
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
left: parent.left left: parent.left
@ -291,10 +325,11 @@ Singleton {
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
asynchronous: true asynchronous: true
implicitSize: 30 implicitSize: 30
source: Quickshell.iconPath(modelData.icon) source: Quickshell.iconPath(entryMouseArea.modelData.icon)
} }
Text { Text {
text: modelData.name text: entryMouseArea.modelData.name
color: ShellSettings.colors.active color: ShellSettings.colors.active
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
} }

View file

@ -114,8 +114,8 @@ Item {
font.bold: true font.bold: true
elide: Text.ElideRight elide: Text.ElideRight
maximumLineCount: 1 maximumLineCount: 1
Layout.preferredWidth: implicitWidth // Layout.preferredWidth: implicitWidth
Layout.maximumWidth: topRow.width * 0.3 // Layout.maximumWidth: topRow.width * 0.3
} }
Text { Text {

View file

@ -39,7 +39,7 @@ Scope {
onVisibleCountChanged: visible = visibleCount != 0 onVisibleCountChanged: visible = visibleCount != 0
color: "transparent" color: "transparent"
implicitWidth: 525 implicitWidth: 500
visible: false visible: false
exclusionMode: ExclusionMode.Normal exclusionMode: ExclusionMode.Normal