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

fix loader patterns in settings

- fix matugen command
- fix focused window being wrong sometimes
This commit is contained in:
bbedward
2025-08-12 23:31:58 -04:00
parent 6e92df95e9
commit bbd23171cc
9 changed files with 2957 additions and 3105 deletions

View File

@@ -29,7 +29,6 @@ Singleton {
property bool gtkThemingEnabled: false property bool gtkThemingEnabled: false
property bool qtThemingEnabled: false property bool qtThemingEnabled: false
property bool systemThemeGenerationInProgress: false property bool systemThemeGenerationInProgress: false
property string matugenJson: ""
property var matugenColors: ({}) property var matugenColors: ({})
property bool extractionRequested: false property bool extractionRequested: false
property int colorUpdateTrigger: 0 property int colorUpdateTrigger: 0
@@ -141,51 +140,33 @@ Singleton {
Process { Process {
id: matugenProcess id: matugenProcess
command: ["matugen", "-v", "image", wallpaperPath, "--json", "hex"] command: ["matugen", "image", wallpaperPath, "--json", "hex"]
stdout: StdioCollector { stdout: StdioCollector {
id: matugenCollector id: matugenCollector
onStreamFinished: { onStreamFinished: {
const out = matugenCollector.text if (!matugenCollector.text) {
const startIndex = out.indexOf('{')
const endIndex = out.lastIndexOf('}')
let jsonStringOnly = ""
if (startIndex !== -1 && endIndex !== -1 && endIndex > startIndex) {
jsonStringOnly = out.substring(startIndex, endIndex + 1)
}
if (!jsonStringOnly.length) {
ToastService.wallpaperErrorStatus = "error" ToastService.wallpaperErrorStatus = "error"
ToastService.showError("Wallpaper Processing Failed: Empty JSON extracted from matugen output.") ToastService.showError("Wallpaper Processing Failed: Empty JSON extracted from matugen output.")
return return
} }
try { try {
root.matugenJson = jsonStringOnly root.matugenColors = JSON.parse(matugenCollector.text)
root.matugenColors = JSON.parse(jsonStringOnly)
root.colorsUpdated() root.colorsUpdated()
generateAppConfigs() generateAppConfigs()
ToastService.clearWallpaperError() ToastService.clearWallpaperError()
} catch (e) { } catch (e) {
ToastService.wallpaperErrorStatus = "error" ToastService.wallpaperErrorStatus = "error"
const stderr = matugenErr.text ToastService.showError("Wallpaper processing failed (JSON parse error after extraction)")
const msg = "Wallpaper processing failed (JSON parse error after extraction)"
+ (stderr ? `: ${stderr}` : ` with output: ${jsonStringOnly}`)
ToastService.showError(msg)
} }
} }
} }
stderr: StdioCollector {
id: matugenErr
}
onExited: code => { onExited: code => {
if (code !== 0) { if (code !== 0) {
ToastService.wallpaperErrorStatus = "error" ToastService.wallpaperErrorStatus = "error"
const stderr = matugenErr.text ToastService.showError("Matugen command failed with exit code " + code)
const msg = "Matugen command failed with exit code " + code
+ (stderr ? `: ${stderr}` : ". No stderr output.")
ToastService.showError(msg)
} }
} }
} }

View File

@@ -121,16 +121,18 @@ DankModal {
color: "transparent" color: "transparent"
Loader { Loader {
id: personalizationLoader
anchors.fill: parent anchors.fill: parent
active: settingsTabBar.currentIndex === 0 active: settingsTabBar.currentIndex === 0
visible: active visible: active
asynchronous: false asynchronous: true
sourceComponent: Component { sourceComponent: Component {
PersonalizationTab {} PersonalizationTab {}
} }
} }
Loader { Loader {
id: timeWeatherLoader
anchors.fill: parent anchors.fill: parent
active: settingsTabBar.currentIndex === 1 active: settingsTabBar.currentIndex === 1
visible: active visible: active
@@ -141,6 +143,7 @@ DankModal {
} }
Loader { Loader {
id: widgetsLoader
anchors.fill: parent anchors.fill: parent
active: settingsTabBar.currentIndex === 2 active: settingsTabBar.currentIndex === 2
visible: active visible: active
@@ -151,6 +154,7 @@ DankModal {
} }
Loader { Loader {
id: launcherLoader
anchors.fill: parent anchors.fill: parent
active: settingsTabBar.currentIndex === 3 active: settingsTabBar.currentIndex === 3
visible: active visible: active
@@ -161,10 +165,11 @@ DankModal {
} }
Loader { Loader {
id: appearanceLoader
anchors.fill: parent anchors.fill: parent
active: settingsTabBar.currentIndex === 4 active: settingsTabBar.currentIndex === 4
visible: active visible: active
asynchronous: false asynchronous: true
sourceComponent: Component { sourceComponent: Component {
AppearanceTab {} AppearanceTab {}
} }

View File

@@ -175,5 +175,53 @@ Rectangle {
} }
} }
} }
Rectangle {
width: parent.width
height: 1
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.1)
}
Item {
width: parent.width
height: 36
Row {
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingM
DankIcon {
name: "notifications_active"
size: Theme.iconSizeSmall
color: SettingsData.notificationOverlayEnabled ? Theme.primary : Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
}
Column {
spacing: 2
anchors.verticalCenter: parent.verticalCenter
StyledText {
text: "Notification Overlay"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText
}
StyledText {
text: "Display all priorities over fullscreen apps"
font.pixelSize: Theme.fontSizeSmall - 1
color: Theme.surfaceVariantText
}
}
}
DankToggle {
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
checked: SettingsData.notificationOverlayEnabled
onToggled: (toggled) => SettingsData.setNotificationOverlayEnabled(toggled)
}
}
} }
} }

