1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-05 21:15:38 -05:00

settings: fix launcher tab sizing

This commit is contained in:
bbedward
2025-12-04 16:01:07 -05:00
parent f312868154
commit 4291cfe82f

View File

@@ -45,10 +45,14 @@ Item {
Item { Item {
width: parent.width width: parent.width
height: logoModeGroup.implicitHeight height: logoModeGroup.implicitHeight
clip: true
DankButtonGroup { DankButtonGroup {
id: logoModeGroup id: logoModeGroup
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
buttonPadding: parent.width < 480 ? Theme.spacingS : Theme.spacingL
minButtonWidth: parent.width < 480 ? 44 : 64
textSize: parent.width < 480 ? Theme.fontSizeSmall : Theme.fontSizeMedium
model: { model: {
const modes = [I18n.tr("Apps Icon"), I18n.tr("OS Logo"), I18n.tr("Dank")]; const modes = [I18n.tr("Apps Icon"), I18n.tr("OS Logo"), I18n.tr("Dank")];
if (CompositorService.isNiri) { if (CompositorService.isNiri) {
@@ -153,78 +157,88 @@ Item {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
} }
Row { Item {
anchors.horizontalCenter: parent.horizontalCenter width: parent.width
spacing: Theme.spacingM height: colorOverrideRow.implicitHeight
clip: true
DankButtonGroup { Row {
id: colorModeGroup id: colorOverrideRow
model: [I18n.tr("Default"), I18n.tr("Primary"), I18n.tr("Surface"), I18n.tr("Custom")] anchors.horizontalCenter: parent.horizontalCenter
currentIndex: { spacing: Theme.spacingM
const override = SettingsData.launcherLogoColorOverride;
if (override === "") DankButtonGroup {
return 0; id: colorModeGroup
if (override === "primary") buttonPadding: parent.parent.width < 480 ? Theme.spacingS : Theme.spacingL
return 1; minButtonWidth: parent.parent.width < 480 ? 44 : 64
if (override === "surface") textSize: parent.parent.width < 480 ? Theme.fontSizeSmall : Theme.fontSizeMedium
return 2; model: [I18n.tr("Default"), I18n.tr("Primary"), I18n.tr("Surface"), I18n.tr("Custom")]
return 3; currentIndex: {
} const override = SettingsData.launcherLogoColorOverride;
onSelectionChanged: (index, selected) => { if (override === "")
if (!selected) return 0;
return; if (override === "primary")
switch (index) { return 1;
case 0: if (override === "surface")
SettingsData.set("launcherLogoColorOverride", ""); return 2;
break; return 3;
case 1:
SettingsData.set("launcherLogoColorOverride", "primary");
break;
case 2:
SettingsData.set("launcherLogoColorOverride", "surface");
break;
case 3:
const currentOverride = SettingsData.launcherLogoColorOverride;
const isPreset = currentOverride === "" || currentOverride === "primary" || currentOverride === "surface";
if (isPreset) {
SettingsData.set("launcherLogoColorOverride", "#ffffff");
}
break;
} }
} onSelectionChanged: (index, selected) => {
} if (!selected)
Rectangle {
visible: {
const override = SettingsData.launcherLogoColorOverride;
return override !== "" && override !== "primary" && override !== "surface";
}
width: 36
height: 36
radius: 18
color: {
const override = SettingsData.launcherLogoColorOverride;
if (override !== "" && override !== "primary" && override !== "surface") {
return override;
}
return "#ffffff";
}
border.color: Theme.outline
border.width: 1
anchors.verticalCenter: parent.verticalCenter
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
if (!PopoutService.colorPickerModal)
return; return;
PopoutService.colorPickerModal.selectedColor = SettingsData.launcherLogoColorOverride; switch (index) {
PopoutService.colorPickerModal.pickerTitle = I18n.tr("Choose Launcher Logo Color"); case 0:
PopoutService.colorPickerModal.onColorSelectedCallback = function (selectedColor) { SettingsData.set("launcherLogoColorOverride", "");
SettingsData.set("launcherLogoColorOverride", selectedColor); break;
}; case 1:
PopoutService.colorPickerModal.show(); SettingsData.set("launcherLogoColorOverride", "primary");
break;
case 2:
SettingsData.set("launcherLogoColorOverride", "surface");
break;
case 3:
const currentOverride = SettingsData.launcherLogoColorOverride;
const isPreset = currentOverride === "" || currentOverride === "primary" || currentOverride === "surface";
if (isPreset) {
SettingsData.set("launcherLogoColorOverride", "#ffffff");
}
break;
}
}
}
Rectangle {
id: colorPickerCircle
visible: {
const override = SettingsData.launcherLogoColorOverride;
return override !== "" && override !== "primary" && override !== "surface";
}
width: 36
height: 36
radius: 18
color: {
const override = SettingsData.launcherLogoColorOverride;
if (override !== "" && override !== "primary" && override !== "surface")
return override;
return "#ffffff";
}
border.color: Theme.outline
border.width: 1
anchors.verticalCenter: parent.verticalCenter
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
if (!PopoutService.colorPickerModal)
return;
PopoutService.colorPickerModal.selectedColor = SettingsData.launcherLogoColorOverride;
PopoutService.colorPickerModal.pickerTitle = I18n.tr("Choose Launcher Logo Color");
PopoutService.colorPickerModal.onColorSelectedCallback = function (selectedColor) {
SettingsData.set("launcherLogoColorOverride", selectedColor);
};
PopoutService.colorPickerModal.show();
}
} }
} }
} }
@@ -329,28 +343,32 @@ Item {
SettingsToggleRow { SettingsToggleRow {
text: I18n.tr("Close Overview on Launch") text: I18n.tr("Close Overview on Launch")
description: I18n.tr("When enabled, launching an app from the launcher will automatically close the Niri overview if it's open.") description: I18n.tr("Auto-close Niri overview when launching apps.")
checked: SettingsData.spotlightCloseNiriOverview checked: SettingsData.spotlightCloseNiriOverview
onToggled: checked => SettingsData.set("spotlightCloseNiriOverview", checked) onToggled: checked => SettingsData.set("spotlightCloseNiriOverview", checked)
} }
SettingsToggleRow { SettingsToggleRow {
text: I18n.tr("Enable Overview Overlay") text: I18n.tr("Enable Overview Overlay")
description: I18n.tr("When enabled, shows the launcher overlay when typing in Niri overview mode. Disable this if you prefer to not have the launcher when typing on Niri overview or want to use other launcher in the overview.") description: I18n.tr("Show launcher overlay when typing in Niri overview. Disable to use another launcher.")
checked: SettingsData.niriOverviewOverlayEnabled checked: SettingsData.niriOverviewOverlayEnabled
onToggled: checked => SettingsData.set("niriOverviewOverlayEnabled", checked) onToggled: checked => SettingsData.set("niriOverviewOverlayEnabled", checked)
} }
} }
SettingsCard { SettingsCard {
id: recentAppsCard
width: parent.width width: parent.width
iconName: "history" iconName: "history"
title: I18n.tr("Recently Used Apps") title: I18n.tr("Recently Used Apps")
property var rankedAppsModel: { property var rankedAppsModel: {
var ranking = AppUsageHistoryData.appUsageRanking;
if (!ranking)
return [];
var apps = []; var apps = [];
for (var appId in (AppUsageHistoryData.appUsageRanking || {})) { for (var appId in ranking) {
var appData = (AppUsageHistoryData.appUsageRanking || {})[appId]; var appData = ranking[appId];
apps.push({ apps.push({
"id": appId, "id": appId,
"name": appData.name, "name": appData.name,
@@ -401,7 +419,7 @@ Item {
spacing: Theme.spacingS spacing: Theme.spacingS
Repeater { Repeater {
model: parent.parent.rankedAppsModel model: recentAppsCard.rankedAppsModel
delegate: Rectangle { delegate: Rectangle {
width: rankedAppsList.width width: rankedAppsList.width
@@ -496,11 +514,11 @@ Item {
StyledText { StyledText {
width: parent.width width: parent.width
text: parent.parent.rankedAppsModel.length === 0 ? "No apps have been launched yet." : "" text: "No apps have been launched yet."
font.pixelSize: Theme.fontSizeMedium font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceVariantText color: Theme.surfaceVariantText
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
visible: parent.parent.rankedAppsModel.length === 0 visible: recentAppsCard.rankedAppsModel.length === 0
} }
} }
} }