diff --git a/quickshell/Common/SessionData.qml b/quickshell/Common/SessionData.qml index ed2664d5..eed41211 100644 --- a/quickshell/Common/SessionData.qml +++ b/quickshell/Common/SessionData.qml @@ -89,6 +89,7 @@ Singleton { property int themeModeEndHour: 6 property int themeModeEndMinute: 0 property bool themeModeShareGammaSettings: true + property string themeModeNextTransition: "" property var pinnedApps: [] property var barPinnedApps: [] diff --git a/quickshell/Common/Theme.qml b/quickshell/Common/Theme.qml index 583448c4..2dac02bb 100644 --- a/quickshell/Common/Theme.qml +++ b/quickshell/Common/Theme.qml @@ -1708,6 +1708,9 @@ Singleton { if (state.config && state.config.mode && state.config.mode !== SessionData.themeModeAutoMode) { return; } + if (typeof SessionData !== "undefined" && state.nextTransition !== undefined) { + SessionData.themeModeNextTransition = state.nextTransition || ""; + } if (state.isLight !== undefined && root.isLightMode !== state.isLight) { root.setLightMode(state.isLight, true, true); } diff --git a/quickshell/Modules/Settings/ThemeColorsTab.qml b/quickshell/Modules/Settings/ThemeColorsTab.qml index 004b21cc..328ed410 100644 --- a/quickshell/Modules/Settings/ThemeColorsTab.qml +++ b/quickshell/Modules/Settings/ThemeColorsTab.qml @@ -125,6 +125,19 @@ Item { return Theme.warning; } + function formatThemeAutoTime(isoString) { + if (!isoString) + return ""; + try { + const date = new Date(isoString); + if (isNaN(date.getTime())) + return ""; + return date.toLocaleTimeString(Qt.locale(), "HH:mm"); + } catch (e) { + return ""; + } + } + Component.onCompleted: { SettingsData.detectAvailableIconThemes(); SettingsData.detectAvailableCursorThemes(); @@ -1287,35 +1300,117 @@ Item { Rectangle { width: parent.width - height: statusColumn.implicitHeight + Theme.spacingM * 2 + height: statusRow.implicitHeight + Theme.spacingM * 2 radius: Theme.cornerRadius color: Theme.surfaceContainerHigh - Column { - id: statusColumn + Row { + id: statusRow anchors.centerIn: parent - spacing: Theme.spacingXS + spacing: Theme.spacingL + width: parent.width - Theme.spacingM * 2 - DankIcon { - name: SessionData.isLightMode ? "light_mode" : "dark_mode" - size: Theme.iconSize - color: SessionData.isLightMode ? "#FFA726" : "#7E57C2" - anchors.horizontalCenter: parent.horizontalCenter + Column { + spacing: 2 + width: (parent.width - Theme.spacingL * 2) / 3 + anchors.verticalCenter: parent.verticalCenter + + Row { + spacing: Theme.spacingS + anchors.horizontalCenter: parent.horizontalCenter + + Rectangle { + width: 8 + height: 8 + radius: 4 + color: SessionData.themeModeAutoEnabled ? Theme.success : Theme.error + anchors.verticalCenter: parent.verticalCenter + } + + StyledText { + text: I18n.tr("Automation") + font.pixelSize: Theme.fontSizeSmall + color: Theme.surfaceVariantText + } + } + + StyledText { + text: SessionData.themeModeAutoEnabled ? I18n.tr("Enabled") : I18n.tr("Disabled") + font.pixelSize: Theme.fontSizeSmall + font.weight: Font.Medium + color: Theme.surfaceText + horizontalAlignment: Text.AlignHCenter + width: parent.width + } } - StyledText { - text: SessionData.isLightMode ? I18n.tr("Light Mode Active") : I18n.tr("Dark Mode Active") - font.pixelSize: Theme.fontSizeMedium - font.weight: Font.Medium - color: Theme.surfaceText - anchors.horizontalCenter: parent.horizontalCenter + Column { + spacing: 2 + width: (parent.width - Theme.spacingL * 2) / 3 + anchors.verticalCenter: parent.verticalCenter + + Row { + anchors.horizontalCenter: parent.horizontalCenter + spacing: Theme.spacingS + + DankIcon { + name: SessionData.isLightMode ? "light_mode" : "dark_mode" + size: Theme.iconSizeSmall + color: SessionData.isLightMode ? "#FFA726" : "#7E57C2" + anchors.verticalCenter: parent.verticalCenter + } + + StyledText { + text: SessionData.isLightMode ? I18n.tr("Light Mode") : I18n.tr("Dark Mode") + font.pixelSize: Theme.fontSizeSmall + font.weight: Font.Bold + color: Theme.surfaceText + anchors.verticalCenter: parent.verticalCenter + } + } + + StyledText { + text: I18n.tr("Active") + font.pixelSize: Theme.fontSizeSmall + color: Theme.surfaceVariantText + horizontalAlignment: Text.AlignHCenter + width: parent.width + } } - StyledText { - text: I18n.tr("Automation: ") + (SessionData.themeModeAutoEnabled ? I18n.tr("Enabled") : I18n.tr("Disabled")) - font.pixelSize: Theme.fontSizeSmall - color: Theme.surfaceVariantText - anchors.horizontalCenter: parent.horizontalCenter + Column { + spacing: 2 + width: (parent.width - Theme.spacingL * 2) / 3 + anchors.verticalCenter: parent.verticalCenter + visible: SessionData.themeModeAutoEnabled && SessionData.themeModeNextTransition + + Row { + spacing: Theme.spacingS + anchors.horizontalCenter: parent.horizontalCenter + + DankIcon { + name: "schedule" + size: Theme.iconSizeSmall + color: Theme.primary + anchors.verticalCenter: parent.verticalCenter + } + + StyledText { + text: I18n.tr("Next Transition") + font.pixelSize: Theme.fontSizeSmall + color: Theme.surfaceVariantText + anchors.verticalCenter: parent.verticalCenter + } + } + + StyledText { + text: themeColorsTab.formatThemeAutoTime(SessionData.themeModeNextTransition) + font.pixelSize: Theme.fontSizeSmall + font.weight: Font.Medium + color: Theme.surfaceText + horizontalAlignment: Text.AlignHCenter + width: parent.width + } } } }