View File

@@ -21,37 +21,7 @@ Item {
width: parent.width width: parent.width
spacing: Theme.spacingXL spacing: Theme.spacingXL
Loader { // Display Settings
width: parent.width
sourceComponent: displayComponent
}
Loader {
width: parent.width
sourceComponent: transparencyComponent
}
Loader {
width: parent.width
sourceComponent: cornerRadiusComponent
}
Loader {
width: parent.width
sourceComponent: themeComponent
}
Loader {
width: parent.width
sourceComponent: systemThemingComponent
}
}
}
// Display Settings Component
Component {
id: displayComponent
StyledRect { StyledRect {
width: parent.width width: parent.width
height: displaySection.implicitHeight + Theme.spacingL * 2 height: displaySection.implicitHeight + Theme.spacingL * 2
@@ -315,12 +285,8 @@ Item {
} }
} }
} }
}
// Transparency Settings Component
Component {
id: transparencyComponent
// Transparency Settings
StyledRect { StyledRect {
width: parent.width width: parent.width
height: transparencySection.implicitHeight + Theme.spacingL * 2 height: transparencySection.implicitHeight + Theme.spacingL * 2
@@ -437,12 +403,73 @@ Item {
} }
} }
} }
// Corner Radius
StyledRect {
width: parent.width
height: cornerRadiusSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1
Column {
id: cornerRadiusSection
anchors.fill: parent
anchors.margins: Theme.spacingL
spacing: Theme.spacingM
Row {
width: parent.width
spacing: Theme.spacingM
DankIcon {
name: "rounded_corner"
size: Theme.iconSize
color: Theme.primary
anchors.verticalCenter: parent.verticalCenter
} }
// Theme Color Component StyledText {
Component { text: "Corner Radius"
id: themeComponent font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Medium
color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
}
}
Column {
width: parent.width
spacing: Theme.spacingS
StyledText {
text: "Bar & Widget Corner Roundness"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText
font.weight: Font.Medium
}
DankSlider {
width: parent.width
height: 24
value: SettingsData.cornerRadius
minimum: 0
maximum: 32
unit: ""
showValue: true
onSliderValueChanged: newValue => {
SettingsData.setCornerRadius(newValue)
}
}
}
}
}
// Theme Color
StyledRect { StyledRect {
width: parent.width width: parent.width
height: themeSection.implicitHeight + Theme.spacingL * 2 height: themeSection.implicitHeight + Theme.spacingL * 2
@@ -806,81 +833,8 @@ Item {
} }
} }
} }
}
// Corner Radius Component
Component {
id: cornerRadiusComponent
StyledRect {
width: parent.width
height: cornerRadiusSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1
Column {
id: cornerRadiusSection
anchors.fill: parent
anchors.margins: Theme.spacingL
spacing: Theme.spacingM
Row {
width: parent.width
spacing: Theme.spacingM
DankIcon {
name: "rounded_corner"
size: Theme.iconSize
color: Theme.primary
anchors.verticalCenter: parent.verticalCenter
}
StyledText {
text: "Corner Radius"
font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Medium
color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
}
}
Column {
width: parent.width
spacing: Theme.spacingS
StyledText {
text: "Bar & Widget Corner Roundness"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText
font.weight: Font.Medium
}
DankSlider {
width: parent.width
height: 24
value: SettingsData.cornerRadius
minimum: 0
maximum: 32
unit: ""
showValue: true
onSliderValueChanged: newValue => {
SettingsData.setCornerRadius(newValue)
}
}
}
}
}
}
// System App Theming Component
Component {
id: systemThemingComponent
// System App Theming
StyledRect { StyledRect {
width: parent.width width: parent.width
height: systemThemingSection.implicitHeight + Theme.spacingL * 2 height: systemThemingSection.implicitHeight + Theme.spacingL * 2
@@ -947,6 +901,8 @@ Item {
} }
} }
} }
}
Process { Process {
id: nightModeEnableProcess id: nightModeEnableProcess

View File

@@ -20,27 +20,6 @@ Item {
width: parent.width width: parent.width
spacing: Theme.spacingXL spacing: Theme.spacingXL
Loader {
width: parent.width
sourceComponent: appLauncherComponent
}
Loader {
width: parent.width
sourceComponent: dockComponent
}
Loader {
width: parent.width
sourceComponent: recentlyUsedComponent
}
}
}
// App Launcher Component
Component {
id: appLauncherComponent
StyledRect { StyledRect {
width: parent.width width: parent.width
height: appLauncherSection.implicitHeight + Theme.spacingL * 2 height: appLauncherSection.implicitHeight + Theme.spacingL * 2
@@ -167,11 +146,6 @@ Item {
} }
} }
} }
}
// Dock Component
Component {
id: dockComponent
StyledRect { StyledRect {
width: parent.width width: parent.width
@@ -275,11 +249,6 @@ Item {
} }
} }
} }
}
// Recently Used Apps Component
Component {
id: recentlyUsedComponent
StyledRect { StyledRect {
width: parent.width width: parent.width
@@ -498,4 +467,6 @@ Item {
} }
} }
} }
}
} }

