1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 13:32:50 -05:00

Compare commits

...

3 Commits

Author SHA1 Message Date
bbedward
1f2e231386 launcher v2: fix context switch back on empty text field 2026-01-20 21:57:50 -05:00
bbedward
0e7f628c4a launcher v2: improve danksearch context switching behavior 2026-01-20 21:55:05 -05:00
bbedward
553f5257b3 launcher v2: general padding improvements, to more than just launcher v2
but yea
2026-01-20 21:46:02 -05:00
14 changed files with 116 additions and 95 deletions

View File

@@ -15,5 +15,5 @@ Singleton {
readonly property int viewportBuffer: 100
readonly property int extendedBuffer: 200
readonly property int keyboardHintsHeight: 80
readonly property int headerHeight: 40
readonly property int headerHeight: 32
}

View File

@@ -16,8 +16,8 @@ Item {
Column {
anchors.fill: parent
anchors.margins: Theme.spacingL
spacing: Theme.spacingL
anchors.margins: Theme.spacingM
spacing: Theme.spacingM
focus: false
ClipboardHeader {
@@ -195,7 +195,7 @@ Item {
Item {
id: keyboardHintsContainer
width: parent.width
height: modal.showKeyboardHints ? ClipboardConstants.keyboardHintsHeight + Theme.spacingL : 0
height: modal.showKeyboardHints ? ClipboardConstants.keyboardHintsHeight + Theme.spacingM : 0
Behavior on height {
NumberAnimation {
@@ -210,7 +210,7 @@ Item {
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.margins: Theme.spacingL
anchors.margins: Theme.spacingM
visible: modal.showKeyboardHints
wtypeAvailable: modal.wtypeAvailable
}

View File

@@ -11,6 +11,9 @@ Item {
property string searchQuery: ""
property string searchMode: "all"
property string previousSearchMode: "all"
property bool autoSwitchedToFiles: false
property bool isFileSearching: false
property var sections: []
property var flatModel: []
property int selectedFlatIndex: 0
@@ -198,9 +201,15 @@ Item {
}
}
function setMode(mode) {
function setMode(mode, isAutoSwitch) {
if (searchMode === mode)
return;
if (isAutoSwitch) {
previousSearchMode = searchMode;
autoSwitchedToFiles = true;
} else {
autoSwitchedToFiles = false;
}
searchMode = mode;
modeChanged(mode);
performSearch();
@@ -209,6 +218,15 @@ Item {
}
}
function restorePreviousMode() {
if (!autoSwitchedToFiles)
return;
autoSwitchedToFiles = false;
searchMode = previousSearchMode;
modeChanged(previousSearchMode);
performSearch();
}
function cycleMode() {
var modes = ["all", "apps", "files", "plugins"];
var currentIndex = modes.indexOf(searchMode);
@@ -219,6 +237,9 @@ Item {
function reset() {
searchQuery = "";
searchMode = "all";
previousSearchMode = "all";
autoSwitchedToFiles = false;
isFileSearching = false;
sections = [];
flatModel = [];
selectedFlatIndex = 0;
@@ -307,6 +328,8 @@ Item {
clearActivePluginViewPreference();
if (searchMode === "files") {
var fileQuery = searchQuery.startsWith("/") ? searchQuery.substring(1).trim() : searchQuery.trim();
isFileSearching = fileQuery.length >= 2 && DSearchService.dsearchAvailable;
sections = [];
flatModel = [];
selectedFlatIndex = 0;
@@ -482,8 +505,12 @@ Item {
return;
}
if (fileQuery.length < 2)
if (fileQuery.length < 2) {
isFileSearching = false;
return;
}
isFileSearching = true;
var params = {
limit: 20,
fuzzy: true,
@@ -492,6 +519,7 @@ Item {
};
DSearchService.search(fileQuery, params, function (response) {
isFileSearching = false;
if (response.error)
return;
var fileItems = [];

View File

@@ -9,6 +9,8 @@ import qs.Widgets
Item {
id: root
visible: false
property bool spotlightOpen: false
property bool keyboardActive: false
property bool contentVisible: false
@@ -22,8 +24,8 @@ Item {
readonly property real screenHeight: effectiveScreen?.height ?? 1080
readonly property real dpr: effectiveScreen ? CompositorService.getScreenScale(effectiveScreen) : 1
readonly property int baseWidth: SettingsData.dankLauncherV2Size === "medium" ? 600 : SettingsData.dankLauncherV2Size === "large" ? 720 : 500
readonly property int baseHeight: SettingsData.dankLauncherV2Size === "medium" ? 680 : SettingsData.dankLauncherV2Size === "large" ? 820 : 560
readonly property int baseWidth: SettingsData.dankLauncherV2Size === "medium" ? 720 : SettingsData.dankLauncherV2Size === "large" ? 860 : 620
readonly property int baseHeight: SettingsData.dankLauncherV2Size === "medium" ? 720 : SettingsData.dankLauncherV2Size === "large" ? 860 : 600
readonly property int modalWidth: Math.min(baseWidth, screenWidth - 100)
readonly property int modalHeight: Math.min(baseHeight, screenHeight - 100)
readonly property real modalX: (screenWidth - modalWidth) / 2
@@ -165,6 +167,27 @@ Item {
}
}
Connections {
target: Quickshell
function onScreensChanged() {
if (!launcherWindow.screen)
return;
const currentScreenName = launcherWindow.screen.name;
let screenStillExists = false;
for (let i = 0; i < Quickshell.screens.length; i++) {
if (Quickshell.screens[i].name === currentScreenName) {
screenStillExists = true;
break;
}
}
if (screenStillExists)
return;
const newScreen = CompositorService.getFocusedScreen();
if (newScreen)
launcherWindow.screen = newScreen;
}
}
PanelWindow {
id: launcherWindow
visible: true

View File

@@ -134,8 +134,14 @@ FocusScope {
root.parentModal.hide();
return;
case Qt.Key_Backspace:
if (searchField.text.length === 0 && controller.clearPluginFilter())
return;
if (searchField.text.length === 0) {
if (controller.clearPluginFilter())
return;
if (controller.autoSwitchedToFiles) {
controller.restorePreviousMode();
return;
}
}
event.accepted = false;
return;
case Qt.Key_Down:
@@ -247,7 +253,7 @@ FocusScope {
return;
case Qt.Key_Slash:
if (event.modifiers === Qt.NoModifier && searchField.text.length === 0) {
controller.setMode("files");
controller.setMode("files", true);
return;
}
event.accepted = false;
@@ -282,26 +288,22 @@ FocusScope {
{
id: "all",
label: I18n.tr("All"),
icon: "search",
shortcut: "⌃1"
icon: "search"
},
{
id: "apps",
label: I18n.tr("Apps"),
icon: "apps",
shortcut: "⌃2"
icon: "apps"
},
{
id: "files",
label: I18n.tr("Files"),
icon: "folder",
shortcut: "⌃3"
icon: "folder"
},
{
id: "plugins",
label: I18n.tr("Plugins"),
icon: "extension",
shortcut: "⌃4"
icon: "extension"
}
]
@@ -309,7 +311,7 @@ FocusScope {
required property var modelData
required property int index
width: modeButtonMetrics.width + Theme.spacingM * 2
width: modeButtonMetrics.width + 14 + Theme.spacingXS + Theme.spacingM * 2 + Theme.spacingS
height: footerBar.height - 4
radius: Theme.cornerRadius - 2
color: controller.searchMode === modelData.id || modeArea.containsMouse ? Theme.primaryContainer : "transparent"
@@ -317,7 +319,7 @@ FocusScope {
TextMetrics {
id: modeButtonMetrics
font.pixelSize: Theme.fontSizeSmall
text: modelData.label + " " + modelData.shortcut
text: modelData.label
}
Row {
@@ -335,12 +337,6 @@ FocusScope {
font.pixelSize: Theme.fontSizeSmall
color: controller.searchMode === modelData.id ? Theme.primary : Theme.surfaceText
}
StyledText {
text: modelData.shortcut
font.pixelSize: Theme.fontSizeSmall - 2
color: Theme.surfaceVariantText
}
}
MouseArea {
@@ -395,15 +391,13 @@ FocusScope {
Row {
width: parent.width
height: 56
spacing: Theme.spacingS
Rectangle {
id: pluginBadge
visible: controller.activePluginName.length > 0
width: visible ? pluginBadgeContent.implicitWidth + Theme.spacingM : 0
height: 32
anchors.verticalCenter: parent.verticalCenter
height: searchField.height
radius: 16
color: Theme.primary
@@ -439,7 +433,6 @@ FocusScope {
DankTextField {
id: searchField
width: parent.width - (pluginBadge.visible ? pluginBadge.width + Theme.spacingS : 0)
height: 56
cornerRadius: Theme.cornerRadius
backgroundColor: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
normalBorderColor: Theme.outlineMedium
@@ -459,6 +452,9 @@ FocusScope {
onTextChanged: {
controller.setSearchQuery(text);
if (text.length === 0) {
controller.restorePreviousMode();
}
if (actionPanel.expanded) {
actionPanel.hide();
}
@@ -484,7 +480,7 @@ FocusScope {
Item {
width: parent.width
height: parent.height - 56 - actionPanel.height - Theme.spacingM - Theme.spacingXS
height: parent.height - searchField.height - actionPanel.height - Theme.spacingXS * 2
opacity: root.parentModal?.isClosing ? 0 : 1
ResultsList {
@@ -635,7 +631,6 @@ FocusScope {
DankTextField {
id: editNameField
width: parent.width
height: 44
placeholderText: editingApp?.name || ""
keyNavigationTab: editIconField
keyNavigationBacktab: editExtraFlagsField
@@ -656,7 +651,6 @@ FocusScope {
DankTextField {
id: editIconField
width: parent.width
height: 44
placeholderText: editingApp?.icon || ""
keyNavigationTab: editCommentField
keyNavigationBacktab: editNameField
@@ -677,7 +671,6 @@ FocusScope {
DankTextField {
id: editCommentField
width: parent.width
height: 44
placeholderText: editingApp?.comment || ""
keyNavigationTab: editEnvVarsField
keyNavigationBacktab: editIconField
@@ -704,7 +697,6 @@ FocusScope {
DankTextField {
id: editEnvVarsField
width: parent.width
height: 44
placeholderText: "VAR=value"
keyNavigationTab: editExtraFlagsField
keyNavigationBacktab: editCommentField
@@ -725,7 +717,6 @@ FocusScope {
DankTextField {
id: editExtraFlagsField
width: parent.width
height: 44
placeholderText: "--flag --option=value"
keyNavigationTab: editNameField
keyNavigationBacktab: editEnvVarsField

View File

@@ -421,7 +421,7 @@ Item {
Item {
anchors.centerIn: parent
visible: !root.controller?.sections || root.controller.sections.length === 0
visible: (!root.controller?.sections || root.controller.sections.length === 0) && !root.controller?.isFileSearching
width: emptyColumn.implicitWidth
height: emptyColumn.implicitHeight
@@ -437,15 +437,16 @@ Item {
function getEmptyIcon() {
var mode = root.controller?.searchMode ?? "all";
if (mode === "files")
switch (mode) {
case "files":
return "folder_open";
if (mode === "plugins")
case "plugins":
return "extension";
if (mode === "apps")
case "apps":
return "apps";
if (root.controller?.searchQuery?.length > 0)
return "search_off";
return "search";
default:
return root.controller?.searchQuery?.length > 0 ? "search_off" : "search";
}
}
}
@@ -460,7 +461,8 @@ Item {
var mode = root.controller?.searchMode ?? "all";
var hasQuery = root.controller?.searchQuery?.length > 0;
if (mode === "files") {
switch (mode) {
case "files":
if (!DSearchService.dsearchAvailable)
return I18n.tr("File search requires dsearch\nInstall from github.com/morelazers/dsearch");
if (!hasQuery)
@@ -468,20 +470,13 @@ Item {
if (root.controller.searchQuery.length < 2)
return I18n.tr("Type at least 2 characters");
return I18n.tr("No files found");
case "plugins":
return hasQuery ? I18n.tr("No plugin results") : I18n.tr("Browse or search plugins");
case "apps":
return hasQuery ? I18n.tr("No apps found") : I18n.tr("Type to search apps");
default:
return hasQuery ? I18n.tr("No results found") : I18n.tr("Type to search");
}
if (mode === "plugins") {
if (!hasQuery)
return I18n.tr("Browse or search plugins");
return I18n.tr("No plugin results");
}
if (mode === "apps") {
if (!hasQuery)
return I18n.tr("Type to search apps");
return I18n.tr("No apps found");
}
if (hasQuery)
return I18n.tr("No results found");
return I18n.tr("Type to search");
}
}
}

View File

@@ -31,7 +31,7 @@ Rectangle {
Row {
id: leftContent
anchors.left: parent.left
anchors.leftMargin: Theme.spacingS
anchors.leftMargin: Theme.spacingXS
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingS
@@ -61,7 +61,7 @@ Rectangle {
Row {
id: rightContent
anchors.right: parent.right
anchors.rightMargin: Theme.spacingS
anchors.rightMargin: Theme.spacingXS
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingS

View File

@@ -539,7 +539,7 @@ Rectangle {
Item {
width: parent.width - parent.leftPadding - parent.rightPadding
height: Theme.spacingS
height: Theme.spacingXS
}
DankTextField {
@@ -717,7 +717,7 @@ Rectangle {
Item {
width: parent.width - parent.leftPadding - parent.rightPadding
height: Theme.spacingS
height: Theme.spacingXS
visible: !root.searchActive
}

View File

@@ -324,7 +324,6 @@ Item {
anchors.left: parent.left
anchors.right: buttonsContainer.left
anchors.rightMargin: Theme.spacingM
height: 56
cornerRadius: Theme.cornerRadius
backgroundColor: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
normalBorderColor: Theme.outlineMedium
@@ -670,7 +669,6 @@ Item {
DankTextField {
id: editNameField
width: parent.width
height: 44
placeholderText: editingApp?.name || ""
keyNavigationTab: editIconField
keyNavigationBacktab: editExtraFlagsField
@@ -691,7 +689,6 @@ Item {
DankTextField {
id: editIconField
width: parent.width
height: 44
placeholderText: editingApp?.icon || ""
keyNavigationTab: editCommentField
keyNavigationBacktab: editNameField
@@ -712,7 +709,6 @@ Item {
DankTextField {
id: editCommentField
width: parent.width
height: 44
placeholderText: editingApp?.comment || ""
keyNavigationTab: editEnvVarsField
keyNavigationBacktab: editIconField
@@ -739,7 +735,6 @@ Item {
DankTextField {
id: editEnvVarsField
width: parent.width
height: 44
placeholderText: "VAR=value"
keyNavigationTab: editExtraFlagsField
keyNavigationBacktab: editCommentField
@@ -760,7 +755,6 @@ Item {
DankTextField {
id: editExtraFlagsField
width: parent.width
height: 44
placeholderText: "--flag --option=value"
keyNavigationTab: editNameField
keyNavigationBacktab: editEnvVarsField

View File

@@ -398,7 +398,6 @@ DankPopout {
width: parent.width - Theme.spacingS * 2
anchors.horizontalCenter: parent.horizontalCenter
height: 52
cornerRadius: Theme.cornerRadius
backgroundColor: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
normalBorderColor: Theme.outlineMedium
@@ -531,7 +530,7 @@ DankPopout {
x: searchField.x
height: {
let usedHeight = 40 + Theme.spacingS;
usedHeight += 52 + Theme.spacingS;
usedHeight += searchField.height + Theme.spacingS;
usedHeight += appDrawerPopout.searchMode === "apps" ? 40 : 0;
return parent.height - usedHeight;
}
@@ -839,7 +838,6 @@ DankPopout {
DankTextField {
id: editNameField
width: parent.width
height: 44
focus: true
placeholderText: appDrawerPopout.editingApp?.name || ""
keyNavigationTab: editIconField
@@ -861,7 +859,6 @@ DankPopout {
DankTextField {
id: editIconField
width: parent.width
height: 44
placeholderText: appDrawerPopout.editingApp?.icon || ""
keyNavigationTab: editCommentField
keyNavigationBacktab: editNameField
@@ -882,7 +879,6 @@ DankPopout {
DankTextField {
id: editCommentField
width: parent.width
height: 44
placeholderText: appDrawerPopout.editingApp?.comment || ""
keyNavigationTab: editEnvVarsField
keyNavigationBacktab: editIconField
@@ -909,7 +905,6 @@ DankPopout {
DankTextField {
id: editEnvVarsField
width: parent.width
height: 44
placeholderText: "VAR=value"
keyNavigationTab: editExtraFlagsField
keyNavigationBacktab: editCommentField
@@ -930,7 +925,6 @@ DankPopout {
DankTextField {
id: editExtraFlagsField
width: parent.width
height: 44
placeholderText: "--flag --option=value"
keyNavigationTab: editNameField
keyNavigationBacktab: editEnvVarsField

View File

@@ -236,7 +236,6 @@ Item {
DankTextField {
id: searchField
width: parent.width - addButton.width - Theme.spacingM
height: Math.round(Theme.fontSizeMedium * 3)
placeholderText: I18n.tr("Search keybinds...")
leftIconName: "search"
onTextChanged: {

View File

@@ -554,7 +554,6 @@ Item {
DankTextField {
width: parent.width
height: 48
placeholderText: modelData.placeholder
backgroundColor: Theme.withAlpha(Theme.surfaceContainerHighest, Theme.popupTransparency)
normalBorderColor: Theme.outlineMedium

View File

@@ -69,7 +69,6 @@ Item {
DankTextField {
id: updaterCustomCommand
width: parent.width
height: 48
placeholderText: "myPkgMngr --sysupdate"
backgroundColor: Theme.withAlpha(Theme.surfaceContainerHighest, Theme.popupTransparency)
normalBorderColor: Theme.outlineMedium
@@ -114,7 +113,6 @@ Item {
DankTextField {
id: updaterTerminalCustomClass
width: parent.width
height: 48
placeholderText: "-T udpClass"
backgroundColor: Theme.withAlpha(Theme.surfaceContainerHighest, Theme.popupTransparency)
normalBorderColor: Theme.outlineMedium

View File

@@ -35,15 +35,15 @@ StyledRect {
property real cornerRadius: Theme.cornerRadius
readonly property real leftPadding: Theme.spacingM + (leftIconName ? leftIconSize + Theme.spacingM : 0)
readonly property real rightPadding: {
let p = Theme.spacingM;
let p = Theme.spacingS;
if (showPasswordToggle)
p += 24 + Theme.spacingS;
p += 20 + Theme.spacingXS;
if (showClearButton && text.length > 0)
p += 24 + Theme.spacingS;
p += 20 + Theme.spacingXS;
return p;
}
property real topPadding: Theme.spacingM
property real bottomPadding: Theme.spacingM
property real topPadding: Theme.spacingS
property real bottomPadding: Theme.spacingS
property bool ignoreLeftRightKeys: false
property bool ignoreUpDownKeys: false
property bool ignoreTabKeys: false
@@ -76,7 +76,7 @@ StyledRect {
}
width: 200
height: Math.round(Theme.fontSizeMedium * 3.4)
height: Math.round(Theme.fontSizeMedium * 3)
radius: cornerRadius
color: backgroundColor
border.color: textInput.activeFocus ? focusedBorderColor : normalBorderColor
@@ -164,7 +164,7 @@ StyledRect {
id: rightButtonsRow
anchors.right: parent.right
anchors.rightMargin: Theme.spacingM
anchors.rightMargin: Theme.spacingS
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingXS
visible: showPasswordToggle || (showClearButton && text.length > 0)
@@ -172,16 +172,16 @@ StyledRect {
StyledRect {
id: passwordToggleButton
width: 24
height: 24
radius: 12
width: 20
height: 20
radius: 10
color: passwordToggleArea.containsMouse ? Theme.outlineStrong : "transparent"
visible: showPasswordToggle
DankIcon {
anchors.centerIn: parent
name: passwordVisible ? "visibility_off" : "visibility"
size: 16
size: 14
color: passwordToggleArea.containsMouse ? Theme.outline : Theme.surfaceVariantText
}
@@ -198,16 +198,16 @@ StyledRect {
StyledRect {
id: clearButton
width: 24
height: 24
radius: 12
width: 20
height: 20
radius: 10
color: clearArea.containsMouse ? Theme.outlineStrong : "transparent"
visible: showClearButton && text.length > 0
DankIcon {
anchors.centerIn: parent
name: "close"
size: 16
size: 14
color: clearArea.containsMouse ? Theme.outline : Theme.surfaceVariantText
}