mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-16 02:32:09 -04:00
fix loader patterns in settings
- fix matugen command - fix focused window being wrong sometimes
This commit is contained in:
@@ -29,7 +29,6 @@ Singleton {
|
||||
property bool gtkThemingEnabled: false
|
||||
property bool qtThemingEnabled: false
|
||||
property bool systemThemeGenerationInProgress: false
|
||||
property string matugenJson: ""
|
||||
property var matugenColors: ({})
|
||||
property bool extractionRequested: false
|
||||
property int colorUpdateTrigger: 0
|
||||
@@ -141,51 +140,33 @@ Singleton {
|
||||
Process {
|
||||
id: matugenProcess
|
||||
|
||||
command: ["matugen", "-v", "image", wallpaperPath, "--json", "hex"]
|
||||
command: ["matugen", "image", wallpaperPath, "--json", "hex"]
|
||||
|
||||
stdout: StdioCollector {
|
||||
id: matugenCollector
|
||||
|
||||
onStreamFinished: {
|
||||
const out = 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) {
|
||||
if (!matugenCollector.text) {
|
||||
ToastService.wallpaperErrorStatus = "error"
|
||||
ToastService.showError("Wallpaper Processing Failed: Empty JSON extracted from matugen output.")
|
||||
return
|
||||
}
|
||||
try {
|
||||
root.matugenJson = jsonStringOnly
|
||||
root.matugenColors = JSON.parse(jsonStringOnly)
|
||||
root.matugenColors = JSON.parse(matugenCollector.text)
|
||||
root.colorsUpdated()
|
||||
generateAppConfigs()
|
||||
ToastService.clearWallpaperError()
|
||||
} catch (e) {
|
||||
ToastService.wallpaperErrorStatus = "error"
|
||||
const stderr = matugenErr.text
|
||||
const msg = "Wallpaper processing failed (JSON parse error after extraction)"
|
||||
+ (stderr ? `: ${stderr}` : ` with output: ${jsonStringOnly}`)
|
||||
ToastService.showError(msg)
|
||||
ToastService.showError("Wallpaper processing failed (JSON parse error after extraction)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stderr: StdioCollector {
|
||||
id: matugenErr
|
||||
}
|
||||
|
||||
onExited: code => {
|
||||
if (code !== 0) {
|
||||
ToastService.wallpaperErrorStatus = "error"
|
||||
const stderr = matugenErr.text
|
||||
const msg = "Matugen command failed with exit code " + code
|
||||
+ (stderr ? `: ${stderr}` : ". No stderr output.")
|
||||
ToastService.showError(msg)
|
||||
ToastService.showError("Matugen command failed with exit code " + code)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,16 +121,18 @@ DankModal {
|
||||
color: "transparent"
|
||||
|
||||
Loader {
|
||||
id: personalizationLoader
|
||||
anchors.fill: parent
|
||||
active: settingsTabBar.currentIndex === 0
|
||||
visible: active
|
||||
asynchronous: false
|
||||
asynchronous: true
|
||||
sourceComponent: Component {
|
||||
PersonalizationTab {}
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: timeWeatherLoader
|
||||
anchors.fill: parent
|
||||
active: settingsTabBar.currentIndex === 1
|
||||
visible: active
|
||||
@@ -141,6 +143,7 @@ DankModal {
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: widgetsLoader
|
||||
anchors.fill: parent
|
||||
active: settingsTabBar.currentIndex === 2
|
||||
visible: active
|
||||
@@ -151,6 +154,7 @@ DankModal {
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: launcherLoader
|
||||
anchors.fill: parent
|
||||
active: settingsTabBar.currentIndex === 3
|
||||
visible: active
|
||||
@@ -161,10 +165,11 @@ DankModal {
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: appearanceLoader
|
||||
anchors.fill: parent
|
||||
active: settingsTabBar.currentIndex === 4
|
||||
visible: active
|
||||
asynchronous: false
|
||||
asynchronous: true
|
||||
sourceComponent: Component {
|
||||
AppearanceTab {}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,37 +21,7 @@ Item {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingXL
|
||||
|
||||
Loader {
|
||||
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
|
||||
|
||||
// Display Settings
|
||||
StyledRect {
|
||||
width: parent.width
|
||||
height: displaySection.implicitHeight + Theme.spacingL * 2
|
||||
@@ -315,12 +285,8 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Transparency Settings Component
|
||||
Component {
|
||||
id: transparencyComponent
|
||||
|
||||
// Transparency Settings
|
||||
StyledRect {
|
||||
width: parent.width
|
||||
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
|
||||
Component {
|
||||
id: themeComponent
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Theme Color
|
||||
StyledRect {
|
||||
width: parent.width
|
||||
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 {
|
||||
width: parent.width
|
||||
height: systemThemingSection.implicitHeight + Theme.spacingL * 2
|
||||
@@ -947,6 +901,8 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Process {
|
||||
id: nightModeEnableProcess
|
||||
|
||||
@@ -20,27 +20,6 @@ Item {
|
||||
width: parent.width
|
||||
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 {
|
||||
width: parent.width
|
||||
height: appLauncherSection.implicitHeight + Theme.spacingL * 2
|
||||
@@ -167,11 +146,6 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Dock Component
|
||||
Component {
|
||||
id: dockComponent
|
||||
|
||||
StyledRect {
|
||||
width: parent.width
|
||||
@@ -275,11 +249,6 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Recently Used Apps Component
|
||||
Component {
|
||||
id: recentlyUsedComponent
|
||||
|
||||
StyledRect {
|
||||
width: parent.width
|
||||
@@ -499,3 +468,5 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ Item {
|
||||
|
||||
Component.onCompleted: {
|
||||
// Access WallpaperCyclingService to ensure it's initialized
|
||||
WallpaperCyclingService.cyclingActive
|
||||
WallpaperCyclingService.cyclingActive;
|
||||
}
|
||||
|
||||
DankFlickable {
|
||||
@@ -28,48 +28,17 @@ Item {
|
||||
|
||||
Column {
|
||||
id: mainColumn
|
||||
|
||||
width: parent.width
|
||||
spacing: Theme.spacingXL
|
||||
|
||||
Loader {
|
||||
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
|
||||
|
||||
// Profile Image Section
|
||||
StyledRect {
|
||||
width: parent.width
|
||||
height: profileSection.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)
|
||||
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 {
|
||||
@@ -97,6 +66,7 @@ Item {
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Row {
|
||||
@@ -125,12 +95,12 @@ Item {
|
||||
|
||||
source: {
|
||||
if (PortalService.profileImage === "")
|
||||
return ""
|
||||
return "";
|
||||
|
||||
if (PortalService.profileImage.startsWith("/"))
|
||||
return "file://" + PortalService.profileImage
|
||||
return "file://" + PortalService.profileImage;
|
||||
|
||||
return PortalService.profileImage
|
||||
return PortalService.profileImage;
|
||||
}
|
||||
smooth: true
|
||||
asynchronous: true
|
||||
@@ -165,6 +135,7 @@ Item {
|
||||
color: "black"
|
||||
antialiasing: true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
@@ -179,6 +150,7 @@ Item {
|
||||
size: Theme.iconSizeLarge + 8
|
||||
color: Theme.primaryText
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
DankIcon {
|
||||
@@ -186,9 +158,9 @@ Item {
|
||||
name: "warning"
|
||||
size: Theme.iconSizeLarge
|
||||
color: Theme.error
|
||||
visible: PortalService.profileImage !== ""
|
||||
&& avatarImageSource.status === Image.Error
|
||||
visible: PortalService.profileImage !== "" && avatarImageSource.status === Image.Error
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Column {
|
||||
@@ -197,9 +169,7 @@ Item {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
StyledText {
|
||||
text: PortalService.profileImage ? PortalService.profileImage.split(
|
||||
'/').pop(
|
||||
) : "No profile image selected"
|
||||
text: PortalService.profileImage ? PortalService.profileImage.split('/').pop() : "No profile image selected"
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
color: Theme.surfaceText
|
||||
elide: Text.ElideMiddle
|
||||
@@ -232,6 +202,7 @@ Item {
|
||||
color: Theme.error
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Row {
|
||||
@@ -260,16 +231,18 @@ Item {
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
profileBrowserLoader.active = true
|
||||
profileBrowser.visible = true
|
||||
profileBrowserLoader.active = true;
|
||||
profileBrowser.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
StyledRect {
|
||||
@@ -296,6 +269,7 @@ Item {
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
@@ -303,29 +277,29 @@ Item {
|
||||
enabled: PortalService.profileImage !== ""
|
||||
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onClicked: {
|
||||
PortalService.setProfileImage("")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
PortalService.setProfileImage("");
|
||||
}
|
||||
}
|
||||
|
||||
// Wallpaper Component
|
||||
Component {
|
||||
id: wallpaperComponent
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Wallpaper Section
|
||||
StyledRect {
|
||||
width: parent.width
|
||||
height: wallpaperSection.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)
|
||||
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 {
|
||||
@@ -353,6 +327,7 @@ Item {
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Row {
|
||||
@@ -382,6 +357,7 @@ Item {
|
||||
maskThresholdMin: 0.5
|
||||
maskSpreadAtMin: 1
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
@@ -402,6 +378,7 @@ Item {
|
||||
color: Theme.surfaceVariantText
|
||||
visible: SessionData.wallpaperPath === ""
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Column {
|
||||
@@ -410,9 +387,7 @@ Item {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
StyledText {
|
||||
text: SessionData.wallpaperPath ? SessionData.wallpaperPath.split(
|
||||
'/').pop(
|
||||
) : "No wallpaper selected"
|
||||
text: SessionData.wallpaperPath ? SessionData.wallpaperPath.split('/').pop() : "No wallpaper selected"
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
color: Theme.surfaceText
|
||||
elide: Text.ElideMiddle
|
||||
@@ -454,16 +429,18 @@ Item {
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
wallpaperBrowserLoader.active = true
|
||||
wallpaperBrowser.visible = true
|
||||
wallpaperBrowserLoader.active = true;
|
||||
wallpaperBrowser.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
StyledRect {
|
||||
@@ -490,6 +467,7 @@ Item {
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
@@ -497,10 +475,12 @@ Item {
|
||||
enabled: SessionData.wallpaperPath !== ""
|
||||
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onClicked: {
|
||||
SessionData.setWallpaper("")
|
||||
SessionData.setWallpaper("");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Wallpaper Cycling Section
|
||||
@@ -547,10 +527,12 @@ Item {
|
||||
wrapMode: Text.WordWrap
|
||||
width: parent.width
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Row {
|
||||
id: controlsRow
|
||||
|
||||
spacing: Theme.spacingS
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
@@ -578,18 +560,21 @@ Item {
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: prevButtonArea
|
||||
|
||||
anchors.fill: parent
|
||||
enabled: SessionData.wallpaperPath
|
||||
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
WallpaperCyclingService.cyclePrevManually()
|
||||
WallpaperCyclingService.cyclePrevManually();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
StyledRect {
|
||||
@@ -616,27 +601,35 @@ Item {
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: nextButtonArea
|
||||
|
||||
anchors.fill: parent
|
||||
enabled: SessionData.wallpaperPath
|
||||
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
WallpaperCyclingService.cycleNextManually()
|
||||
WallpaperCyclingService.cycleNextManually();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
DankToggle {
|
||||
id: cyclingToggle
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
checked: SessionData.wallpaperCyclingEnabled
|
||||
onToggled: toggled => SessionData.setWallpaperCyclingEnabled(toggled)
|
||||
onToggled: (toggled) => {
|
||||
return SessionData.setWallpaperCyclingEnabled(toggled);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Cycling mode and settings
|
||||
@@ -659,50 +652,42 @@ Item {
|
||||
|
||||
DankTabBar {
|
||||
id: modeTabBar
|
||||
|
||||
width: 200
|
||||
height: 32
|
||||
model: [
|
||||
{ text: "Interval" },
|
||||
{ text: "Time" }
|
||||
]
|
||||
model: [{
|
||||
"text": "Interval"
|
||||
}, {
|
||||
"text": "Time"
|
||||
}]
|
||||
currentIndex: SessionData.wallpaperCyclingMode === "time" ? 1 : 0
|
||||
onTabClicked: (index) => {
|
||||
SessionData.setWallpaperCyclingMode(index === 1 ? "time" : "interval")
|
||||
SessionData.setWallpaperCyclingMode(index === 1 ? "time" : "interval");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Interval settings
|
||||
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
|
||||
visible: SessionData.wallpaperCyclingMode === "interval"
|
||||
text: "Interval"
|
||||
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
|
||||
currentValue: {
|
||||
const currentSeconds = SessionData.wallpaperCyclingInterval
|
||||
const index = intervalValues.indexOf(currentSeconds)
|
||||
return index >= 0 ? intervalOptions[index] : "5 minutes"
|
||||
const currentSeconds = SessionData.wallpaperCyclingInterval;
|
||||
const index = intervalValues.indexOf(currentSeconds);
|
||||
return index >= 0 ? intervalOptions[index] : "5 minutes";
|
||||
}
|
||||
|
||||
onValueChanged: (value) => {
|
||||
const index = intervalOptions.indexOf(value)
|
||||
if (index >= 0) {
|
||||
SessionData.setWallpaperCyclingInterval(intervalValues[index])
|
||||
}
|
||||
const index = intervalOptions.indexOf(value);
|
||||
if (index >= 0)
|
||||
SessionData.setWallpaperCyclingInterval(intervalValues[index]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -727,28 +712,28 @@ Item {
|
||||
maximumLength: 5
|
||||
topPadding: 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 {
|
||||
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 {
|
||||
@@ -757,27 +742,28 @@ Item {
|
||||
color: Theme.surfaceVariantText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Dynamic Theme Component
|
||||
Component {
|
||||
id: dynamicThemeComponent
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Dynamic Theme Section
|
||||
StyledRect {
|
||||
width: parent.width
|
||||
height: dynamicThemeSection.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)
|
||||
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 {
|
||||
@@ -817,6 +803,7 @@ Item {
|
||||
wrapMode: Text.WordWrap
|
||||
width: parent.width
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
DankToggle {
|
||||
@@ -825,13 +812,14 @@ Item {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
checked: Theme.isDynamicTheme
|
||||
enabled: ToastService.wallpaperErrorStatus !== "matugen_missing"
|
||||
onToggled: toggled => {
|
||||
onToggled: (toggled) => {
|
||||
if (toggled)
|
||||
Theme.switchTheme(10, true)
|
||||
Theme.switchTheme(10, true);
|
||||
else
|
||||
Theme.switchTheme(0)
|
||||
Theme.switchTheme(0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
StyledText {
|
||||
@@ -842,131 +830,19 @@ Item {
|
||||
width: parent.width
|
||||
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 {
|
||||
width: parent.width
|
||||
height: topBarAutoHideSection.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)
|
||||
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 {
|
||||
@@ -1006,6 +882,7 @@ Item {
|
||||
wrapMode: Text.WordWrap
|
||||
width: parent.width
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
DankToggle {
|
||||
@@ -1013,10 +890,63 @@ Item {
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
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: {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,24 +20,7 @@ Item {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingXL
|
||||
|
||||
Loader {
|
||||
width: parent.width
|
||||
sourceComponent: timeComponent
|
||||
}
|
||||
|
||||
Loader {
|
||||
width: parent.width
|
||||
sourceComponent: weatherComponent
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Time Format Component
|
||||
Component {
|
||||
id: timeComponent
|
||||
|
||||
// Time Format
|
||||
StyledRect {
|
||||
width: parent.width
|
||||
height: timeSection.implicitHeight + Theme.spacingL * 2
|
||||
@@ -71,7 +54,6 @@ Item {
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
DankToggle {
|
||||
@@ -221,7 +203,6 @@ Item {
|
||||
onTextChanged: {
|
||||
if (visible && text)
|
||||
SettingsData.setClockDateFormat(text);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,7 +216,6 @@ Item {
|
||||
onTextChanged: {
|
||||
if (visible && text)
|
||||
SettingsData.setLockDateFormat(text);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,7 +270,6 @@ Item {
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Column {
|
||||
@@ -319,7 +298,6 @@ Item {
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Column {
|
||||
@@ -336,27 +314,15 @@ Item {
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceVariantText
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Weather Component
|
||||
Component {
|
||||
id: weatherComponent
|
||||
|
||||
// Weather
|
||||
StyledRect {
|
||||
width: parent.width
|
||||
height: weatherSection.implicitHeight + Theme.spacingL * 2
|
||||
@@ -390,7 +356,6 @@ Item {
|
||||
color: Theme.surfaceText
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
DankToggle {
|
||||
@@ -445,13 +410,13 @@ Item {
|
||||
SettingsData.setWeatherLocation(displayName, coordinates);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -437,38 +437,6 @@ Item {
|
||||
width: parent.width
|
||||
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 {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingM
|
||||
@@ -553,11 +521,6 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Message Component
|
||||
Component {
|
||||
id: messageComponent
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
@@ -580,11 +543,6 @@ Item {
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sections Component
|
||||
Component {
|
||||
id: sectionsComponent
|
||||
|
||||
Column {
|
||||
width: parent.width
|
||||
@@ -719,11 +677,6 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Workspace Settings Component
|
||||
Component {
|
||||
id: workspaceComponent
|
||||
|
||||
StyledRect {
|
||||
width: parent.width
|
||||
@@ -783,11 +736,6 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Workspace Icons Component
|
||||
Component {
|
||||
id: workspaceIconsComponent
|
||||
|
||||
StyledRect {
|
||||
width: parent.width
|
||||
@@ -798,6 +746,7 @@ Item {
|
||||
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g,
|
||||
Theme.outline.b, 0.2)
|
||||
border.width: 1
|
||||
visible: SettingsData.hasNamedWorkspaces()
|
||||
|
||||
Column {
|
||||
id: workspaceIconsSection
|
||||
@@ -937,6 +886,8 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DankWidgetSelectionPopup {
|
||||
id: widgetSelectionPopup
|
||||
|
||||
@@ -85,6 +85,8 @@ Singleton {
|
||||
handleWorkspacesChanged(event.WorkspacesChanged)
|
||||
} else if (event.WorkspaceActivated) {
|
||||
handleWorkspaceActivated(event.WorkspaceActivated)
|
||||
} else if (event.WorkspaceActiveWindowChanged) {
|
||||
handleWorkspaceActiveWindowChanged(event.WorkspaceActiveWindowChanged)
|
||||
} else if (event.WindowsChanged) {
|
||||
handleWindowsChanged(event.WindowsChanged)
|
||||
} else if (event.WindowClosed) {
|
||||
@@ -153,6 +155,49 @@ Singleton {
|
||||
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) {
|
||||
windows = [...data.windows].sort((a, b) => a.id - b.id)
|
||||
updateFocusedWindow()
|
||||
|
||||
Reference in New Issue
Block a user