View File

@@ -15,7 +15,7 @@ Item {
Component.onCompleted: { Component.onCompleted: {
// Access WallpaperCyclingService to ensure it's initialized // Access WallpaperCyclingService to ensure it's initialized
WallpaperCyclingService.cyclingActive WallpaperCyclingService.cyclingActive;
} }
DankFlickable { DankFlickable {
@@ -28,48 +28,17 @@ Item {
Column { Column {
id: mainColumn id: mainColumn
width: parent.width width: parent.width
spacing: Theme.spacingXL spacing: Theme.spacingXL
Loader { // Profile Image Section
width: parent.width
sourceComponent: profileComponent
}
Loader {
width: parent.width
sourceComponent: wallpaperComponent
}
Loader {
width: parent.width
sourceComponent: dynamicThemeComponent
}
Loader {
width: parent.width
sourceComponent: topBarAutoHideComponent
}
Loader {
width: parent.width
sourceComponent: notificationOverlayComponent
}
}
}
// Profile Image Component
Component {
id: profileComponent
StyledRect { StyledRect {
width: parent.width width: parent.width
height: profileSection.implicitHeight + Theme.spacingL * 2 height: profileSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3)
Theme.surfaceVariant.b, 0.3) border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
Column { Column {
@@ -97,6 +66,7 @@ Item {
color: Theme.surfaceText color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
Row { Row {
@@ -125,12 +95,12 @@ Item {
source: { source: {
if (PortalService.profileImage === "") if (PortalService.profileImage === "")
return "" return "";
if (PortalService.profileImage.startsWith("/")) if (PortalService.profileImage.startsWith("/"))
return "file://" + PortalService.profileImage return "file://" + PortalService.profileImage;
return PortalService.profileImage return PortalService.profileImage;
} }
smooth: true smooth: true
asynchronous: true asynchronous: true
@@ -165,6 +135,7 @@ Item {
color: "black" color: "black"
antialiasing: true antialiasing: true
} }
} }
Rectangle { Rectangle {
@@ -179,6 +150,7 @@ Item {
size: Theme.iconSizeLarge + 8 size: Theme.iconSizeLarge + 8
color: Theme.primaryText color: Theme.primaryText
} }
} }
DankIcon { DankIcon {
@@ -186,9 +158,9 @@ Item {
name: "warning" name: "warning"
size: Theme.iconSizeLarge size: Theme.iconSizeLarge
color: Theme.error color: Theme.error
visible: PortalService.profileImage !== "" visible: PortalService.profileImage !== "" && avatarImageSource.status === Image.Error
&& avatarImageSource.status === Image.Error
} }
} }
Column { Column {
@@ -197,9 +169,7 @@ Item {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
StyledText { StyledText {
text: PortalService.profileImage ? PortalService.profileImage.split( text: PortalService.profileImage ? PortalService.profileImage.split('/').pop() : "No profile image selected"
'/').pop(
) : "No profile image selected"
font.pixelSize: Theme.fontSizeLarge font.pixelSize: Theme.fontSizeLarge
color: Theme.surfaceText color: Theme.surfaceText
elide: Text.ElideMiddle elide: Text.ElideMiddle
@@ -232,6 +202,7 @@ Item {
color: Theme.error color: Theme.error
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
Row { Row {
@@ -260,16 +231,18 @@ Item {
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
profileBrowserLoader.active = true profileBrowserLoader.active = true;
profileBrowser.visible = true profileBrowser.visible = true;
} }
} }
} }
StyledRect { StyledRect {
@@ -296,6 +269,7 @@ Item {
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
MouseArea { MouseArea {
@@ -303,29 +277,29 @@ Item {
enabled: PortalService.profileImage !== "" enabled: PortalService.profileImage !== ""
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
onClicked: { onClicked: {
PortalService.setProfileImage("") PortalService.setProfileImage("");
}
}
}
}
}
}
}
} }
} }
// Wallpaper Component }
Component {
id: wallpaperComponent
}
}
}
}
}
// Wallpaper Section
StyledRect { StyledRect {
width: parent.width width: parent.width
height: wallpaperSection.implicitHeight + Theme.spacingL * 2 height: wallpaperSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3)
Theme.surfaceVariant.b, 0.3) border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
Column { Column {
@@ -353,6 +327,7 @@ Item {
color: Theme.surfaceText color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
Row { Row {
@@ -382,6 +357,7 @@ Item {
maskThresholdMin: 0.5 maskThresholdMin: 0.5
maskSpreadAtMin: 1 maskSpreadAtMin: 1
} }
} }
Rectangle { Rectangle {
@@ -402,6 +378,7 @@ Item {
color: Theme.surfaceVariantText color: Theme.surfaceVariantText
visible: SessionData.wallpaperPath === "" visible: SessionData.wallpaperPath === ""
} }
} }
Column { Column {
@@ -410,9 +387,7 @@ Item {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
StyledText { StyledText {
text: SessionData.wallpaperPath ? SessionData.wallpaperPath.split( text: SessionData.wallpaperPath ? SessionData.wallpaperPath.split('/').pop() : "No wallpaper selected"
'/').pop(
) : "No wallpaper selected"
font.pixelSize: Theme.fontSizeLarge font.pixelSize: Theme.fontSizeLarge
color: Theme.surfaceText color: Theme.surfaceText
elide: Text.ElideMiddle elide: Text.ElideMiddle
@@ -454,16 +429,18 @@ Item {
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
wallpaperBrowserLoader.active = true wallpaperBrowserLoader.active = true;
wallpaperBrowser.visible = true wallpaperBrowser.visible = true;
} }
} }
} }
StyledRect { StyledRect {
@@ -490,6 +467,7 @@ Item {
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
MouseArea { MouseArea {
@@ -497,10 +475,12 @@ Item {
enabled: SessionData.wallpaperPath !== "" enabled: SessionData.wallpaperPath !== ""
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
onClicked: { onClicked: {
SessionData.setWallpaper("") SessionData.setWallpaper("");
} }
} }
} }
} }
// Wallpaper Cycling Section // Wallpaper Cycling Section
@@ -547,10 +527,12 @@ Item {
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
width: parent.width width: parent.width
} }
} }
Row { Row {
id: controlsRow id: controlsRow
spacing: Theme.spacingS spacing: Theme.spacingS
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@@ -578,18 +560,21 @@ Item {
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
MouseArea { MouseArea {
id: prevButtonArea id: prevButtonArea
anchors.fill: parent anchors.fill: parent
enabled: SessionData.wallpaperPath enabled: SessionData.wallpaperPath
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
hoverEnabled: true hoverEnabled: true
onClicked: { onClicked: {
WallpaperCyclingService.cyclePrevManually() WallpaperCyclingService.cyclePrevManually();
} }
} }
} }
StyledRect { StyledRect {
@@ -616,27 +601,35 @@ Item {
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
MouseArea { MouseArea {
id: nextButtonArea id: nextButtonArea
anchors.fill: parent anchors.fill: parent
enabled: SessionData.wallpaperPath enabled: SessionData.wallpaperPath
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
hoverEnabled: true hoverEnabled: true
onClicked: { onClicked: {
WallpaperCyclingService.cycleNextManually() WallpaperCyclingService.cycleNextManually();
} }
} }
} }
DankToggle { DankToggle {
id: cyclingToggle id: cyclingToggle
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
checked: SessionData.wallpaperCyclingEnabled checked: SessionData.wallpaperCyclingEnabled
onToggled: toggled => SessionData.setWallpaperCyclingEnabled(toggled) onToggled: (toggled) => {
return SessionData.setWallpaperCyclingEnabled(toggled);
} }
} }
}
} }
// Cycling mode and settings // Cycling mode and settings
@@ -659,50 +652,42 @@ Item {
DankTabBar { DankTabBar {
id: modeTabBar id: modeTabBar
width: 200 width: 200
height: 32 height: 32
model: [ model: [{
{ text: "Interval" }, "text": "Interval"
{ text: "Time" } }, {
] "text": "Time"
}]
currentIndex: SessionData.wallpaperCyclingMode === "time" ? 1 : 0 currentIndex: SessionData.wallpaperCyclingMode === "time" ? 1 : 0
onTabClicked: (index) => { onTabClicked: (index) => {
SessionData.setWallpaperCyclingMode(index === 1 ? "time" : "interval") SessionData.setWallpaperCyclingMode(index === 1 ? "time" : "interval");
} }
} }
} }
// Interval settings // Interval settings
DankDropdown { DankDropdown {
property var intervalOptions: ["1 minute", "5 minutes", "15 minutes", "30 minutes", "1 hour", "1.5 hours", "2 hours", "3 hours", "4 hours", "6 hours", "8 hours", "12 hours"]
property var intervalValues: [60, 300, 900, 1800, 3600, 5400, 7200, 10800, 14400, 21600, 28800, 43200]
width: parent.width - parent.leftPadding width: parent.width - parent.leftPadding
visible: SessionData.wallpaperCyclingMode === "interval" visible: SessionData.wallpaperCyclingMode === "interval"
text: "Interval" text: "Interval"
description: "How often to change wallpaper" description: "How often to change wallpaper"
property var intervalOptions: [
"1 minute", "5 minutes", "15 minutes", "30 minutes",
"1 hour", "1.5 hours", "2 hours", "3 hours",
"4 hours", "6 hours", "8 hours", "12 hours"
]
property var intervalValues: [
60, 300, 900, 1800,
3600, 5400, 7200, 10800,
14400, 21600, 28800, 43200
]
options: intervalOptions options: intervalOptions
currentValue: { currentValue: {
const currentSeconds = SessionData.wallpaperCyclingInterval const currentSeconds = SessionData.wallpaperCyclingInterval;
const index = intervalValues.indexOf(currentSeconds) const index = intervalValues.indexOf(currentSeconds);
return index >= 0 ? intervalOptions[index] : "5 minutes" return index >= 0 ? intervalOptions[index] : "5 minutes";
} }
onValueChanged: (value) => { onValueChanged: (value) => {
const index = intervalOptions.indexOf(value) const index = intervalOptions.indexOf(value);
if (index >= 0) { if (index >= 0)
SessionData.setWallpaperCyclingInterval(intervalValues[index]) SessionData.setWallpaperCyclingInterval(intervalValues[index]);
}
} }
} }
@@ -727,28 +712,28 @@ Item {
maximumLength: 5 maximumLength: 5
topPadding: Theme.spacingS topPadding: Theme.spacingS
bottomPadding: Theme.spacingS bottomPadding: Theme.spacingS
onAccepted: {
var isValid = /^([0-1][0-9]|2[0-3]):[0-5][0-9]$/.test(text);
if (isValid)
SessionData.setWallpaperCyclingTime(text);
else
// Reset to current value if invalid
text = SessionData.wallpaperCyclingTime;
}
onEditingFinished: {
var isValid = /^([0-1][0-9]|2[0-3]):[0-5][0-9]$/.test(text);
if (isValid)
SessionData.setWallpaperCyclingTime(text);
else
// Reset to current value if invalid
text = SessionData.wallpaperCyclingTime;
}
anchors.verticalCenter: parent.verticalCenter
validator: RegularExpressionValidator { validator: RegularExpressionValidator {
regularExpression: /^([0-1][0-9]|2[0-3]):[0-5][0-9]$/ regularExpression: /^([0-1][0-9]|2[0-3]):[0-5][0-9]$/
} }
onAccepted: {
var isValid = /^([0-1][0-9]|2[0-3]):[0-5][0-9]$/.test(text)
if (isValid) {
SessionData.setWallpaperCyclingTime(text)
} else {
// Reset to current value if invalid
text = SessionData.wallpaperCyclingTime
}
}
onEditingFinished: {
var isValid = /^([0-1][0-9]|2[0-3]):[0-5][0-9]$/.test(text)
if (isValid) {
SessionData.setWallpaperCyclingTime(text)
} else {
// Reset to current value if invalid
text = SessionData.wallpaperCyclingTime
}
}
anchors.verticalCenter: parent.verticalCenter
} }
StyledText { StyledText {
@@ -757,27 +742,28 @@ Item {
color: Theme.surfaceVariantText color: Theme.surfaceVariantText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
}
}
}
}
}
}
}
} }
// Dynamic Theme Component }
Component {
id: dynamicThemeComponent
}
}
}
}
}
// Dynamic Theme Section
StyledRect { StyledRect {
width: parent.width width: parent.width
height: dynamicThemeSection.implicitHeight + Theme.spacingL * 2 height: dynamicThemeSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3)
Theme.surfaceVariant.b, 0.3) border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
Column { Column {
@@ -817,6 +803,7 @@ Item {
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
width: parent.width width: parent.width
} }
} }
DankToggle { DankToggle {
@@ -825,13 +812,14 @@ Item {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
checked: Theme.isDynamicTheme checked: Theme.isDynamicTheme
enabled: ToastService.wallpaperErrorStatus !== "matugen_missing" enabled: ToastService.wallpaperErrorStatus !== "matugen_missing"
onToggled: toggled => { onToggled: (toggled) => {
if (toggled) if (toggled)
Theme.switchTheme(10, true) Theme.switchTheme(10, true);
else else
Theme.switchTheme(0) Theme.switchTheme(0);
} }
} }
} }
StyledText { StyledText {
@@ -842,131 +830,19 @@ Item {
width: parent.width width: parent.width
leftPadding: Theme.iconSize + Theme.spacingM leftPadding: Theme.iconSize + Theme.spacingM
} }
}
}
}
LazyLoader {
id: profileBrowserLoader
active: false
FileBrowserModal {
id: profileBrowser
browserTitle: "Select Profile Image"
browserIcon: "person"
browserType: "profile"
fileExtensions: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp"]
onFileSelected: path => {
PortalService.setProfileImage(path)
visible = false
}
onDialogClosed: {
} }
}
}
LazyLoader {
id: wallpaperBrowserLoader
active: false
FileBrowserModal {
id: wallpaperBrowser
browserTitle: "Select Wallpaper"
browserIcon: "wallpaper"
browserType: "wallpaper"
fileExtensions: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp"]
onFileSelected: path => {
SessionData.setWallpaper(path)
visible = false
}
onDialogClosed: {
} }
}
}
// Notification Overlay Component
Component {
id: notificationOverlayComponent
StyledRect {
width: parent.width
height: notificationOverlaySection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g,
Theme.surfaceVariant.b, 0.3)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1
Column {
id: notificationOverlaySection
anchors.fill: parent
anchors.margins: Theme.spacingL
spacing: Theme.spacingM
Row {
width: parent.width
spacing: Theme.spacingM
DankIcon {
name: "notifications_active"
size: Theme.iconSize
color: Theme.primary
anchors.verticalCenter: parent.verticalCenter
}
Column {
width: parent.width - Theme.iconSize - Theme.spacingM - overlayToggle.width - Theme.spacingM
spacing: Theme.spacingXS
anchors.verticalCenter: parent.verticalCenter
StyledText {
text: "Notification Overlay"
font.pixelSize: Theme.fontSizeLarge
font.weight: Font.Medium
color: Theme.surfaceText
}
StyledText {
text: "Enable to display all notification priorities over fullscreen apps"
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
wrapMode: Text.WordWrap
width: parent.width
}
}
DankToggle {
id: overlayToggle
anchors.verticalCenter: parent.verticalCenter
checked: SettingsData.notificationOverlayEnabled
onToggled: toggled => SettingsData.setNotificationOverlayEnabled(toggled)
}
}
}
}
}
// TopBar Auto-hide Component
Component {
id: topBarAutoHideComponent
// TopBar Auto-hide Section
StyledRect { StyledRect {
width: parent.width width: parent.width
height: topBarAutoHideSection.implicitHeight + Theme.spacingL * 2 height: topBarAutoHideSection.implicitHeight + Theme.spacingL * 2
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, color: Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3)
Theme.surfaceVariant.b, 0.3) border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2)
border.width: 1 border.width: 1
Column { Column {
@@ -1006,6 +882,7 @@ Item {
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
width: parent.width width: parent.width
} }
} }
DankToggle { DankToggle {
@@ -1013,10 +890,63 @@ Item {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
checked: SettingsData.topBarAutoHide checked: SettingsData.topBarAutoHide
onToggled: toggled => SettingsData.setTopBarAutoHide(toggled) onToggled: (toggled) => {
return SettingsData.setTopBarAutoHide(toggled);
} }
} }
}
}
}
}
}
LazyLoader {
id: profileBrowserLoader
active: false
FileBrowserModal {
id: profileBrowser
browserTitle: "Select Profile Image"
browserIcon: "person"
browserType: "profile"
fileExtensions: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp"]
onFileSelected: (path) => {
PortalService.setProfileImage(path);
visible = false;
}
onDialogClosed: {
} }
} }
} }
LazyLoader {
id: wallpaperBrowserLoader
active: false
FileBrowserModal {
id: wallpaperBrowser
browserTitle: "Select Wallpaper"
browserIcon: "wallpaper"
browserType: "wallpaper"
fileExtensions: ["*.jpg", "*.jpeg", "*.png", "*.bmp", "*.gif", "*.webp"]
onFileSelected: (path) => {
SessionData.setWallpaper(path);
visible = false;
}
onDialogClosed: {
}
}
}
} }

