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

General code cleanups

This commit is contained in:
bbedward
2025-08-02 16:18:12 -04:00
parent 2cf7497324
commit 599118c63e
68 changed files with 102 additions and 1241 deletions

View File

@@ -20,7 +20,6 @@ ScrollView {
topPadding: Theme.spacingL
bottomPadding: Theme.spacingXL
// Display Settings Section
StyledRect {
width: parent.width
height: displaySection.implicitHeight + Theme.spacingL * 2
@@ -91,7 +90,6 @@ ScrollView {
popupWidthOffset: 100
maxPopupHeight: 400
options: {
// Force refresh of icon themes to prevent stale data
Prefs.detectAvailableIconThemes();
return Prefs.availableIconThemes;
}
@@ -108,7 +106,6 @@ ScrollView {
text: "Font Family"
description: "Select system font family"
currentValue: {
// Always show the font name in parentheses for clarity
if (Prefs.fontFamily === Prefs.defaultFontFamily)
return "Default (" + Prefs.defaultFontFamily + ")";
else
@@ -122,19 +119,15 @@ ScrollView {
var availableFonts = Qt.fontFamilies();
var rootFamilies = [];
var seenFamilies = new Set();
// Filter to root family names by removing common weight/style suffixes
for (var i = 0; i < availableFonts.length; i++) {
var fontName = availableFonts[i];
// Skip fonts beginning with . (like .AppleSystem)
if (fontName.startsWith("."))
continue;
// Skip the default font since we already added it as recommended
if (fontName === Prefs.defaultFontFamily)
continue;
var rootName = fontName.replace(/ (Thin|Extra Light|Light|Regular|Medium|Semi Bold|Demi Bold|Bold|Extra Bold|Black|Heavy)$/i, "").replace(/ (Italic|Oblique|Condensed|Extended|Narrow|Wide)$/i, "").replace(/ (UI|Display|Text|Mono|Sans|Serif)$/i, function(match, suffix) {
// Keep these suffixes as they're part of the family name
return match;
}).trim();
if (!seenFamilies.has(rootName) && rootName !== "") {
@@ -237,18 +230,14 @@ ScrollView {
var availableFonts = Qt.fontFamilies();
var monoFamilies = [];
var seenFamilies = new Set();
// Filter to likely monospace fonts
for (var i = 0; i < availableFonts.length; i++) {
var fontName = availableFonts[i];
// Skip fonts beginning with .
if (fontName.startsWith("."))
continue;
// Skip the default mono font since we already added it as recommended
if (fontName === Prefs.defaultMonoFontFamily)
continue;
// Look for common monospace indicators
var lowerName = fontName.toLowerCase();
if (lowerName.includes("mono") || lowerName.includes("code") || lowerName.includes("console") || lowerName.includes("terminal") || lowerName.includes("courier") || lowerName.includes("dejavu sans mono") || lowerName.includes("jetbrains") || lowerName.includes("fira") || lowerName.includes("hack") || lowerName.includes("source code") || lowerName.includes("ubuntu mono") || lowerName.includes("cascadia")) {
var rootName = fontName.replace(/ (Thin|Extra Light|Light|Regular|Medium|Semi Bold|Demi Bold|Bold|Extra Bold|Black|Heavy)$/i, "").replace(/ (Italic|Oblique|Condensed|Extended|Narrow|Wide)$/i, "").trim();
@@ -272,7 +261,6 @@ ScrollView {
}
// Transparency Settings Section
StyledRect {
width: parent.width
height: transparencySection.implicitHeight + Theme.spacingL * 2
@@ -391,7 +379,6 @@ ScrollView {
}
// Theme Picker Section
StyledRect {
width: parent.width
height: themeSection.implicitHeight + Theme.spacingL * 2
@@ -458,12 +445,10 @@ ScrollView {
}
// Theme Grid
Column {
spacing: Theme.spacingS
anchors.horizontalCenter: parent.horizontalCenter
// First row - Blue, Deep Blue, Purple, Green, Orange
Row {
spacing: Theme.spacingM
anchors.horizontalCenter: parent.horizontalCenter
@@ -480,7 +465,6 @@ ScrollView {
border.width: (Theme.currentThemeIndex === index && !Theme.isDynamicTheme) ? 2 : 1
scale: (Theme.currentThemeIndex === index && !Theme.isDynamicTheme) ? 1.1 : 1
// Theme name tooltip
Rectangle {
width: nameText.contentWidth + Theme.spacingS * 2
height: nameText.contentHeight + Theme.spacingXS * 2
@@ -537,7 +521,6 @@ ScrollView {
}
// Second row - Red, Cyan, Pink, Amber, Coral
Row {
spacing: Theme.spacingM
anchors.horizontalCenter: parent.horizontalCenter
@@ -557,7 +540,6 @@ ScrollView {
visible: themeIndex < Theme.themes.length
scale: Theme.currentThemeIndex === themeIndex ? 1.1 : 1
// Theme name tooltip
Rectangle {
width: nameText2.contentWidth + Theme.spacingS * 2
height: nameText2.contentHeight + Theme.spacingXS * 2
@@ -616,13 +598,11 @@ ScrollView {
}
// Spacer
Item {
width: 1
height: Theme.spacingM
}
// Auto theme button
Rectangle {
width: 120
height: 40
@@ -704,7 +684,6 @@ ScrollView {
}
}
// Tooltip for Auto button
Rectangle {
width: autoTooltipText.contentWidth + Theme.spacingM * 2
height: autoTooltipText.contentHeight + Theme.spacingS * 2
@@ -768,7 +747,6 @@ ScrollView {
}
// System App Theming Section
StyledRect {
width: parent.width
height: systemThemingSection.implicitHeight + Theme.spacingL * 2
@@ -840,17 +818,15 @@ ScrollView {
}
// Night mode processes
Process {
id: nightModeEnableProcess
command: ["bash", "-c", "if command -v wlsunset > /dev/null; then pkill wlsunset; wlsunset -t 3000 & elif command -v redshift > /dev/null; then pkill redshift; redshift -P -O 3000 & else echo 'No night mode tool available'; fi"]
running: false
onExited: (exitCode) => {
if (exitCode !== 0) {
console.warn("Failed to enable night mode");
Prefs.setNightModeEnabled(false);
}
if (exitCode !== 0)
Prefs.setNightModeEnabled(true);
}
}
@@ -861,7 +837,7 @@ ScrollView {
running: false
onExited: (exitCode) => {
if (exitCode !== 0)
console.warn("Failed to disable night mode");
Prefs.setNightModeEnabled(false);
}
}

View File

@@ -22,7 +22,6 @@ ScrollView {
width: parent.width
spacing: Theme.spacingXL
// Profile Section
StyledRect {
width: parent.width
height: profileSection.implicitHeight + Theme.spacingL * 2
@@ -63,7 +62,6 @@ ScrollView {
width: parent.width
spacing: Theme.spacingL
// Circular profile image preview
Item {
id: avatarContainer
@@ -264,7 +262,6 @@ ScrollView {
}
// Wallpaper Section
StyledRect {
width: parent.width
height: wallpaperSection.implicitHeight + Theme.spacingL * 2
@@ -305,7 +302,6 @@ ScrollView {
width: parent.width
spacing: Theme.spacingL
// Wallpaper Preview
StyledRect {
width: 160
height: 90
@@ -463,7 +459,6 @@ ScrollView {
}
// Dynamic Theming Section
StyledRect {
width: parent.width
height: dynamicThemeSection.implicitHeight + Theme.spacingL * 2

View File

@@ -22,7 +22,6 @@ Column {
}
// Section header
MouseArea {
width: parent.width
height: headerRow.height
@@ -85,7 +84,6 @@ Column {
}
// Divider
Rectangle {
width: parent.width
height: 1
@@ -93,7 +91,6 @@ Column {
visible: expanded || !collapsible
}
// Content
Loader {
id: contentLoader

View File

@@ -15,7 +15,6 @@ ScrollView {
width: parent.width
spacing: Theme.spacingXL
// Time Settings Section
StyledRect {
width: parent.width
height: timeSection.implicitHeight + Theme.spacingL * 2
@@ -66,7 +65,6 @@ ScrollView {
}
// Weather Settings Section
StyledRect {
width: parent.width
height: weatherSection.implicitHeight + Theme.spacingL * 2

View File

@@ -91,7 +91,6 @@ ScrollView {
"icon": "remove",
"enabled": true
}]
// Default widget configurations for each section (with enabled states)
property var defaultLeftWidgets: [{
"id": "launcherButton",
"enabled": true
@@ -295,7 +294,6 @@ ScrollView {
if (!Prefs.topBarRightWidgets || Prefs.topBarRightWidgets.length === 0)
Prefs.setTopBarRightWidgets(defaultRightWidgets);
// Ensure existing spacers have default sizes
["left", "center", "right"].forEach((sectionId) => {
var widgets = [];
if (sectionId === "left")
@@ -334,7 +332,6 @@ ScrollView {
topPadding: Theme.spacingL
bottomPadding: Theme.spacingXL
// Header section
Row {
width: parent.width
spacing: Theme.spacingM
@@ -446,12 +443,10 @@ ScrollView {
}
// Widget sections
Column {
width: parent.width
spacing: Theme.spacingL
// Left Section
DankSections {
width: parent.width
title: "Left Section"
@@ -478,7 +473,6 @@ ScrollView {
}
}
// Center Section
DankSections {
width: parent.width
title: "Center Section"
@@ -505,7 +499,6 @@ ScrollView {
}
}
// Right Section
DankSections {
width: parent.width
title: "Right Section"
@@ -534,7 +527,6 @@ ScrollView {
}
// Workspace Section
StyledRect {
width: parent.width
height: workspaceSection.implicitHeight + Theme.spacingL * 2
@@ -597,7 +589,6 @@ ScrollView {
}
// Tooltip for reset button (positioned above the button)
Rectangle {
width: tooltipText.contentWidth + Theme.spacingM * 2
height: tooltipText.contentHeight + Theme.spacingS * 2
@@ -630,7 +621,6 @@ ScrollView {
}
// Widget selection popup
DankWidgetSelectionPopup {
id: widgetSelectionPopup