View File

@@ -20,24 +20,7 @@ Item {
width: parent.width width: parent.width
spacing: Theme.spacingXL spacing: Theme.spacingXL
Loader { // Time Format
width: parent.width
sourceComponent: timeComponent
}
Loader {
width: parent.width
sourceComponent: weatherComponent
}
}
}
// Time Format Component
Component {
id: timeComponent
StyledRect { StyledRect {
width: parent.width width: parent.width
height: timeSection.implicitHeight + Theme.spacingL * 2 height: timeSection.implicitHeight + Theme.spacingL * 2
@@ -71,7 +54,6 @@ Item {
color: Theme.surfaceText color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
DankToggle { DankToggle {
@@ -221,7 +203,6 @@ Item {
onTextChanged: { onTextChanged: {
if (visible && text) if (visible && text)
SettingsData.setClockDateFormat(text); SettingsData.setClockDateFormat(text);
} }
} }
@@ -235,7 +216,6 @@ Item {
onTextChanged: { onTextChanged: {
if (visible && text) if (visible && text)
SettingsData.setLockDateFormat(text); SettingsData.setLockDateFormat(text);
} }
} }
@@ -290,7 +270,6 @@ Item {
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText color: Theme.surfaceVariantText
} }
} }
Column { Column {
@@ -319,7 +298,6 @@ Item {
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText color: Theme.surfaceVariantText
} }
} }
Column { Column {
@@ -336,27 +314,15 @@ Item {
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText color: Theme.surfaceVariantText
} }
}
}
}
}
}
}
} }
} // Weather
}
}
}
}
}
}
// Weather Component
Component {
id: weatherComponent
StyledRect { StyledRect {
width: parent.width width: parent.width
height: weatherSection.implicitHeight + Theme.spacingL * 2 height: weatherSection.implicitHeight + Theme.spacingL * 2
@@ -390,7 +356,6 @@ Item {
color: Theme.surfaceText color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }
DankToggle { DankToggle {
@@ -445,13 +410,13 @@ Item {
SettingsData.setWeatherLocation(displayName, coordinates); SettingsData.setWeatherLocation(displayName, coordinates);
} }
} }
}
}
} }
} }
} }
}
} }

View File

@@ -437,38 +437,6 @@ Item {
width: parent.width width: parent.width
spacing: Theme.spacingXL spacing: Theme.spacingXL
Loader {
width: parent.width
sourceComponent: headerComponent
}
Loader {
width: parent.width
sourceComponent: messageComponent
}
Loader {
width: parent.width
sourceComponent: sectionsComponent
}
Loader {
width: parent.width
sourceComponent: workspaceComponent
}
Loader {
width: parent.width
sourceComponent: workspaceIconsComponent
visible: SettingsData.hasNamedWorkspaces()
}
}
}
// Header Component
Component {
id: headerComponent
Row { Row {
width: parent.width width: parent.width
spacing: Theme.spacingM spacing: Theme.spacingM
@@ -553,11 +521,6 @@ Item {
} }
} }
} }
}
// Message Component
Component {
id: messageComponent
Rectangle { Rectangle {
width: parent.width width: parent.width
@@ -580,11 +543,6 @@ Item {
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
} }
} }
}
// Sections Component
Component {
id: sectionsComponent
Column { Column {
width: parent.width width: parent.width
@@ -719,11 +677,6 @@ Item {
} }
} }
} }
}
// Workspace Settings Component
Component {
id: workspaceComponent
StyledRect { StyledRect {
width: parent.width width: parent.width
@@ -783,11 +736,6 @@ Item {
} }
} }
} }
}
// Workspace Icons Component
Component {
id: workspaceIconsComponent
StyledRect { StyledRect {
width: parent.width width: parent.width
@@ -798,6 +746,7 @@ Item {
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
Theme.outline.b, 0.2) Theme.outline.b, 0.2)
border.width: 1 border.width: 1
visible: SettingsData.hasNamedWorkspaces()
Column { Column {
id: workspaceIconsSection id: workspaceIconsSection
@@ -937,6 +886,8 @@ Item {
} }
} }
} }
}
DankWidgetSelectionPopup { DankWidgetSelectionPopup {
id: widgetSelectionPopup id: widgetSelectionPopup

View File

@@ -85,6 +85,8 @@ Singleton {
handleWorkspacesChanged(event.WorkspacesChanged) handleWorkspacesChanged(event.WorkspacesChanged)
} else if (event.WorkspaceActivated) { } else if (event.WorkspaceActivated) {
handleWorkspaceActivated(event.WorkspaceActivated) handleWorkspaceActivated(event.WorkspaceActivated)
} else if (event.WorkspaceActiveWindowChanged) {
handleWorkspaceActiveWindowChanged(event.WorkspaceActiveWindowChanged)
} else if (event.WindowsChanged) { } else if (event.WindowsChanged) {
handleWindowsChanged(event.WindowsChanged) handleWindowsChanged(event.WindowsChanged)
} else if (event.WindowClosed) { } else if (event.WindowClosed) {
@@ -153,6 +155,49 @@ Singleton {
workspacesChanged() workspacesChanged()
} }
function handleWorkspaceActiveWindowChanged(data) {
// Update the focused window when workspace's active window changes
// This is crucial for handling floating window close scenarios
if (data.active_window_id !== null && data.active_window_id !== undefined) {
focusedWindowId = String(data.active_window_id)
focusedWindowIndex = windows.findIndex(w => w.id == data.active_window_id)
// Create new windows array with updated focus states to trigger property change
let updatedWindows = []
for (let i = 0; i < windows.length; i++) {
let w = windows[i]
let updatedWindow = {}
for (let prop in w) {
updatedWindow[prop] = w[prop]
}
updatedWindow.is_focused = (w.id == data.active_window_id)
updatedWindows.push(updatedWindow)
}
windows = updatedWindows
updateFocusedWindow()
} else {
// No active window in this workspace
focusedWindowId = ""
focusedWindowIndex = -1
// Create new windows array with cleared focus states for this workspace
let updatedWindows = []
for (let i = 0; i < windows.length; i++) {
let w = windows[i]
let updatedWindow = {}
for (let prop in w) {
updatedWindow[prop] = w[prop]
}
updatedWindow.is_focused = w.workspace_id == data.workspace_id ? false : w.is_focused
updatedWindows.push(updatedWindow)
}
windows = updatedWindows
updateFocusedWindow()
}
}
function handleWindowsChanged(data) { function handleWindowsChanged(data) {
windows = [...data.windows].sort((a, b) => a.id - b.id) windows = [...data.windows].sort((a, b) => a.id - b.id)
updateFocusedWindow() updateFocusedWindow()