diff --git a/quickshell/Modals/Settings/PowerSettings.qml b/quickshell/Modals/Settings/PowerSettings.qml index 5d6d82ae..d2afc280 100644 --- a/quickshell/Modals/Settings/PowerSettings.qml +++ b/quickshell/Modals/Settings/PowerSettings.qml @@ -10,12 +10,13 @@ Item { anchors.fill: parent anchors.topMargin: Theme.spacingL clip: true - contentHeight: mainColumn.height + contentHeight: mainColumn.height + Theme.spacingXL contentWidth: width Column { id: mainColumn - width: parent.width + width: Math.min(550, parent.width - Theme.spacingL * 2) + anchors.horizontalCenter: parent.horizontalCenter spacing: Theme.spacingXL StyledRect { diff --git a/quickshell/Modals/Settings/ProfileSection.qml b/quickshell/Modals/Settings/ProfileSection.qml index a1bd6bcf..66e5bc4f 100644 --- a/quickshell/Modals/Settings/ProfileSection.qml +++ b/quickshell/Modals/Settings/ProfileSection.qml @@ -1,5 +1,4 @@ import QtQuick -import QtQuick.Effects import qs.Common import qs.Services import qs.Widgets @@ -81,7 +80,6 @@ Rectangle { } } } - } Rectangle { @@ -105,11 +103,8 @@ Rectangle { return PortalService.setProfileImage(""); } } - } - } - } MouseArea { @@ -121,7 +116,6 @@ Rectangle { propagateComposedEvents: true acceptedButtons: Qt.NoButton } - } Column { @@ -145,9 +139,6 @@ Rectangle { elide: Text.ElideRight width: parent.width } - } - } - } diff --git a/quickshell/Modals/Settings/SettingsContent.qml b/quickshell/Modals/Settings/SettingsContent.qml index 805d96d5..fb574a20 100644 --- a/quickshell/Modals/Settings/SettingsContent.qml +++ b/quickshell/Modals/Settings/SettingsContent.qml @@ -13,7 +13,7 @@ FocusScope { Rectangle { anchors.fill: parent anchors.leftMargin: Theme.spacingS - anchors.rightMargin: 0 + anchors.rightMargin: (parentModal && parentModal.isCompactMode) ? Theme.spacingS : (32 + Theme.spacingS) anchors.bottomMargin: 0 anchors.topMargin: 0 color: "transparent" @@ -30,15 +30,13 @@ FocusScope { PersonalizationTab { parentModal: root.parentModal } - } onActiveChanged: { if (active && item) { - Qt.callLater(() => item.forceActiveFocus()) + Qt.callLater(() => item.forceActiveFocus()); } } - } Loader { @@ -49,15 +47,13 @@ FocusScope { visible: active focus: active - sourceComponent: TimeWeatherTab { - } + sourceComponent: TimeWeatherTab {} onActiveChanged: { if (active && item) { - Qt.callLater(() => item.forceActiveFocus()) + Qt.callLater(() => item.forceActiveFocus()); } } - } Loader { @@ -74,10 +70,9 @@ FocusScope { onActiveChanged: { if (active && item) { - Qt.callLater(() => item.forceActiveFocus()) + Qt.callLater(() => item.forceActiveFocus()); } } - } Loader { @@ -88,15 +83,13 @@ FocusScope { visible: active focus: active - sourceComponent: WidgetTweaksTab { - } + sourceComponent: WidgetTweaksTab {} onActiveChanged: { if (active && item) { - Qt.callLater(() => item.forceActiveFocus()) + Qt.callLater(() => item.forceActiveFocus()); } } - } Loader { @@ -108,17 +101,14 @@ FocusScope { focus: active sourceComponent: Component { - DockTab { - } - + DockTab {} } onActiveChanged: { if (active && item) { - Qt.callLater(() => item.forceActiveFocus()) + Qt.callLater(() => item.forceActiveFocus()); } } - } Loader { @@ -129,15 +119,13 @@ FocusScope { visible: active focus: active - sourceComponent: DisplaysTab { - } + sourceComponent: DisplaysTab {} onActiveChanged: { if (active && item) { - Qt.callLater(() => item.forceActiveFocus()) + Qt.callLater(() => item.forceActiveFocus()); } } - } Loader { @@ -148,15 +136,13 @@ FocusScope { visible: active focus: active - sourceComponent: LauncherTab { - } + sourceComponent: LauncherTab {} onActiveChanged: { if (active && item) { - Qt.callLater(() => item.forceActiveFocus()) + Qt.callLater(() => item.forceActiveFocus()); } } - } Loader { @@ -167,15 +153,13 @@ FocusScope { visible: active focus: active - sourceComponent: ThemeColorsTab { - } + sourceComponent: ThemeColorsTab {} onActiveChanged: { if (active && item) { - Qt.callLater(() => item.forceActiveFocus()) + Qt.callLater(() => item.forceActiveFocus()); } } - } Loader { @@ -186,15 +170,13 @@ FocusScope { visible: active focus: active - sourceComponent: PowerSettings { - } + sourceComponent: PowerSettings {} onActiveChanged: { if (active && item) { - Qt.callLater(() => item.forceActiveFocus()) + Qt.callLater(() => item.forceActiveFocus()); } } - } Loader { @@ -211,10 +193,9 @@ FocusScope { onActiveChanged: { if (active && item) { - Qt.callLater(() => item.forceActiveFocus()) + Qt.callLater(() => item.forceActiveFocus()); } } - } Loader { @@ -225,17 +206,13 @@ FocusScope { visible: active focus: active - sourceComponent: AboutTab { - } + sourceComponent: AboutTab {} onActiveChanged: { if (active && item) { - Qt.callLater(() => item.forceActiveFocus()) + Qt.callLater(() => item.forceActiveFocus()); } } - } - } - } diff --git a/quickshell/Modals/Settings/SettingsModal.qml b/quickshell/Modals/Settings/SettingsModal.qml index 46b2cfcf..b7df98fe 100644 --- a/quickshell/Modals/Settings/SettingsModal.qml +++ b/quickshell/Modals/Settings/SettingsModal.qml @@ -234,9 +234,7 @@ FloatingWindow { SettingsContent { id: content - width: Math.min(550, parent.width - Theme.spacingL * 2) - height: parent.height - anchors.horizontalCenter: parent.horizontalCenter + anchors.fill: parent parentModal: settingsModal currentIndex: settingsModal.currentTabIndex } diff --git a/quickshell/Modules/Settings/AboutTab.qml b/quickshell/Modules/Settings/AboutTab.qml index 921cd50d..2ff702e4 100644 --- a/quickshell/Modules/Settings/AboutTab.qml +++ b/quickshell/Modules/Settings/AboutTab.qml @@ -1,7 +1,5 @@ import QtQuick -import QtQuick.Controls import QtQuick.Effects -import Quickshell.Widgets import qs.Common import qs.Services import qs.Widgets @@ -16,50 +14,70 @@ Item { property bool isLabwc: CompositorService.isLabwc property string compositorName: { - if (isHyprland) return "hyprland" - if (isSway) return "sway" - if (isDwl) return "mangowc" - if (isLabwc) return "labwc" - return "niri" + if (isHyprland) + return "hyprland"; + if (isSway) + return "sway"; + if (isDwl) + return "mangowc"; + if (isLabwc) + return "labwc"; + return "niri"; } property string compositorLogo: { - if (isHyprland) return "/assets/hyprland.svg" - if (isSway) return "/assets/sway.svg" - if (isDwl) return "/assets/mango.png" - if (isLabwc) return "/assets/labwc.png" - return "/assets/niri.svg" + if (isHyprland) + return "/assets/hyprland.svg"; + if (isSway) + return "/assets/sway.svg"; + if (isDwl) + return "/assets/mango.png"; + if (isLabwc) + return "/assets/labwc.png"; + return "/assets/niri.svg"; } property string compositorUrl: { - if (isHyprland) return "https://hypr.land" - if (isSway) return "https://swaywm.org" - if (isDwl) return "https://github.com/DreamMaoMao/mangowc" - if (isLabwc) return "https://labwc.github.io/" - return "https://github.com/YaLTeR/niri" + if (isHyprland) + return "https://hypr.land"; + if (isSway) + return "https://swaywm.org"; + if (isDwl) + return "https://github.com/DreamMaoMao/mangowc"; + if (isLabwc) + return "https://labwc.github.io/"; + return "https://github.com/YaLTeR/niri"; } property string compositorTooltip: { - if (isHyprland) return "Hyprland Website" - if (isSway) return "Sway Website" - if (isDwl) return "mangowc GitHub" - if (isLabwc) return "LabWC Website" - return "niri GitHub" + if (isHyprland) + return "Hyprland Website"; + if (isSway) + return "Sway Website"; + if (isDwl) + return "mangowc GitHub"; + if (isLabwc) + return "LabWC Website"; + return "niri GitHub"; } property string dmsDiscordUrl: "https://discord.gg/ppWTpKmPgT" property string dmsDiscordTooltip: "niri/dms Discord" property string compositorDiscordUrl: { - if (isHyprland) return "https://discord.com/invite/hQ9XvMUjjr" - if (isDwl) return "https://discord.gg/CPjbDxesh5" - return "" + if (isHyprland) + return "https://discord.com/invite/hQ9XvMUjjr"; + if (isDwl) + return "https://discord.gg/CPjbDxesh5"; + return ""; } property string compositorDiscordTooltip: { - if (isHyprland) return "Hyprland Discord Server" - if (isDwl) return "mangowc Discord Server" - return "" + if (isHyprland) + return "Hyprland Discord Server"; + if (isDwl) + return "mangowc Discord Server"; + return ""; } property string redditUrl: "https://reddit.com/r/niri" @@ -76,13 +94,14 @@ Item { DankFlickable { anchors.fill: parent clip: true - contentHeight: mainColumn.height + contentHeight: mainColumn.height + Theme.spacingXL contentWidth: width Column { id: mainColumn - width: parent.width + width: Math.min(550, parent.width - Theme.spacingL * 2) + anchors.horizontalCenter: parent.horizontalCenter spacing: Theme.spacingXL // ASCII Art Header @@ -91,8 +110,7 @@ Item { height: asciiSection.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 Column { @@ -157,20 +175,20 @@ Item { anchors.horizontalCenter: parent.horizontalCenter height: 24 width: { - let baseWidth = compositorButton.width + dmsDiscordButton.width + Theme.spacingM + let baseWidth = compositorButton.width + dmsDiscordButton.width + Theme.spacingM; if (showMatrix) { - baseWidth += matrixButton.width + 4 + baseWidth += matrixButton.width + 4; } if (showIrc) { - baseWidth += ircButton.width + Theme.spacingM + baseWidth += ircButton.width + Theme.spacingM; } if (showCompositorDiscord) { - baseWidth += compositorDiscordButton.width + Theme.spacingM + baseWidth += compositorDiscordButton.width + Theme.spacingM; } if (showReddit) { - baseWidth += redditButton.width + Theme.spacingM + baseWidth += redditButton.width + Theme.spacingM; } - return baseWidth + return baseWidth; } Item { @@ -186,10 +204,7 @@ Item { Image { anchors.fill: parent - source: Qt.resolvedUrl(".").toString().replace( - "file://", "").replace( - "/Modules/Settings/", - "") + compositorLogo + source: Qt.resolvedUrl(".").toString().replace("file://", "").replace("/Modules/Settings/", "") + compositorLogo sourceSize: Qt.size(24, 24) smooth: true fillMode: Image.PreserveAspectFit @@ -217,10 +232,7 @@ Item { Image { anchors.fill: parent - source: Qt.resolvedUrl(".").toString().replace( - "file://", "").replace( - "/Modules/Settings/", - "") + "/assets/matrix-logo-white.svg" + source: Qt.resolvedUrl(".").toString().replace("file://", "").replace("/Modules/Settings/", "") + "/assets/matrix-logo-white.svg" sourceSize: Qt.size(28, 18) smooth: true fillMode: Image.PreserveAspectFit @@ -238,8 +250,7 @@ Item { hoverEnabled: true onEntered: parent.hovered = true onExited: parent.hovered = false - onClicked: Qt.openUrlExternally( - "https://matrix.to/#/#niri:matrix.org") + onClicked: Qt.openUrlExternally("https://matrix.to/#/#niri:matrix.org") } } @@ -276,9 +287,11 @@ Item { width: 20 height: 20 x: { - if (showMatrix) return matrixButton.x + matrixButton.width + Theme.spacingM - if (showIrc) return ircButton.x + ircButton.width + Theme.spacingM - return compositorButton.x + compositorButton.width + Theme.spacingM + if (showMatrix) + return matrixButton.x + matrixButton.width + Theme.spacingM; + if (showIrc) + return ircButton.x + ircButton.width + Theme.spacingM; + return compositorButton.x + compositorButton.width + Theme.spacingM; } anchors.verticalCenter: parent.verticalCenter @@ -287,10 +300,7 @@ Item { Image { anchors.fill: parent - source: Qt.resolvedUrl(".").toString().replace( - "file://", "").replace( - "/Modules/Settings/", - "") + "/assets/discord.svg" + source: Qt.resolvedUrl(".").toString().replace("file://", "").replace("/Modules/Settings/", "") + "/assets/discord.svg" sourceSize: Qt.size(20, 20) smooth: true fillMode: Image.PreserveAspectFit @@ -319,10 +329,7 @@ Item { Image { anchors.fill: parent - source: Qt.resolvedUrl(".").toString().replace( - "file://", "").replace( - "/Modules/Settings/", - "") + "/assets/discord.svg" + source: Qt.resolvedUrl(".").toString().replace("file://", "").replace("/Modules/Settings/", "") + "/assets/discord.svg" sourceSize: Qt.size(20, 20) smooth: true fillMode: Image.PreserveAspectFit @@ -351,10 +358,7 @@ Item { Image { anchors.fill: parent - source: Qt.resolvedUrl(".").toString().replace( - "file://", "").replace( - "/Modules/Settings/", - "") + "/assets/reddit.svg" + source: Qt.resolvedUrl(".").toString().replace("file://", "").replace("/Modules/Settings/", "") + "/assets/reddit.svg" sourceSize: Qt.size(20, 20) smooth: true fillMode: Image.PreserveAspectFit @@ -373,15 +377,13 @@ Item { } } - // Project Information StyledRect { width: parent.width height: projectSection.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 Column { @@ -438,8 +440,7 @@ Item { height: techSection.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 Column { @@ -600,8 +601,7 @@ Item { height: supportSection.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 Row { @@ -648,7 +648,6 @@ Item { } } } - } } @@ -659,13 +658,19 @@ Item { z: 1000 property var hoveredButton: { - if (compositorButton.hovered) return compositorButton - if (matrixButton.visible && matrixButton.hovered) return matrixButton - if (ircButton.visible && ircButton.hovered) return ircButton - if (dmsDiscordButton.hovered) return dmsDiscordButton - if (compositorDiscordButton.visible && compositorDiscordButton.hovered) return compositorDiscordButton - if (redditButton.visible && redditButton.hovered) return redditButton - return null + if (compositorButton.hovered) + return compositorButton; + if (matrixButton.visible && matrixButton.hovered) + return matrixButton; + if (ircButton.visible && ircButton.hovered) + return ircButton; + if (dmsDiscordButton.hovered) + return dmsDiscordButton; + if (compositorDiscordButton.visible && compositorDiscordButton.hovered) + return compositorDiscordButton; + if (redditButton.visible && redditButton.hovered) + return redditButton; + return null; } property string tooltipText: hoveredButton ? hoveredButton.tooltipText : "" diff --git a/quickshell/Modules/Settings/DankBarTab.qml b/quickshell/Modules/Settings/DankBarTab.qml index 789d78e6..771ddf88 100644 --- a/quickshell/Modules/Settings/DankBarTab.qml +++ b/quickshell/Modules/Settings/DankBarTab.qml @@ -1075,12 +1075,13 @@ Item { DankFlickable { anchors.fill: parent clip: true - contentHeight: mainColumn.height + contentHeight: mainColumn.height + Theme.spacingXL contentWidth: width Column { id: mainColumn - width: parent.width + width: Math.min(550, parent.width - Theme.spacingL * 2) + anchors.horizontalCenter: parent.horizontalCenter spacing: Theme.spacingXL StyledRect { diff --git a/quickshell/Modules/Settings/DisplaysTab.qml b/quickshell/Modules/Settings/DisplaysTab.qml index 41daf873..b02e9dc0 100644 --- a/quickshell/Modules/Settings/DisplaysTab.qml +++ b/quickshell/Modules/Settings/DisplaysTab.qml @@ -1,5 +1,4 @@ import QtQuick -import QtQuick.Controls import QtQuick.Layouts import Quickshell import qs.Common @@ -10,81 +9,88 @@ Item { id: displaysTab function getBarComponentsFromSettings() { - const bars = SettingsData.barConfigs || [] + const bars = SettingsData.barConfigs || []; return bars.map(bar => ({ - "id": "bar:" + bar.id, - "name": bar.name || "Bar", - "description": I18n.tr("Individual bar configuration"), - "icon": "toolbar", - "barId": bar.id - })) + "id": "bar:" + bar.id, + "name": bar.name || "Bar", + "description": I18n.tr("Individual bar configuration"), + "icon": "toolbar", + "barId": bar.id + })); } property var variantComponents: getVariantComponentsList() function getVariantComponentsList() { - return [ - ...getBarComponentsFromSettings(), + return [...getBarComponentsFromSettings(), { "id": "dock", "name": I18n.tr("Application Dock"), "description": I18n.tr("Bottom dock for pinned and running applications"), "icon": "dock" - }, { + }, + { "id": "notifications", "name": I18n.tr("Notification Popups"), "description": I18n.tr("Notification toast popups"), "icon": "notifications" - }, { + }, + { "id": "wallpaper", "name": I18n.tr("Wallpaper"), "description": I18n.tr("Desktop background images"), "icon": "wallpaper" - }, { + }, + { "id": "osd", "name": I18n.tr("On-Screen Displays"), "description": I18n.tr("Volume, brightness, and other system OSDs"), "icon": "picture_in_picture" - }, { + }, + { "id": "toast", "name": I18n.tr("Toast Messages"), "description": I18n.tr("System toast notifications"), "icon": "campaign" - }, { + }, + { "id": "notepad", "name": I18n.tr("Notepad Slideout"), "description": I18n.tr("Quick note-taking slideout panel"), "icon": "sticky_note_2" - }, { + }, + { "id": "systemTray", "name": I18n.tr("System Tray"), "description": I18n.tr("System tray icons"), "icon": "notifications" } - ] + ]; } Connections { target: SettingsData function onBarConfigsChanged() { - variantComponents = getVariantComponentsList() + variantComponents = getVariantComponentsList(); } } function getScreenPreferences(componentId) { if (componentId.startsWith("bar:")) { - const barId = componentId.substring(4) - const barConfig = SettingsData.getBarConfig(barId) - return barConfig?.screenPreferences || ["all"] + const barId = componentId.substring(4); + const barConfig = SettingsData.getBarConfig(barId); + return barConfig?.screenPreferences || ["all"]; } return SettingsData.screenPreferences && SettingsData.screenPreferences[componentId] || ["all"]; } function setScreenPreferences(componentId, screenNames) { if (componentId.startsWith("bar:")) { - const barId = componentId.substring(4) - SettingsData.updateBarConfig(barId, { screenPreferences: screenNames }) - return + const barId = componentId.substring(4); + SettingsData.updateBarConfig(barId, { + screenPreferences: screenNames + }); + return; } var prefs = SettingsData.screenPreferences || {}; var newPrefs = Object.assign({}, prefs); @@ -94,18 +100,20 @@ Item { function getShowOnLastDisplay(componentId) { if (componentId.startsWith("bar:")) { - const barId = componentId.substring(4) - const barConfig = SettingsData.getBarConfig(barId) - return barConfig?.showOnLastDisplay ?? true + const barId = componentId.substring(4); + const barConfig = SettingsData.getBarConfig(barId); + return barConfig?.showOnLastDisplay ?? true; } return SettingsData.showOnLastDisplay && SettingsData.showOnLastDisplay[componentId] || false; } function setShowOnLastDisplay(componentId, enabled) { if (componentId.startsWith("bar:")) { - const barId = componentId.substring(4) - SettingsData.updateBarConfig(barId, { showOnLastDisplay: enabled }) - return + const barId = componentId.substring(4); + SettingsData.updateBarConfig(barId, { + showOnLastDisplay: enabled + }); + return; } var prefs = SettingsData.showOnLastDisplay || {}; var newPrefs = Object.assign({}, prefs); @@ -116,13 +124,14 @@ Item { DankFlickable { anchors.fill: parent clip: true - contentHeight: mainColumn.height + contentHeight: mainColumn.height + Theme.spacingXL contentWidth: width Column { id: mainColumn - width: parent.width + width: Math.min(550, parent.width - Theme.spacingL * 2) + anchors.horizontalCenter: parent.horizontalCenter spacing: Theme.spacingXL StyledRect { @@ -169,12 +178,12 @@ Item { checked: DisplayService.nightModeEnabled enabled: DisplayService.gammaControlAvailable onToggled: checked => { - DisplayService.toggleNightMode() - } + DisplayService.toggleNightMode(); + } Connections { function onNightModeEnabledChanged() { - nightModeToggle.checked = DisplayService.nightModeEnabled + nightModeToggle.checked = DisplayService.nightModeEnabled; } target: DisplayService @@ -194,19 +203,19 @@ Item { description: I18n.tr("Color temperature for night mode") currentValue: SessionData.nightModeTemperature + "K" options: { - var temps = [] + var temps = []; for (var i = 2500; i <= 6000; i += 500) { - temps.push(i + "K") + temps.push(i + "K"); } - return temps + return temps; } onValueChanged: value => { - var temp = parseInt(value.replace("K", "")) - SessionData.setNightModeTemperature(temp) - if (SessionData.nightModeHighTemperature < temp) { - SessionData.setNightModeHighTemperature(temp) - } - } + var temp = parseInt(value.replace("K", "")); + SessionData.setNightModeTemperature(temp); + if (SessionData.nightModeHighTemperature < temp) { + SessionData.setNightModeHighTemperature(temp); + } + } } DankDropdown { @@ -215,19 +224,19 @@ Item { description: I18n.tr("Color temperature for day time") currentValue: SessionData.nightModeHighTemperature + "K" options: { - var temps = [] - var minTemp = SessionData.nightModeTemperature + var temps = []; + var minTemp = SessionData.nightModeTemperature; for (var i = Math.max(2500, minTemp); i <= 10000; i += 500) { - temps.push(i + "K") + temps.push(i + "K"); } - return temps + return temps; } onValueChanged: value => { - var temp = parseInt(value.replace("K", "")) - if (temp >= SessionData.nightModeTemperature) { - SessionData.setNightModeHighTemperature(temp) - } - } + var temp = parseInt(value.replace("K", "")); + if (temp >= SessionData.nightModeTemperature) { + SessionData.setNightModeHighTemperature(temp); + } + } } } @@ -239,18 +248,18 @@ Item { checked: SessionData.nightModeAutoEnabled visible: DisplayService.gammaControlAvailable onToggled: checked => { - if (checked && !DisplayService.nightModeEnabled) { - DisplayService.toggleNightMode() - } else if (!checked && DisplayService.nightModeEnabled) { - DisplayService.toggleNightMode() - } - SessionData.setNightModeAutoEnabled(checked) - } + if (checked && !DisplayService.nightModeEnabled) { + DisplayService.toggleNightMode(); + } else if (!checked && DisplayService.nightModeEnabled) { + DisplayService.toggleNightMode(); + } + SessionData.setNightModeAutoEnabled(checked); + } Connections { target: SessionData function onNightModeAutoEnabledChanged() { - automaticToggle.checked = SessionData.nightModeAutoEnabled + automaticToggle.checked = SessionData.nightModeAutoEnabled; } } } @@ -264,7 +273,7 @@ Item { Connections { target: SessionData function onNightModeAutoEnabledChanged() { - automaticSettings.visible = SessionData.nightModeAutoEnabled + automaticSettings.visible = SessionData.nightModeAutoEnabled; } } @@ -277,29 +286,32 @@ Item { width: 200 height: 45 anchors.horizontalCenter: parent.horizontalCenter - model: [{ + model: [ + { "text": "Time", "icon": "access_time" - }, { + }, + { "text": "Location", "icon": "place" - }] + } + ] Component.onCompleted: { - currentIndex = SessionData.nightModeAutoMode === "location" ? 1 : 0 - Qt.callLater(updateIndicator) + currentIndex = SessionData.nightModeAutoMode === "location" ? 1 : 0; + Qt.callLater(updateIndicator); } onTabClicked: index => { - DisplayService.setNightModeAutomationMode(index === 1 ? "location" : "time") - currentIndex = index - } + DisplayService.setNightModeAutomationMode(index === 1 ? "location" : "time"); + currentIndex = index; + } Connections { target: SessionData function onNightModeAutoModeChanged() { - modeTabBarNight.currentIndex = SessionData.nightModeAutoMode === "location" ? 1 : 0 - Qt.callLater(modeTabBarNight.updateIndicator) + modeTabBarNight.currentIndex = SessionData.nightModeAutoMode === "location" ? 1 : 0; + Qt.callLater(modeTabBarNight.updateIndicator); } } } @@ -356,30 +368,30 @@ Item { dropdownWidth: 70 currentValue: SessionData.nightModeStartHour.toString() options: { - var hours = [] + var hours = []; for (var i = 0; i < 24; i++) { - hours.push(i.toString()) + hours.push(i.toString()); } - return hours + return hours; } onValueChanged: value => { - SessionData.setNightModeStartHour(parseInt(value)) - } + SessionData.setNightModeStartHour(parseInt(value)); + } } DankDropdown { dropdownWidth: 70 currentValue: SessionData.nightModeStartMinute.toString().padStart(2, '0') options: { - var minutes = [] + var minutes = []; for (var i = 0; i < 60; i += 5) { - minutes.push(i.toString().padStart(2, '0')) + minutes.push(i.toString().padStart(2, '0')); } - return minutes + return minutes; } onValueChanged: value => { - SessionData.setNightModeStartMinute(parseInt(value)) - } + SessionData.setNightModeStartMinute(parseInt(value)); + } } } @@ -399,30 +411,30 @@ Item { dropdownWidth: 70 currentValue: SessionData.nightModeEndHour.toString() options: { - var hours = [] + var hours = []; for (var i = 0; i < 24; i++) { - hours.push(i.toString()) + hours.push(i.toString()); } - return hours + return hours; } onValueChanged: value => { - SessionData.setNightModeEndHour(parseInt(value)) - } + SessionData.setNightModeEndHour(parseInt(value)); + } } DankDropdown { dropdownWidth: 70 currentValue: SessionData.nightModeEndMinute.toString().padStart(2, '0') options: { - var minutes = [] + var minutes = []; for (var i = 0; i < 60; i += 5) { - minutes.push(i.toString().padStart(2, '0')) + minutes.push(i.toString().padStart(2, '0')); } - return minutes + return minutes; } onValueChanged: value => { - SessionData.setNightModeEndMinute(parseInt(value)) - } + SessionData.setNightModeEndMinute(parseInt(value)); + } } } } @@ -441,13 +453,13 @@ Item { description: I18n.tr("Automatically detect location based on IP address") checked: SessionData.nightModeUseIPLocation || false onToggled: checked => { - SessionData.setNightModeUseIPLocation(checked) + SessionData.setNightModeUseIPLocation(checked); } Connections { target: SessionData function onNightModeUseIPLocationChanged() { - ipLocationToggle.checked = SessionData.nightModeUseIPLocation + ipLocationToggle.checked = SessionData.nightModeUseIPLocation; } } } @@ -482,9 +494,9 @@ Item { text: SessionData.latitude.toString() placeholderText: "0.0" onEditingFinished: { - const lat = parseFloat(text) + const lat = parseFloat(text); if (!isNaN(lat) && lat >= -90 && lat <= 90 && lat !== SessionData.latitude) { - SessionData.setLatitude(lat) + SessionData.setLatitude(lat); } } } @@ -505,9 +517,9 @@ Item { text: SessionData.longitude.toString() placeholderText: "0.0" onEditingFinished: { - const lon = parseFloat(text) + const lon = parseFloat(text); if (!isNaN(lon) && lon >= -180 && lon <= 180 && lon !== SessionData.longitude) { - SessionData.setLongitude(lon) + SessionData.setLongitude(lon); } } } @@ -572,9 +584,7 @@ Item { wrapMode: Text.WordWrap width: parent.width } - } - } Column { @@ -618,15 +628,16 @@ Item { model: [I18n.tr("Name"), I18n.tr("Model")] currentIndex: SettingsData.displayNameMode === "model" ? 1 : 0 onSelectionChanged: (index, selected) => { - if (!selected) return - SettingsData.displayNameMode = index === 1 ? "model" : "system" - SettingsData.saveSettings() + if (!selected) + return; + SettingsData.displayNameMode = index === 1 ? "model" : "system"; + SettingsData.saveSettings(); } Connections { target: SettingsData function onDisplayNameModeChanged() { - displayModeGroup.currentIndex = SettingsData.displayNameMode === "model" ? 1 : 0 + displayModeGroup.currentIndex = SettingsData.displayNameMode === "model" ? 1 : 0; } } } @@ -691,21 +702,13 @@ Item { font.pixelSize: Theme.fontSizeSmall color: Theme.surfaceVariantText } - } - } - } - } - } - } - } - } Column { @@ -760,9 +763,7 @@ Item { wrapMode: Text.WordWrap width: parent.width } - } - } Column { @@ -787,17 +788,17 @@ Item { text: I18n.tr("All displays") description: I18n.tr("Show on all connected displays") checked: { - var prefs = displaysTab.getScreenPreferences(parent.componentId) - return prefs.includes("all") || (typeof prefs[0] === "string" && prefs[0] === "all") + var prefs = displaysTab.getScreenPreferences(parent.componentId); + return prefs.includes("all") || (typeof prefs[0] === "string" && prefs[0] === "all"); } - onToggled: (checked) => { + onToggled: checked => { if (checked) { - displaysTab.setScreenPreferences(parent.componentId, ["all"]) + displaysTab.setScreenPreferences(parent.componentId, ["all"]); } else { - displaysTab.setScreenPreferences(parent.componentId, []) - const cid = parent.componentId + displaysTab.setScreenPreferences(parent.componentId, []); + const cid = parent.componentId; if (["dankBar", "dock", "notifications", "osd", "toast"].includes(cid) || cid.startsWith("bar:")) { - displaysTab.setShowOnLastDisplay(cid, true) + displaysTab.setShowOnLastDisplay(cid, true); } } } @@ -809,14 +810,14 @@ Item { description: I18n.tr("Always show when there's only one connected display") checked: displaysTab.getShowOnLastDisplay(parent.componentId) visible: { - const prefs = displaysTab.getScreenPreferences(parent.componentId) - const isAll = prefs.includes("all") || (typeof prefs[0] === "string" && prefs[0] === "all") - const cid = parent.componentId - const isRelevantComponent = ["dankBar", "dock", "notifications", "osd", "toast", "notepad", "systemTray"].includes(cid) || cid.startsWith("bar:") - return !isAll && isRelevantComponent + const prefs = displaysTab.getScreenPreferences(parent.componentId); + const isAll = prefs.includes("all") || (typeof prefs[0] === "string" && prefs[0] === "all"); + const cid = parent.componentId; + const isRelevantComponent = ["dankBar", "dock", "notifications", "osd", "toast", "notepad", "systemTray"].includes(cid) || cid.startsWith("bar:"); + return !isAll && isRelevantComponent; } - onToggled: (checked) => { - displaysTab.setShowOnLastDisplay(parent.componentId, checked) + onToggled: checked => { + displaysTab.setShowOnLastDisplay(parent.componentId, checked); } } @@ -826,8 +827,8 @@ Item { color: Theme.outline opacity: 0.2 visible: { - var prefs = displaysTab.getScreenPreferences(parent.componentId) - return !prefs.includes("all") && !(typeof prefs[0] === "string" && prefs[0] === "all") + var prefs = displaysTab.getScreenPreferences(parent.componentId); + return !prefs.includes("all") && !(typeof prefs[0] === "string" && prefs[0] === "all"); } } @@ -835,8 +836,8 @@ Item { width: parent.width spacing: Theme.spacingXS visible: { - var prefs = displaysTab.getScreenPreferences(parent.componentId) - return !prefs.includes("all") && !(typeof prefs[0] === "string" && prefs[0] === "all") + var prefs = displaysTab.getScreenPreferences(parent.componentId); + return !prefs.includes("all") && !(typeof prefs[0] === "string" && prefs[0] === "all"); } Repeater { @@ -850,50 +851,41 @@ Item { text: SettingsData.getScreenDisplayName(screenData) description: screenData.width + "×" + screenData.height + " • " + (SettingsData.displayNameMode === "system" ? (screenData.model || "Unknown Model") : screenData.name) checked: { - var prefs = displaysTab.getScreenPreferences(componentId) - if (typeof prefs[0] === "string" && prefs[0] === "all") return false - return SettingsData.isScreenInPreferences(screenData, prefs) + var prefs = displaysTab.getScreenPreferences(componentId); + if (typeof prefs[0] === "string" && prefs[0] === "all") + return false; + return SettingsData.isScreenInPreferences(screenData, prefs); } - onToggled: (checked) => { - var currentPrefs = displaysTab.getScreenPreferences(componentId) + onToggled: checked => { + var currentPrefs = displaysTab.getScreenPreferences(componentId); if (typeof currentPrefs[0] === "string" && currentPrefs[0] === "all") { - currentPrefs = [] + currentPrefs = []; } var newPrefs = currentPrefs.filter(pref => { - if (typeof pref === "string") return false - return pref.name !== screenData.name || pref.model !== screenData.model - }) + if (typeof pref === "string") + return false; + return pref.name !== screenData.name || pref.model !== screenData.model; + }); if (checked) { newPrefs.push({ name: screenData.name, model: screenData.model || "" - }) + }); } - displaysTab.setScreenPreferences(componentId, newPrefs) + displaysTab.setScreenPreferences(componentId, newPrefs); } } - } - } - } - } - } - } - } - } - } - } - -} \ No newline at end of file +} diff --git a/quickshell/Modules/Settings/DockTab.qml b/quickshell/Modules/Settings/DockTab.qml index 23ae986b..af02b9f9 100644 --- a/quickshell/Modules/Settings/DockTab.qml +++ b/quickshell/Modules/Settings/DockTab.qml @@ -1,6 +1,4 @@ import QtQuick -import QtQuick.Controls -import Quickshell.Widgets import qs.Common import qs.Services import qs.Widgets @@ -11,12 +9,13 @@ Item { DankFlickable { anchors.fill: parent clip: true - contentHeight: mainColumn.height + contentHeight: mainColumn.height + Theme.spacingXL contentWidth: width Column { id: mainColumn - width: parent.width + width: Math.min(550, parent.width - Theme.spacingL * 2) + anchors.horizontalCenter: parent.horizontalCenter spacing: Theme.spacingXL // Dock Position @@ -25,8 +24,7 @@ Item { height: dockPositionSection.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 Column { @@ -67,20 +65,33 @@ Item { model: ["Top", "Bottom", "Left", "Right"] currentIndex: { switch (SettingsData.dockPosition) { - case SettingsData.Position.Top: return 0 - case SettingsData.Position.Bottom: return 1 - case SettingsData.Position.Left: return 2 - case SettingsData.Position.Right: return 3 - default: return 1 + case SettingsData.Position.Top: + return 0; + case SettingsData.Position.Bottom: + return 1; + case SettingsData.Position.Left: + return 2; + case SettingsData.Position.Right: + return 3; + default: + return 1; } } onSelectionChanged: (index, selected) => { if (selected) { switch (index) { - case 0: SettingsData.setDockPosition(SettingsData.Position.Top); break - case 1: SettingsData.setDockPosition(SettingsData.Position.Bottom); break - case 2: SettingsData.setDockPosition(SettingsData.Position.Left); break - case 3: SettingsData.setDockPosition(SettingsData.Position.Right); break + case 0: + SettingsData.setDockPosition(SettingsData.Position.Top); + break; + case 1: + SettingsData.setDockPosition(SettingsData.Position.Bottom); + break; + case 2: + SettingsData.setDockPosition(SettingsData.Position.Left); + break; + case 3: + SettingsData.setDockPosition(SettingsData.Position.Right); + break; } } } @@ -95,8 +106,7 @@ Item { height: dockVisibilitySection.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 Column { @@ -118,8 +128,7 @@ Item { } Column { - width: parent.width - Theme.iconSize - Theme.spacingM - - enableToggle.width - Theme.spacingM + width: parent.width - Theme.iconSize - Theme.spacingM - enableToggle.width - Theme.spacingM spacing: Theme.spacingXS anchors.verticalCenter: parent.verticalCenter @@ -145,8 +154,8 @@ Item { anchors.verticalCenter: parent.verticalCenter checked: SettingsData.showDock onToggled: checked => { - SettingsData.setShowDock(checked) - } + SettingsData.setShowDock(checked); + } } } @@ -172,8 +181,7 @@ Item { } Column { - width: parent.width - Theme.iconSize - Theme.spacingM - - autoHideToggle.width - Theme.spacingM + width: parent.width - Theme.iconSize - Theme.spacingM - autoHideToggle.width - Theme.spacingM spacing: Theme.spacingXS anchors.verticalCenter: parent.verticalCenter @@ -199,8 +207,8 @@ Item { anchors.verticalCenter: parent.verticalCenter checked: SettingsData.dockAutoHide onToggled: checked => { - SettingsData.set("dockAutoHide", checked) - } + SettingsData.set("dockAutoHide", checked); + } } Behavior on opacity { @@ -232,8 +240,7 @@ Item { } Column { - width: parent.width - Theme.iconSize - Theme.spacingM - - overviewToggle.width - Theme.spacingM + width: parent.width - Theme.iconSize - Theme.spacingM - overviewToggle.width - Theme.spacingM spacing: Theme.spacingXS anchors.verticalCenter: parent.verticalCenter @@ -259,8 +266,8 @@ Item { anchors.verticalCenter: parent.verticalCenter checked: SettingsData.dockOpenOnOverview onToggled: checked => { - SettingsData.set("dockOpenOnOverview", checked) - } + SettingsData.set("dockOpenOnOverview", checked); + } } } } @@ -272,8 +279,7 @@ Item { height: groupByAppSection.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 Column { @@ -295,8 +301,7 @@ Item { } Column { - width: parent.width - Theme.iconSize - Theme.spacingM - - groupByAppToggle.width - Theme.spacingM + width: parent.width - Theme.iconSize - Theme.spacingM - groupByAppToggle.width - Theme.spacingM spacing: Theme.spacingXS anchors.verticalCenter: parent.verticalCenter @@ -322,8 +327,8 @@ Item { anchors.verticalCenter: parent.verticalCenter checked: SettingsData.dockGroupByApp onToggled: checked => { - SettingsData.set("dockGroupByApp", checked) - } + SettingsData.set("dockGroupByApp", checked); + } } } } @@ -335,8 +340,7 @@ Item { height: indicatorStyleSection.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 Column { @@ -378,7 +382,7 @@ Item { currentIndex: SettingsData.dockIndicatorStyle === "circle" ? 0 : 1 onSelectionChanged: (index, selected) => { if (selected) { - SettingsData.set("dockIndicatorStyle", index === 0 ? "circle" : "line") + SettingsData.set("dockIndicatorStyle", index === 0 ? "circle" : "line"); } } } @@ -392,8 +396,7 @@ Item { height: iconSizeSection.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 Column { @@ -437,7 +440,7 @@ Item { iconColor: Theme.surfaceText anchors.verticalCenter: parent.verticalCenter onClicked: { - SettingsData.set("dockIconSize", 48) + SettingsData.set("dockIconSize", 48); } } } @@ -453,8 +456,8 @@ Item { wheelEnabled: false thumbOutlineColor: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) onSliderValueChanged: newValue => { - SettingsData.set("dockIconSize", newValue) - } + SettingsData.set("dockIconSize", newValue); + } } } } @@ -465,8 +468,7 @@ Item { height: dockSpacingSection.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 Column { @@ -533,7 +535,7 @@ Item { iconColor: Theme.surfaceText anchors.verticalCenter: parent.verticalCenter onClicked: { - SettingsData.set("dockSpacing", 8) + SettingsData.set("dockSpacing", 8); } } @@ -554,9 +556,8 @@ Item { wheelEnabled: false thumbOutlineColor: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) onSliderValueChanged: newValue => { - SettingsData.set("dockSpacing", - newValue) - } + SettingsData.set("dockSpacing", newValue); + } } } @@ -597,7 +598,7 @@ Item { iconColor: Theme.surfaceText anchors.verticalCenter: parent.verticalCenter onClicked: { - SettingsData.set("dockBottomGap", 0) + SettingsData.set("dockBottomGap", 0); } } @@ -618,9 +619,8 @@ Item { wheelEnabled: false thumbOutlineColor: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) onSliderValueChanged: newValue => { - SettingsData.set("dockBottomGap", - newValue) - } + SettingsData.set("dockBottomGap", newValue); + } } } @@ -661,7 +661,7 @@ Item { iconColor: Theme.surfaceText anchors.verticalCenter: parent.verticalCenter onClicked: { - SettingsData.set("dockMargin", 0) + SettingsData.set("dockMargin", 0); } } @@ -682,8 +682,8 @@ Item { wheelEnabled: false thumbOutlineColor: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) onSliderValueChanged: newValue => { - SettingsData.set("dockMargin", newValue) - } + SettingsData.set("dockMargin", newValue); + } } } } @@ -695,8 +695,7 @@ Item { height: transparencySection.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 Column { @@ -740,7 +739,7 @@ Item { iconColor: Theme.surfaceText anchors.verticalCenter: parent.verticalCenter onClicked: { - SettingsData.set("dockTransparency", 0.85) + SettingsData.set("dockTransparency", 0.85); } } } @@ -756,9 +755,8 @@ Item { wheelEnabled: false thumbOutlineColor: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) onSliderValueChanged: newValue => { - SettingsData.set("dockTransparency", - newValue / 100) - } + SettingsData.set("dockTransparency", newValue / 100); + } } } } diff --git a/quickshell/Modules/Settings/LauncherTab.qml b/quickshell/Modules/Settings/LauncherTab.qml index 229a95ca..652fceb5 100644 --- a/quickshell/Modules/Settings/LauncherTab.qml +++ b/quickshell/Modules/Settings/LauncherTab.qml @@ -1,9 +1,5 @@ import QtQuick -import QtQuick.Controls -import Quickshell -import Quickshell.Widgets import qs.Common -import qs.Modals import qs.Modals.FileBrowser import qs.Services import qs.Widgets @@ -18,19 +14,20 @@ Item { browserType: "generic" filterExtensions: ["*.svg", "*.png", "*.jpg", "*.jpeg", "*.webp"] onFileSelected: path => { - SettingsData.set("launcherLogoCustomPath", path.replace("file://", "")) + SettingsData.set("launcherLogoCustomPath", path.replace("file://", "")); } } DankFlickable { anchors.fill: parent clip: true - contentHeight: mainColumn.height + contentHeight: mainColumn.height + Theme.spacingXL contentWidth: width Column { id: mainColumn - width: parent.width + width: Math.min(550, parent.width - Theme.spacingL * 2) + anchors.horizontalCenter: parent.horizontalCenter spacing: Theme.spacingXL StyledRect { @@ -38,8 +35,7 @@ Item { height: launcherLogoSection.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 Column { @@ -85,41 +81,47 @@ Item { id: logoModeGroup anchors.horizontalCenter: parent.horizontalCenter 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) { - modes.push("niri") + modes.push("niri"); } else if (CompositorService.isHyprland) { - modes.push("Hyprland") + modes.push("Hyprland"); } else if (CompositorService.isDwl) { - modes.push("mango") + modes.push("mango"); } else if (CompositorService.isSway) { - modes.push("Sway") + modes.push("Sway"); } else { - modes.push(I18n.tr("Compositor")) + modes.push(I18n.tr("Compositor")); } - modes.push(I18n.tr("Custom")) - return modes + modes.push(I18n.tr("Custom")); + return modes; } currentIndex: { - if (SettingsData.launcherLogoMode === "apps") return 0 - if (SettingsData.launcherLogoMode === "os") return 1 - if (SettingsData.launcherLogoMode === "dank") return 2 - if (SettingsData.launcherLogoMode === "compositor") return 3 - if (SettingsData.launcherLogoMode === "custom") return 4 - return 0 + if (SettingsData.launcherLogoMode === "apps") + return 0; + if (SettingsData.launcherLogoMode === "os") + return 1; + if (SettingsData.launcherLogoMode === "dank") + return 2; + if (SettingsData.launcherLogoMode === "compositor") + return 3; + if (SettingsData.launcherLogoMode === "custom") + return 4; + return 0; } onSelectionChanged: (index, selected) => { - if (!selected) return + if (!selected) + return; if (index === 0) { - SettingsData.set("launcherLogoMode", "apps") + SettingsData.set("launcherLogoMode", "apps"); } else if (index === 1) { - SettingsData.set("launcherLogoMode", "os") + SettingsData.set("launcherLogoMode", "os"); } else if (index === 2) { - SettingsData.set("launcherLogoMode", "dank") + SettingsData.set("launcherLogoMode", "dank"); } else if (index === 3) { - SettingsData.set("launcherLogoMode", "compositor") + SettingsData.set("launcherLogoMode", "compositor"); } else if (index === 4) { - SettingsData.set("launcherLogoMode", "custom") + SettingsData.set("launcherLogoMode", "custom"); } } } @@ -200,25 +202,29 @@ Item { id: colorModeGroup model: [I18n.tr("Default"), I18n.tr("Primary"), I18n.tr("Surface"), I18n.tr("Custom")] currentIndex: { - const override = SettingsData.launcherLogoColorOverride - if (override === "") return 0 - if (override === "primary") return 1 - if (override === "surface") return 2 - return 3 + const override = SettingsData.launcherLogoColorOverride; + if (override === "") + return 0; + if (override === "primary") + return 1; + if (override === "surface") + return 2; + return 3; } onSelectionChanged: (index, selected) => { - if (!selected) return + if (!selected) + return; if (index === 0) { - SettingsData.set("launcherLogoColorOverride", "") + SettingsData.set("launcherLogoColorOverride", ""); } else if (index === 1) { - SettingsData.set("launcherLogoColorOverride", "primary") + SettingsData.set("launcherLogoColorOverride", "primary"); } else if (index === 2) { - SettingsData.set("launcherLogoColorOverride", "surface") + SettingsData.set("launcherLogoColorOverride", "surface"); } else if (index === 3) { - const currentOverride = SettingsData.launcherLogoColorOverride - const isPreset = currentOverride === "" || currentOverride === "primary" || currentOverride === "surface" + const currentOverride = SettingsData.launcherLogoColorOverride; + const isPreset = currentOverride === "" || currentOverride === "primary" || currentOverride === "surface"; if (isPreset) { - SettingsData.set("launcherLogoColorOverride", "#ffffff") + SettingsData.set("launcherLogoColorOverride", "#ffffff"); } } } @@ -226,18 +232,18 @@ Item { Rectangle { visible: { - const override = SettingsData.launcherLogoColorOverride - return override !== "" && override !== "primary" && override !== "surface" + const override = SettingsData.launcherLogoColorOverride; + return override !== "" && override !== "primary" && override !== "surface"; } width: 36 height: 36 radius: 18 color: { - const override = SettingsData.launcherLogoColorOverride + const override = SettingsData.launcherLogoColorOverride; if (override !== "" && override !== "primary" && override !== "surface") { - return override + return override; } - return "#ffffff" + return "#ffffff"; } border.color: Theme.outline border.width: 1 @@ -248,12 +254,12 @@ Item { cursorShape: Qt.PointingHandCursor onClicked: { if (PopoutService.colorPickerModal) { - 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() + 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(); } } } @@ -290,7 +296,7 @@ Item { thumbOutlineColor: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) anchors.horizontalCenter: parent.horizontalCenter onSliderValueChanged: newValue => { - SettingsData.set("launcherLogoSizeOffset", newValue) + SettingsData.set("launcherLogoSizeOffset", newValue); } } } @@ -300,8 +306,8 @@ Item { width: parent.width height: customControlsFlow.height visible: { - const override = SettingsData.launcherLogoColorOverride - return override !== "" && override !== "primary" && override !== "surface" + const override = SettingsData.launcherLogoColorOverride; + return override !== "" && override !== "primary" && override !== "surface"; } opacity: visible ? 1 : 0 @@ -341,7 +347,7 @@ Item { thumbOutlineColor: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) anchors.horizontalCenter: parent.horizontalCenter onSliderValueChanged: newValue => { - SettingsData.set("launcherLogoBrightness", newValue / 100) + SettingsData.set("launcherLogoBrightness", newValue / 100); } } } @@ -370,7 +376,7 @@ Item { thumbOutlineColor: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) anchors.horizontalCenter: parent.horizontalCenter onSliderValueChanged: newValue => { - SettingsData.set("launcherLogoContrast", newValue / 100) + SettingsData.set("launcherLogoContrast", newValue / 100); } } } @@ -393,7 +399,7 @@ Item { checked: SettingsData.launcherLogoColorInvertOnMode anchors.horizontalCenter: parent.horizontalCenter onToggled: checked => { - SettingsData.set("launcherLogoColorInvertOnMode", checked) + SettingsData.set("launcherLogoColorInvertOnMode", checked); } } } @@ -408,8 +414,7 @@ Item { height: launchPrefixSection.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 Column { @@ -452,7 +457,7 @@ Item { text: SettingsData.launchPrefix placeholderText: I18n.tr("Enter launch prefix (e.g., 'uwsm-app')") onTextEdited: { - SettingsData.set("launchPrefix", text) + SettingsData.set("launchPrefix", text); } } } @@ -463,8 +468,7 @@ Item { height: sortingSection.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 Column { @@ -494,9 +498,7 @@ Item { } Item { - width: parent.width - parent.children[0].width - - parent.children[1].width - - sortToggle.width - Theme.spacingM * 3 + width: parent.width - parent.children[0].width - parent.children[1].width - sortToggle.width - Theme.spacingM * 3 height: 1 } @@ -508,7 +510,7 @@ Item { checked: SettingsData.sortAppsAlphabetically anchors.verticalCenter: parent.verticalCenter onToggled: checked => { - SettingsData.set("sortAppsAlphabetically", checked) + SettingsData.set("sortAppsAlphabetically", checked); } } } @@ -528,8 +530,7 @@ Item { height: gridColumnsSection.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 Column { @@ -584,7 +585,7 @@ Item { thumbOutlineColor: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) anchors.horizontalCenter: parent.horizontalCenter onSliderValueChanged: newValue => { - SettingsData.set("appLauncherGridColumns", newValue) + SettingsData.set("appLauncherGridColumns", newValue); } } } @@ -596,8 +597,7 @@ Item { height: niriOverviewSection.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 visible: CompositorService.isNiri @@ -628,9 +628,7 @@ Item { } Item { - width: parent.width - parent.children[0].width - - parent.children[1].width - - niriOverviewToggle.width - Theme.spacingM * 3 + width: parent.width - parent.children[0].width - parent.children[1].width - niriOverviewToggle.width - Theme.spacingM * 3 height: 1 } @@ -642,7 +640,7 @@ Item { checked: SettingsData.spotlightCloseNiriOverview anchors.verticalCenter: parent.verticalCenter onToggled: checked => { - SettingsData.set("spotlightCloseNiriOverview", checked) + SettingsData.set("spotlightCloseNiriOverview", checked); } } } @@ -662,36 +660,33 @@ Item { height: recentlyUsedSection.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 Column { id: recentlyUsedSection property var rankedAppsModel: { - var apps = [] - for (var appId in (AppUsageHistoryData.appUsageRanking - || {})) { - var appData = (AppUsageHistoryData.appUsageRanking - || {})[appId] + var apps = []; + for (var appId in (AppUsageHistoryData.appUsageRanking || {})) { + var appData = (AppUsageHistoryData.appUsageRanking || {})[appId]; apps.push({ - "id": appId, - "name": appData.name, - "exec": appData.exec, - "icon": appData.icon, - "comment": appData.comment, - "usageCount": appData.usageCount, - "lastUsed": appData.lastUsed - }) + "id": appId, + "name": appData.name, + "exec": appData.exec, + "icon": appData.icon, + "comment": appData.comment, + "usageCount": appData.usageCount, + "lastUsed": appData.lastUsed + }); } apps.sort(function (a, b) { if (a.usageCount !== b.usageCount) - return b.usageCount - a.usageCount + return b.usageCount - a.usageCount; - return a.name.localeCompare(b.name) - }) - return apps.slice(0, 20) + return a.name.localeCompare(b.name); + }); + return apps.slice(0, 20); } anchors.fill: parent @@ -718,9 +713,7 @@ Item { } Item { - width: parent.width - parent.children[0].width - - parent.children[1].width - - clearAllButton.width - Theme.spacingM * 3 + width: parent.width - parent.children[0].width - parent.children[1].width - clearAllButton.width - Theme.spacingM * 3 height: 1 } @@ -732,8 +725,8 @@ Item { iconColor: Theme.error anchors.verticalCenter: parent.verticalCenter onClicked: { - AppUsageHistoryData.appUsageRanking = {} - AppUsageHistoryData.saveSettings() + AppUsageHistoryData.appUsageRanking = {}; + AppUsageHistoryData.saveSettings(); } } } @@ -759,12 +752,8 @@ Item { width: rankedAppsList.width height: 48 radius: Theme.cornerRadius - color: Qt.rgba(Theme.surfaceContainer.r, - Theme.surfaceContainer.g, - Theme.surfaceContainer.b, 0.3) - border.color: Qt.rgba(Theme.outline.r, - Theme.outline.g, - Theme.outline.b, 0.1) + color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.3) + border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.1) border.width: 0 Row { @@ -792,7 +781,7 @@ Item { anchors.verticalCenter: parent.verticalCenter onStatusChanged: { if (status === Image.Error) - source = "image://icon/application-x-executable" + source = "image://icon/application-x-executable"; } } @@ -801,8 +790,7 @@ Item { spacing: 2 StyledText { - text: modelData.name - || "Unknown App" + text: modelData.name || "Unknown App" font.pixelSize: Theme.fontSizeMedium font.weight: Font.Medium color: Theme.surfaceText @@ -811,37 +799,27 @@ Item { StyledText { text: { if (!modelData.lastUsed) - return "Never used" + return "Never used"; - var date = new Date(modelData.lastUsed) - var now = new Date() - var diffMs = now - date - var diffMins = Math.floor( - diffMs / (1000 * 60)) - var diffHours = Math.floor( - diffMs / (1000 * 60 * 60)) - var diffDays = Math.floor( - diffMs / (1000 * 60 * 60 * 24)) + var date = new Date(modelData.lastUsed); + var now = new Date(); + var diffMs = now - date; + var diffMins = Math.floor(diffMs / (1000 * 60)); + var diffHours = Math.floor(diffMs / (1000 * 60 * 60)); + var diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24)); if (diffMins < 1) - return I18n.tr("Last launched just now") + return I18n.tr("Last launched just now"); if (diffMins < 60) - return I18n.tr("Last launched %1 minute%2 ago") - .arg(diffMins) - .arg(diffMins === 1 ? "" : "s") + return I18n.tr("Last launched %1 minute%2 ago").arg(diffMins).arg(diffMins === 1 ? "" : "s"); if (diffHours < 24) - return I18n.tr("Last launched %1 hour%2 ago") - .arg(diffHours) - .arg(diffHours === 1 ? "" : "s") + return I18n.tr("Last launched %1 hour%2 ago").arg(diffHours).arg(diffHours === 1 ? "" : "s"); if (diffDays < 7) - return I18n.tr("Last launched %1 day%2 ago") - .arg(diffDays) - .arg(diffDays === 1 ? "" : "s") + return I18n.tr("Last launched %1 day%2 ago").arg(diffDays).arg(diffDays === 1 ? "" : "s"); - return I18n.tr("Last launched %1") - .arg(date.toLocaleDateString()) + return I18n.tr("Last launched %1").arg(date.toLocaleDateString()); } font.pixelSize: Theme.fontSizeSmall color: Theme.surfaceVariantText @@ -858,13 +836,10 @@ Item { iconSize: 16 iconColor: Theme.error onClicked: { - var currentRanking = Object.assign( - {}, - AppUsageHistoryData.appUsageRanking - || {}) - delete currentRanking[modelData.id] - AppUsageHistoryData.appUsageRanking = currentRanking - AppUsageHistoryData.saveSettings() + var currentRanking = Object.assign({}, AppUsageHistoryData.appUsageRanking || {}); + delete currentRanking[modelData.id]; + AppUsageHistoryData.appUsageRanking = currentRanking; + AppUsageHistoryData.saveSettings(); } } } @@ -872,8 +847,7 @@ Item { StyledText { width: parent.width - text: recentlyUsedSection.rankedAppsModel.length - === 0 ? "No apps have been launched yet." : "" + text: recentlyUsedSection.rankedAppsModel.length === 0 ? "No apps have been launched yet." : "" font.pixelSize: Theme.fontSizeMedium color: Theme.surfaceVariantText horizontalAlignment: Text.AlignHCenter diff --git a/quickshell/Modules/Settings/PersonalizationTab.qml b/quickshell/Modules/Settings/PersonalizationTab.qml index e17c993c..1cbdd178 100644 --- a/quickshell/Modules/Settings/PersonalizationTab.qml +++ b/quickshell/Modules/Settings/PersonalizationTab.qml @@ -66,13 +66,14 @@ Item { DankFlickable { anchors.fill: parent clip: true - contentHeight: mainColumn.height + contentHeight: mainColumn.height + Theme.spacingXL contentWidth: width Column { id: mainColumn - width: parent.width + width: Math.min(550, parent.width - Theme.spacingL * 2) + anchors.horizontalCenter: parent.horizontalCenter spacing: Theme.spacingXL // Wallpaper Section diff --git a/quickshell/Modules/Settings/PluginListItem.qml b/quickshell/Modules/Settings/PluginListItem.qml index d2e44525..8be03492 100644 --- a/quickshell/Modules/Settings/PluginListItem.qml +++ b/quickshell/Modules/Settings/PluginListItem.qml @@ -1,5 +1,4 @@ import QtQuick -import QtQuick.Controls import qs.Common import qs.Services import qs.Widgets @@ -15,10 +14,10 @@ StyledRect { property string pluginId: pluginData ? pluginData.id : "" property string pluginDirectoryName: { if (pluginData && pluginData.pluginDirectory) { - var path = pluginData.pluginDirectory - return path.substring(path.lastIndexOf('/') + 1) + var path = pluginData.pluginDirectory; + return path.substring(path.lastIndexOf('/') + 1); } - return pluginId + return pluginId; } property string pluginName: pluginData ? (pluginData.name || pluginData.id) : "" property string pluginVersion: pluginData ? (pluginData.version || "1.0.0") : "" @@ -44,7 +43,7 @@ StyledRect { cursorShape: root.hasSettings ? Qt.PointingHandCursor : Qt.ArrowCursor enabled: root.hasSettings onClicked: { - root.expandedPluginId = root.expandedPluginId === root.pluginId ? "" : root.pluginId + root.expandedPluginId = root.expandedPluginId === root.pluginId ? "" : root.pluginId; } } @@ -127,32 +126,32 @@ StyledRect { hoverEnabled: true cursorShape: Qt.PointingHandCursor onClicked: { - const currentPluginName = root.pluginName - const currentPluginId = root.pluginId + const currentPluginName = root.pluginName; + const currentPluginId = root.pluginId; DMSService.update(currentPluginName, response => { if (response.error) { - ToastService.showError("Update failed: " + response.error) + ToastService.showError("Update failed: " + response.error); } else { - ToastService.showInfo("Plugin updated: " + currentPluginName) - PluginService.forceRescanPlugin(currentPluginId) + ToastService.showInfo("Plugin updated: " + currentPluginName); + PluginService.forceRescanPlugin(currentPluginId); if (DMSService.apiVersion >= 8) { - DMSService.listInstalled() + DMSService.listInstalled(); } } - }) + }); } onEntered: { - tooltipLoader.active = true + tooltipLoader.active = true; if (tooltipLoader.item) { - const p = mapToItem(null, width / 2, 0) - tooltipLoader.item.show(I18n.tr("Update Plugin"), p.x, p.y - 40, null) + const p = mapToItem(null, width / 2, 0); + tooltipLoader.item.show(I18n.tr("Update Plugin"), p.x, p.y - 40, null); } } onExited: { if (tooltipLoader.item) { - tooltipLoader.item.hide() + tooltipLoader.item.hide(); } - tooltipLoader.active = false + tooltipLoader.active = false; } } } @@ -177,31 +176,31 @@ StyledRect { hoverEnabled: true cursorShape: Qt.PointingHandCursor onClicked: { - const currentPluginName = root.pluginName + const currentPluginName = root.pluginName; DMSService.uninstall(currentPluginName, response => { if (response.error) { - ToastService.showError("Uninstall failed: " + response.error) + ToastService.showError("Uninstall failed: " + response.error); } else { - ToastService.showInfo("Plugin uninstalled: " + currentPluginName) - PluginService.scanPlugins() + ToastService.showInfo("Plugin uninstalled: " + currentPluginName); + PluginService.scanPlugins(); if (root.isExpanded) { - root.expandedPluginId = "" + root.expandedPluginId = ""; } } - }) + }); } onEntered: { - tooltipLoader.active = true + tooltipLoader.active = true; if (tooltipLoader.item) { - const p = mapToItem(null, width / 2, 0) - tooltipLoader.item.show(I18n.tr("Uninstall Plugin"), p.x, p.y - 40, null) + const p = mapToItem(null, width / 2, 0); + tooltipLoader.item.show(I18n.tr("Uninstall Plugin"), p.x, p.y - 40, null); } } onExited: { if (tooltipLoader.item) { - tooltipLoader.item.hide() + tooltipLoader.item.hide(); } - tooltipLoader.active = false + tooltipLoader.active = false; } } } @@ -226,28 +225,28 @@ StyledRect { hoverEnabled: true cursorShape: Qt.PointingHandCursor onClicked: { - const currentPluginId = root.pluginId - const currentPluginName = root.pluginName - root.isReloading = true + const currentPluginId = root.pluginId; + const currentPluginName = root.pluginName; + root.isReloading = true; if (PluginService.reloadPlugin(currentPluginId)) { - ToastService.showInfo("Plugin reloaded: " + currentPluginName) + ToastService.showInfo("Plugin reloaded: " + currentPluginName); } else { - ToastService.showError("Failed to reload plugin: " + currentPluginName) - root.isReloading = false + ToastService.showError("Failed to reload plugin: " + currentPluginName); + root.isReloading = false; } } onEntered: { - tooltipLoader.active = true + tooltipLoader.active = true; if (tooltipLoader.item) { - const p = mapToItem(null, width / 2, 0) - tooltipLoader.item.show(I18n.tr("Reload Plugin"), p.x, p.y - 40, null) + const p = mapToItem(null, width / 2, 0); + tooltipLoader.item.show(I18n.tr("Reload Plugin"), p.x, p.y - 40, null); } } onExited: { if (tooltipLoader.item) { - tooltipLoader.item.hide() + tooltipLoader.item.hide(); } - tooltipLoader.active = false + tooltipLoader.active = false; } } } @@ -257,25 +256,25 @@ StyledRect { anchors.verticalCenter: parent.verticalCenter checked: PluginService.isPluginLoaded(root.pluginId) onToggled: isChecked => { - const currentPluginId = root.pluginId - const currentPluginName = root.pluginName + const currentPluginId = root.pluginId; + const currentPluginName = root.pluginName; if (isChecked) { if (PluginService.enablePlugin(currentPluginId)) { - ToastService.showInfo("Plugin enabled: " + currentPluginName) + ToastService.showInfo("Plugin enabled: " + currentPluginName); } else { - ToastService.showError("Failed to enable plugin: " + currentPluginName) - checked = false + ToastService.showError("Failed to enable plugin: " + currentPluginName); + checked = false; } } else { if (PluginService.disablePlugin(currentPluginId)) { - ToastService.showInfo("Plugin disabled: " + currentPluginName) + ToastService.showInfo("Plugin disabled: " + currentPluginName); if (root.isExpanded) { - root.expandedPluginId = "" + root.expandedPluginId = ""; } } else { - ToastService.showError("Failed to disable plugin: " + currentPluginName) - checked = true + ToastService.showError("Failed to disable plugin: " + currentPluginName); + checked = true; } } } @@ -330,7 +329,7 @@ StyledRect { focus: root.isExpanded && root.hasSettings Keys.onPressed: event => { - event.accepted = true + event.accepted = true; } Rectangle { @@ -350,38 +349,34 @@ StyledRect { source: { if (active && root.pluginSettingsPath) { - var path = root.pluginSettingsPath + var path = root.pluginSettingsPath; if (!path.startsWith("file://")) { - path = "file://" + path + path = "file://" + path; } - return path + return path; } - return "" + return ""; } onLoaded: { if (item && typeof PluginService !== "undefined") { - item.pluginService = PluginService + item.pluginService = PluginService; } if (item && typeof PopoutService !== "undefined" && "popoutService" in item) { - item.popoutService = PopoutService + item.popoutService = PopoutService; } if (item) { Qt.callLater(() => { - settingsContainer.focus = true - item.forceActiveFocus() - }) + settingsContainer.focus = true; + item.forceActiveFocus(); + }); } } } StyledText { anchors.centerIn: parent - text: !PluginService.isPluginLoaded(root.pluginId) ? - "Enable plugin to access settings" : - (settingsLoader.status === Loader.Error ? - "Failed to load settings" : - "No configurable settings") + text: !PluginService.isPluginLoaded(root.pluginId) ? "Enable plugin to access settings" : (settingsLoader.status === Loader.Error ? "Failed to load settings" : "No configurable settings") font.pixelSize: Theme.fontSizeSmall color: Theme.surfaceVariantText visible: root.isExpanded && (!settingsLoader.active || settingsLoader.status === Loader.Error) diff --git a/quickshell/Modules/Settings/PluginsTab.qml b/quickshell/Modules/Settings/PluginsTab.qml index 7e993692..c5f1f2c4 100644 --- a/quickshell/Modules/Settings/PluginsTab.qml +++ b/quickshell/Modules/Settings/PluginsTab.qml @@ -1,8 +1,5 @@ import QtQuick -import QtQuick.Controls -import QtQuick.Layouts import qs.Common -import qs.Modals.Common import qs.Services import qs.Widgets @@ -20,13 +17,14 @@ FocusScope { DankFlickable { anchors.fill: parent clip: true - contentHeight: mainColumn.height + contentHeight: mainColumn.height + Theme.spacingXL contentWidth: width Column { id: mainColumn - width: parent.width + width: Math.min(550, parent.width - Theme.spacingL * 2) + anchors.horizontalCenter: parent.horizontalCenter spacing: Theme.spacingXL StyledRect { @@ -126,7 +124,7 @@ FocusScope { iconName: "store" enabled: DMSService.dmsAvailable onClicked: { - pluginBrowserModal.show() + pluginBrowserModal.show(); } } @@ -134,12 +132,12 @@ FocusScope { text: I18n.tr("Scan") iconName: "refresh" onClicked: { - pluginsTab.isRefreshingPlugins = true - PluginService.scanPlugins() + pluginsTab.isRefreshingPlugins = true; + PluginService.scanPlugins(); if (DMSService.dmsAvailable) { - DMSService.listInstalled() + DMSService.listInstalled(); } - pluginsTab.refreshPluginList() + pluginsTab.refreshPluginList(); } } @@ -147,8 +145,8 @@ FocusScope { text: I18n.tr("Create Dir") iconName: "create_new_folder" onClicked: { - PluginService.createPluginDirectory() - ToastService.showInfo("Created plugin directory: " + PluginService.pluginDirectory) + PluginService.createPluginDirectory(); + ToastService.showInfo("Created plugin directory: " + PluginService.pluginDirectory); } } } @@ -226,15 +224,16 @@ FocusScope { pluginData: modelData expandedPluginId: pluginsTab.expandedPluginId hasUpdate: { - if (DMSService.apiVersion < 8) return false - return pluginsTab.installedPluginsData[pluginId] || pluginsTab.installedPluginsData[pluginName] || false + if (DMSService.apiVersion < 8) + return false; + return pluginsTab.installedPluginsData[pluginId] || pluginsTab.installedPluginsData[pluginName] || false; } isReloading: pluginsTab.isReloading onExpandedPluginIdChanged: { - pluginsTab.expandedPluginId = expandedPluginId + pluginsTab.expandedPluginId = expandedPluginId; } onIsReloadingChanged: { - pluginsTab.isReloading = isReloading + pluginsTab.isReloading = isReloading; } } } @@ -255,69 +254,69 @@ FocusScope { function refreshPluginList() { Qt.callLater(() => { - var plugins = PluginService.getAvailablePlugins() - pluginRepeater.model = null - pluginRepeater.model = plugins - pluginsTab.isRefreshingPlugins = false - }) + var plugins = PluginService.getAvailablePlugins(); + pluginRepeater.model = null; + pluginRepeater.model = plugins; + pluginsTab.isRefreshingPlugins = false; + }); } Connections { target: PluginService function onPluginLoaded() { - refreshPluginList() + refreshPluginList(); if (isReloading) { - isReloading = false + isReloading = false; } } function onPluginUnloaded() { - refreshPluginList() + refreshPluginList(); if (!isReloading && pluginsTab.expandedPluginId !== "" && !PluginService.isPluginLoaded(pluginsTab.expandedPluginId)) { - pluginsTab.expandedPluginId = "" + pluginsTab.expandedPluginId = ""; } } function onPluginListUpdated() { if (DMSService.apiVersion >= 8) { - DMSService.listInstalled() + DMSService.listInstalled(); } - refreshPluginList() + refreshPluginList(); } } Connections { target: DMSService function onPluginsListReceived(plugins) { - pluginBrowserModal.isLoading = false - pluginBrowserModal.allPlugins = plugins - pluginBrowserModal.updateFilteredPlugins() + pluginBrowserModal.isLoading = false; + pluginBrowserModal.allPlugins = plugins; + pluginBrowserModal.updateFilteredPlugins(); } function onInstalledPluginsReceived(plugins) { - var pluginMap = {} + var pluginMap = {}; for (var i = 0; i < plugins.length; i++) { - var plugin = plugins[i] - var hasUpdate = plugin.hasUpdate || false + var plugin = plugins[i]; + var hasUpdate = plugin.hasUpdate || false; if (plugin.id) { - pluginMap[plugin.id] = hasUpdate + pluginMap[plugin.id] = hasUpdate; } if (plugin.name) { - pluginMap[plugin.name] = hasUpdate + pluginMap[plugin.name] = hasUpdate; } } - installedPluginsData = pluginMap - Qt.callLater(refreshPluginList) + installedPluginsData = pluginMap; + Qt.callLater(refreshPluginList); } function onOperationSuccess(message) { - ToastService.showInfo(message) + ToastService.showInfo(message); } function onOperationError(error) { - ToastService.showError(error) + ToastService.showError(error); } } Component.onCompleted: { - pluginBrowserModal.parentModal = pluginsTab.parentModal + pluginBrowserModal.parentModal = pluginsTab.parentModal; if (DMSService.dmsAvailable && DMSService.apiVersion >= 8) { - DMSService.listInstalled() + DMSService.listInstalled(); } } diff --git a/quickshell/Modules/Settings/SettingsSection.qml b/quickshell/Modules/Settings/SettingsSection.qml index 2e180cd5..e511fa20 100644 --- a/quickshell/Modules/Settings/SettingsSection.qml +++ b/quickshell/Modules/Settings/SettingsSection.qml @@ -16,7 +16,7 @@ Column { spacing: expanded ? Theme.spacingM : 0 Component.onCompleted: { if (!collapsible) - expanded = true + expanded = true; } MouseArea { @@ -26,15 +26,12 @@ Column { hoverEnabled: collapsible onClicked: { if (collapsible) - expanded = !expanded + expanded = !expanded; } Rectangle { anchors.fill: parent - color: parent.containsMouse ? Qt.rgba(Theme.primary.r, - Theme.primary.g, - Theme.primary.b, - 0.08) : "transparent" + color: parent.containsMouse ? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.08) : "transparent" radius: Theme.radiusS } diff --git a/quickshell/Modules/Settings/ThemeColorsTab.qml b/quickshell/Modules/Settings/ThemeColorsTab.qml index 92daaa14..05df9c24 100644 --- a/quickshell/Modules/Settings/ThemeColorsTab.qml +++ b/quickshell/Modules/Settings/ThemeColorsTab.qml @@ -59,13 +59,14 @@ Item { DankFlickable { anchors.fill: parent clip: true - contentHeight: mainColumn.height + contentHeight: mainColumn.height + Theme.spacingXL contentWidth: width Column { id: mainColumn - width: parent.width + width: Math.min(550, parent.width - Theme.spacingL * 2) + anchors.horizontalCenter: parent.horizontalCenter spacing: Theme.spacingXL // Theme Color diff --git a/quickshell/Modules/Settings/TimeWeatherTab.qml b/quickshell/Modules/Settings/TimeWeatherTab.qml index 93f47321..0ad813e0 100644 --- a/quickshell/Modules/Settings/TimeWeatherTab.qml +++ b/quickshell/Modules/Settings/TimeWeatherTab.qml @@ -1,5 +1,4 @@ import QtQuick -import QtQuick.Controls import QtQuick.Effects import QtQuick.Layouts import qs.Common @@ -12,13 +11,14 @@ Item { DankFlickable { anchors.fill: parent clip: true - contentHeight: mainColumn.height + contentHeight: mainColumn.height + Theme.spacingXL contentWidth: width Column { id: mainColumn - width: parent.width + width: Math.min(550, parent.width - Theme.spacingL * 2) + anchors.horizontalCenter: parent.horizontalCenter spacing: Theme.spacingXL StyledRect { @@ -26,8 +26,7 @@ Item { height: timeSection.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 Column { @@ -49,8 +48,7 @@ Item { } Column { - width: parent.width - Theme.iconSize - Theme.spacingM - - toggle.width - Theme.spacingM + width: parent.width - Theme.iconSize - Theme.spacingM - toggle.width - Theme.spacingM spacing: Theme.spacingXS anchors.verticalCenter: parent.verticalCenter @@ -76,9 +74,8 @@ Item { anchors.verticalCenter: parent.verticalCenter checked: SettingsData.use24HourClock onToggled: checked => { - return SettingsData.set("use24HourClock", - checked) - } + return SettingsData.set("use24HourClock", checked); + } } } } @@ -89,8 +86,7 @@ Item { height: timeSection.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 Column { @@ -112,8 +108,7 @@ Item { } Column { - width: parent.width - Theme.iconSize - Theme.spacingM - - toggle.width - Theme.spacingM + width: parent.width - Theme.iconSize - Theme.spacingM - toggle.width - Theme.spacingM spacing: Theme.spacingXS anchors.verticalCenter: parent.verticalCenter @@ -139,9 +134,8 @@ Item { anchors.verticalCenter: parent.verticalCenter checked: SettingsData.showSeconds onToggled: checked => { - return SettingsData.set("showSeconds", - checked) - } + return SettingsData.set("showSeconds", checked); + } } } } @@ -152,8 +146,7 @@ Item { height: dateSection.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 Column { @@ -189,60 +182,67 @@ Item { description: "Preview: " + (SettingsData.clockDateFormat ? new Date().toLocaleDateString(Qt.locale(), SettingsData.clockDateFormat) : new Date().toLocaleDateString(Qt.locale(), "ddd d")) currentValue: { if (!SettingsData.clockDateFormat || SettingsData.clockDateFormat.length === 0) { - return "System Default" + return "System Default"; } - const presets = [{ - "format": "ddd d", - "label": "Day Date" - }, { - "format": "ddd MMM d", - "label": "Day Month Date" - }, { - "format": "MMM d", - "label": "Month Date" - }, { - "format": "M/d", - "label": "Numeric (M/D)" - }, { - "format": "d/M", - "label": "Numeric (D/M)" - }, { - "format": "ddd d MMM yyyy", - "label": "Full with Year" - }, { - "format": "yyyy-MM-dd", - "label": "ISO Date" - }, { - "format": "dddd, MMMM d", - "label": "Full Day & Month" - }] + const presets = [ + { + "format": "ddd d", + "label": "Day Date" + }, + { + "format": "ddd MMM d", + "label": "Day Month Date" + }, + { + "format": "MMM d", + "label": "Month Date" + }, + { + "format": "M/d", + "label": "Numeric (M/D)" + }, + { + "format": "d/M", + "label": "Numeric (D/M)" + }, + { + "format": "ddd d MMM yyyy", + "label": "Full with Year" + }, + { + "format": "yyyy-MM-dd", + "label": "ISO Date" + }, + { + "format": "dddd, MMMM d", + "label": "Full Day & Month" + } + ]; const match = presets.find(p => { - return p.format - === SettingsData.clockDateFormat - }) - return match ? match.label: I18n.tr("Custom: ") + SettingsData.clockDateFormat + return p.format === SettingsData.clockDateFormat; + }); + return match ? match.label : I18n.tr("Custom: ") + SettingsData.clockDateFormat; } options: ["System Default", "Day Date", "Day Month Date", "Month Date", "Numeric (M/D)", "Numeric (D/M)", "Full with Year", "ISO Date", "Full Day & Month", "Custom..."] onValueChanged: value => { - const formatMap = { - "System Default": "", - "Day Date": "ddd d", - "Day Month Date": "ddd MMM d", - "Month Date": "MMM d", - "Numeric (M/D)": "M/d", - "Numeric (D/M)": "d/M", - "Full with Year": "ddd d MMM yyyy", - "ISO Date": "yyyy-MM-dd", - "Full Day & Month": "dddd, MMMM d" - } - if (value === "Custom...") { - customFormatInput.visible = true - } else { - customFormatInput.visible = false - SettingsData.set("clockDateFormat", - formatMap[value]) - } - } + const formatMap = { + "System Default": "", + "Day Date": "ddd d", + "Day Month Date": "ddd MMM d", + "Month Date": "MMM d", + "Numeric (M/D)": "M/d", + "Numeric (D/M)": "d/M", + "Full with Year": "ddd d MMM yyyy", + "ISO Date": "yyyy-MM-dd", + "Full Day & Month": "dddd, MMMM d" + }; + if (value === "Custom...") { + customFormatInput.visible = true; + } else { + customFormatInput.visible = false; + SettingsData.set("clockDateFormat", formatMap[value]); + } + } } DankDropdown { @@ -251,60 +251,67 @@ Item { description: "Preview: " + (SettingsData.lockDateFormat ? new Date().toLocaleDateString(Qt.locale(), SettingsData.lockDateFormat) : new Date().toLocaleDateString(Qt.locale(), Locale.LongFormat)) currentValue: { if (!SettingsData.lockDateFormat || SettingsData.lockDateFormat.length === 0) { - return "System Default" + return "System Default"; } - const presets = [{ - "format": "ddd d", - "label": "Day Date" - }, { - "format": "ddd MMM d", - "label": "Day Month Date" - }, { - "format": "MMM d", - "label": "Month Date" - }, { - "format": "M/d", - "label": "Numeric (M/D)" - }, { - "format": "d/M", - "label": "Numeric (D/M)" - }, { - "format": "ddd d MMM yyyy", - "label": "Full with Year" - }, { - "format": "yyyy-MM-dd", - "label": "ISO Date" - }, { - "format": "dddd, MMMM d", - "label": "Full Day & Month" - }] + const presets = [ + { + "format": "ddd d", + "label": "Day Date" + }, + { + "format": "ddd MMM d", + "label": "Day Month Date" + }, + { + "format": "MMM d", + "label": "Month Date" + }, + { + "format": "M/d", + "label": "Numeric (M/D)" + }, + { + "format": "d/M", + "label": "Numeric (D/M)" + }, + { + "format": "ddd d MMM yyyy", + "label": "Full with Year" + }, + { + "format": "yyyy-MM-dd", + "label": "ISO Date" + }, + { + "format": "dddd, MMMM d", + "label": "Full Day & Month" + } + ]; const match = presets.find(p => { - return p.format - === SettingsData.lockDateFormat - }) - return match ? match.label: I18n.tr("Custom: ") + SettingsData.lockDateFormat + return p.format === SettingsData.lockDateFormat; + }); + return match ? match.label : I18n.tr("Custom: ") + SettingsData.lockDateFormat; } options: ["System Default", "Day Date", "Day Month Date", "Month Date", "Numeric (M/D)", "Numeric (D/M)", "Full with Year", "ISO Date", "Full Day & Month", "Custom..."] onValueChanged: value => { - const formatMap = { - "System Default": "", - "Day Date": "ddd d", - "Day Month Date": "ddd MMM d", - "Month Date": "MMM d", - "Numeric (M/D)": "M/d", - "Numeric (D/M)": "d/M", - "Full with Year": "ddd d MMM yyyy", - "ISO Date": "yyyy-MM-dd", - "Full Day & Month": "dddd, MMMM d" - } - if (value === "Custom...") { - customLockFormatInput.visible = true - } else { - customLockFormatInput.visible = false - SettingsData.set("lockDateFormat", - formatMap[value]) - } - } + const formatMap = { + "System Default": "", + "Day Date": "ddd d", + "Day Month Date": "ddd MMM d", + "Month Date": "MMM d", + "Numeric (M/D)": "M/d", + "Numeric (D/M)": "d/M", + "Full with Year": "ddd d MMM yyyy", + "ISO Date": "yyyy-MM-dd", + "Full Day & Month": "dddd, MMMM d" + }; + if (value === "Custom...") { + customLockFormatInput.visible = true; + } else { + customLockFormatInput.visible = false; + SettingsData.set("lockDateFormat", formatMap[value]); + } + } } DankTextField { @@ -316,7 +323,7 @@ Item { text: SettingsData.clockDateFormat onTextChanged: { if (visible && text) - SettingsData.set("clockDateFormat", text) + SettingsData.set("clockDateFormat", text); } } @@ -329,7 +336,7 @@ Item { text: SettingsData.lockDateFormat onTextChanged: { if (visible && text) - SettingsData.set("lockDateFormat", text) + SettingsData.set("lockDateFormat", text); } } @@ -338,8 +345,7 @@ Item { height: formatHelp.implicitHeight + Theme.spacingM * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, - Theme.outline.b, 0.1) + border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.1) border.width: 0 Column { @@ -440,8 +446,7 @@ Item { height: enableWeatherSection.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 Column { @@ -463,8 +468,7 @@ Item { } Column { - width: parent.width - Theme.iconSize - Theme.spacingM - - enableToggle.width - Theme.spacingM + width: parent.width - Theme.iconSize - Theme.spacingM - enableToggle.width - Theme.spacingM spacing: Theme.spacingXS anchors.verticalCenter: parent.verticalCenter @@ -490,9 +494,8 @@ Item { anchors.verticalCenter: parent.verticalCenter checked: SettingsData.weatherEnabled onToggled: checked => { - return SettingsData.set("weatherEnabled", - checked) - } + return SettingsData.set("weatherEnabled", checked); + } } } } @@ -503,8 +506,7 @@ Item { height: temperatureSection.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 visible: SettingsData.weatherEnabled opacity: visible ? 1 : 0 @@ -528,8 +530,7 @@ Item { } Column { - width: parent.width - Theme.iconSize - Theme.spacingM - - temperatureToggle.width - Theme.spacingM + width: parent.width - Theme.iconSize - Theme.spacingM - temperatureToggle.width - Theme.spacingM spacing: Theme.spacingXS anchors.verticalCenter: parent.verticalCenter @@ -555,9 +556,8 @@ Item { anchors.verticalCenter: parent.verticalCenter checked: SettingsData.useFahrenheit onToggled: checked => { - return SettingsData.set("useFahrenheit", - checked) - } + return SettingsData.set("useFahrenheit", checked); + } } } } @@ -575,8 +575,7 @@ Item { height: locationSection.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 visible: SettingsData.weatherEnabled opacity: visible ? 1 : 0 @@ -600,8 +599,7 @@ Item { } Column { - width: parent.width - Theme.iconSize - Theme.spacingM - - autoLocationToggle.width - Theme.spacingM + width: parent.width - Theme.iconSize - Theme.spacingM - autoLocationToggle.width - Theme.spacingM spacing: Theme.spacingXS anchors.verticalCenter: parent.verticalCenter @@ -627,9 +625,8 @@ Item { anchors.verticalCenter: parent.verticalCenter checked: SettingsData.useAutoLocation onToggled: checked => { - return SettingsData.set("useAutoLocation", - checked) - } + return SettingsData.set("useAutoLocation", checked); + } } } @@ -653,113 +650,113 @@ Item { } Row { - width: parent.width - spacing: Theme.spacingM + width: parent.width + spacing: Theme.spacingM - Column { - width: (parent.width - Theme.spacingM) / 2 - spacing: Theme.spacingXS + Column { + width: (parent.width - Theme.spacingM) / 2 + spacing: Theme.spacingXS - StyledText { - text: I18n.tr("Latitude") - font.pixelSize: Theme.fontSizeSmall - color: Theme.surfaceVariantText - } - - DankTextField { - id: latitudeInput - width: parent.width - height: 48 - placeholderText: "40.7128" - backgroundColor: Theme.surfaceVariant - normalBorderColor: Theme.primarySelected - focusedBorderColor: Theme.primary - keyNavigationTab: longitudeInput - - Component.onCompleted: { - if (SettingsData.weatherCoordinates) { - const coords = SettingsData.weatherCoordinates.split(',') - if (coords.length > 0) { - text = coords[0].trim() - } - } - } - - Connections { - target: SettingsData - function onWeatherCoordinatesChanged() { - if (SettingsData.weatherCoordinates) { - const coords = SettingsData.weatherCoordinates.split(',') - if (coords.length > 0) { - latitudeInput.text = coords[0].trim() - } - } - } - } - - onTextEdited: { - if (text && longitudeInput.text) { - const coords = text + "," + longitudeInput.text - SettingsData.weatherCoordinates = coords - SettingsData.saveSettings() - } - } - } + StyledText { + text: I18n.tr("Latitude") + font.pixelSize: Theme.fontSizeSmall + color: Theme.surfaceVariantText } - Column { - width: (parent.width - Theme.spacingM) / 2 - spacing: Theme.spacingXS + DankTextField { + id: latitudeInput + width: parent.width + height: 48 + placeholderText: "40.7128" + backgroundColor: Theme.surfaceVariant + normalBorderColor: Theme.primarySelected + focusedBorderColor: Theme.primary + keyNavigationTab: longitudeInput - StyledText { - text: I18n.tr("Longitude") - font.pixelSize: Theme.fontSizeSmall - color: Theme.surfaceVariantText + Component.onCompleted: { + if (SettingsData.weatherCoordinates) { + const coords = SettingsData.weatherCoordinates.split(','); + if (coords.length > 0) { + text = coords[0].trim(); + } + } } - DankTextField { - id: longitudeInput - width: parent.width - height: 48 - placeholderText: "-74.0060" - backgroundColor: Theme.surfaceVariant - normalBorderColor: Theme.primarySelected - focusedBorderColor: Theme.primary - keyNavigationTab: locationSearchInput - keyNavigationBacktab: latitudeInput - - Component.onCompleted: { + Connections { + target: SettingsData + function onWeatherCoordinatesChanged() { if (SettingsData.weatherCoordinates) { - const coords = SettingsData.weatherCoordinates.split(',') - if (coords.length > 1) { - text = coords[1].trim() + const coords = SettingsData.weatherCoordinates.split(','); + if (coords.length > 0) { + latitudeInput.text = coords[0].trim(); } } } + } - Connections { - target: SettingsData - function onWeatherCoordinatesChanged() { - if (SettingsData.weatherCoordinates) { - const coords = SettingsData.weatherCoordinates.split(',') - if (coords.length > 1) { - longitudeInput.text = coords[1].trim() - } - } - } - } - - onTextEdited: { - if (text && latitudeInput.text) { - const coords = latitudeInput.text + "," + text - SettingsData.weatherCoordinates = coords - SettingsData.saveSettings() - } + onTextEdited: { + if (text && longitudeInput.text) { + const coords = text + "," + longitudeInput.text; + SettingsData.weatherCoordinates = coords; + SettingsData.saveSettings(); } } } } + Column { + width: (parent.width - Theme.spacingM) / 2 + spacing: Theme.spacingXS + + StyledText { + text: I18n.tr("Longitude") + font.pixelSize: Theme.fontSizeSmall + color: Theme.surfaceVariantText + } + + DankTextField { + id: longitudeInput + width: parent.width + height: 48 + placeholderText: "-74.0060" + backgroundColor: Theme.surfaceVariant + normalBorderColor: Theme.primarySelected + focusedBorderColor: Theme.primary + keyNavigationTab: locationSearchInput + keyNavigationBacktab: latitudeInput + + Component.onCompleted: { + if (SettingsData.weatherCoordinates) { + const coords = SettingsData.weatherCoordinates.split(','); + if (coords.length > 1) { + text = coords[1].trim(); + } + } + } + + Connections { + target: SettingsData + function onWeatherCoordinatesChanged() { + if (SettingsData.weatherCoordinates) { + const coords = SettingsData.weatherCoordinates.split(','); + if (coords.length > 1) { + longitudeInput.text = coords[1].trim(); + } + } + } + } + + onTextEdited: { + if (text && latitudeInput.text) { + const coords = latitudeInput.text + "," + text; + SettingsData.weatherCoordinates = coords; + SettingsData.saveSettings(); + } + } + } + } + } + Column { width: parent.width spacing: Theme.spacingXS @@ -778,14 +775,14 @@ Item { placeholderText: I18n.tr("New York, NY") keyNavigationBacktab: longitudeInput onLocationSelected: (displayName, coordinates) => { - SettingsData.setWeatherLocation(displayName, coordinates) + SettingsData.setWeatherLocation(displayName, coordinates); - const coords = coordinates.split(',') - if (coords.length >= 2) { - latitudeInput.text = coords[0].trim() - longitudeInput.text = coords[1].trim() - } - } + const coords = coordinates.split(','); + if (coords.length >= 2) { + latitudeInput.text = coords[0].trim(); + longitudeInput.text = coords[1].trim(); + } + } } } } @@ -804,8 +801,7 @@ Item { height: weatherDisplaySection.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 visible: SettingsData.weatherEnabled opacity: visible ? 1 : 0 @@ -882,9 +878,9 @@ Item { hoverEnabled: true cursorShape: parent.enabled ? Qt.PointingHandCursor : Qt.ForbiddenCursor onClicked: { - refreshButton.isRefreshing = true - WeatherService.forceRefresh() - refreshTimer.restart() + refreshButton.isRefreshing = true; + WeatherService.forceRefresh(); + refreshTimer.restart(); } enabled: parent.enabled } @@ -965,7 +961,7 @@ Item { cursorShape: Qt.PointingHandCursor onClicked: { if (WeatherService.weather.available) { - SettingsData.set("useFahrenheit", !SettingsData.useFahrenheit) + SettingsData.set("useFahrenheit", !SettingsData.useFahrenheit); } } enabled: WeatherService.weather.available @@ -1185,14 +1181,16 @@ Item { StyledText { text: { - if (!WeatherService.weather.wind) return "--" - const windKmh = parseFloat(WeatherService.weather.wind) - if (isNaN(windKmh)) return WeatherService.weather.wind + if (!WeatherService.weather.wind) + return "--"; + const windKmh = parseFloat(WeatherService.weather.wind); + if (isNaN(windKmh)) + return WeatherService.weather.wind; if (SettingsData.useFahrenheit) { - const windMph = Math.round(windKmh * 0.621371) - return windMph + " mph" + const windMph = Math.round(windKmh * 0.621371); + return windMph + " mph"; } - return WeatherService.weather.wind + return WeatherService.weather.wind; } font.pixelSize: Theme.fontSizeSmall + 1 color: Theme.surfaceText @@ -1241,13 +1239,14 @@ Item { StyledText { text: { - if (!WeatherService.weather.pressure) return "--" - const pressureHpa = WeatherService.weather.pressure + if (!WeatherService.weather.pressure) + return "--"; + const pressureHpa = WeatherService.weather.pressure; if (SettingsData.useFahrenheit) { - const pressureInHg = (pressureHpa * 0.02953).toFixed(2) - return pressureInHg + " inHg" + const pressureInHg = (pressureHpa * 0.02953).toFixed(2); + return pressureInHg + " inHg"; } - return pressureHpa + " hPa" + return pressureHpa + " hPa"; } font.pixelSize: Theme.fontSizeSmall + 1 color: Theme.surfaceText diff --git a/quickshell/Modules/Settings/WidgetSelectionPopup.qml b/quickshell/Modules/Settings/WidgetSelectionPopup.qml index 8acfc658..b6c80622 100644 --- a/quickshell/Modules/Settings/WidgetSelectionPopup.qml +++ b/quickshell/Modules/Settings/WidgetSelectionPopup.qml @@ -1,5 +1,4 @@ import QtQuick -import QtQuick.Controls import qs.Common import qs.Modals.Common import qs.Widgets diff --git a/quickshell/Modules/Settings/WidgetTweaksTab.qml b/quickshell/Modules/Settings/WidgetTweaksTab.qml index 28333904..aba423a6 100644 --- a/quickshell/Modules/Settings/WidgetTweaksTab.qml +++ b/quickshell/Modules/Settings/WidgetTweaksTab.qml @@ -1,5 +1,4 @@ import QtQuick -import QtQuick.Controls import qs.Common import qs.Services import qs.Widgets @@ -10,12 +9,13 @@ Item { DankFlickable { anchors.fill: parent clip: true - contentHeight: mainColumn.height + contentHeight: mainColumn.height + Theme.spacingXL contentWidth: width Column { id: mainColumn - width: parent.width + width: Math.min(550, parent.width - Theme.spacingL * 2) + anchors.horizontalCenter: parent.horizontalCenter spacing: Theme.spacingXL StyledRect { @@ -23,8 +23,7 @@ Item { height: workspaceSection.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 Column { @@ -60,9 +59,8 @@ Item { description: I18n.tr("Show workspace index numbers in the top bar workspace switcher") checked: SettingsData.showWorkspaceIndex onToggled: checked => { - return SettingsData.set("showWorkspaceIndex", - checked) - } + return SettingsData.set("showWorkspaceIndex", checked); + } } DankToggle { width: parent.width @@ -70,9 +68,8 @@ Item { description: I18n.tr("Always show a minimum of 3 workspaces, even if fewer are available") checked: SettingsData.showWorkspacePadding onToggled: checked => { - return SettingsData.set("showWorkspacePadding", - checked) - } + return SettingsData.set("showWorkspacePadding", checked); + } } DankToggle { @@ -82,12 +79,11 @@ Item { checked: SettingsData.showWorkspaceApps visible: CompositorService.isNiri || CompositorService.isHyprland onToggled: checked => { - return SettingsData.set("showWorkspaceApps", - checked) - } + return SettingsData.set("showWorkspaceApps", checked); + } } - Row { + Row { width: parent.width - Theme.spacingL spacing: Theme.spacingL visible: SettingsData.showWorkspaceApps @@ -116,7 +112,7 @@ Item { topPadding: Theme.spacingXS bottomPadding: Theme.spacingXS onEditingFinished: { - SettingsData.set("maxWorkspaceIcons", parseInt(text, 10)) + SettingsData.set("maxWorkspaceIcons", parseInt(text, 10)); } } } @@ -157,8 +153,7 @@ Item { height: mediaSection.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 Column { @@ -290,8 +285,8 @@ Item { MouseArea { anchors.fill: parent onPressed: mouse => { - updaterCustomCommand.forceActiveFocus() - mouse.accepted = false + updaterCustomCommand.forceActiveFocus(); + mouse.accepted = false; } } } @@ -337,8 +332,8 @@ Item { MouseArea { anchors.fill: parent onPressed: mouse => { - updaterTerminalCustomClass.forceActiveFocus() - mouse.accepted = false + updaterTerminalCustomClass.forceActiveFocus(); + mouse.accepted = false; } } } @@ -352,8 +347,7 @@ Item { height: runningAppsSection.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 visible: CompositorService.isNiri || CompositorService.isHyprland @@ -390,9 +384,8 @@ Item { description: I18n.tr("Show only apps running in current workspace") checked: SettingsData.runningAppsCurrentWorkspace onToggled: checked => { - return SettingsData.set("runningAppsCurrentWorkspace", - checked) - } + return SettingsData.set("runningAppsCurrentWorkspace", checked); + } } } } @@ -402,8 +395,7 @@ Item { height: workspaceIconsSection.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 visible: SettingsData.hasNamedWorkspaces() @@ -449,12 +441,8 @@ Item { width: parent.width height: workspaceIconRow.implicitHeight + Theme.spacingM radius: Theme.cornerRadius - color: Qt.rgba(Theme.surfaceContainer.r, - Theme.surfaceContainer.g, - Theme.surfaceContainer.b, 0.5) - border.color: Qt.rgba(Theme.outline.r, - Theme.outline.g, - Theme.outline.b, 0.3) + color: Qt.rgba(Theme.surfaceContainer.r, Theme.surfaceContainer.g, Theme.surfaceContainer.b, 0.5) + border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.3) border.width: 0 Row { @@ -482,35 +470,28 @@ Item { anchors.verticalCenter: parent.verticalCenter Component.onCompleted: { - var iconData = SettingsData.getWorkspaceNameIcon( - modelData) + var iconData = SettingsData.getWorkspaceNameIcon(modelData); if (iconData) { - setIcon(iconData.value, - iconData.type) + setIcon(iconData.value, iconData.type); } } onIconSelected: (iconName, iconType) => { - SettingsData.setWorkspaceNameIcon( - modelData, { - "type": iconType, - "value": iconName - }) - setIcon(iconName, - iconType) - } + SettingsData.setWorkspaceNameIcon(modelData, { + "type": iconType, + "value": iconName + }); + setIcon(iconName, iconType); + } Connections { target: SettingsData function onWorkspaceIconsUpdated() { - var iconData = SettingsData.getWorkspaceNameIcon( - modelData) + var iconData = SettingsData.getWorkspaceNameIcon(modelData); if (iconData) { - iconPicker.setIcon( - iconData.value, - iconData.type) + iconPicker.setIcon(iconData.value, iconData.type); } else { - iconPicker.setIcon("", "icon") + iconPicker.setIcon("", "icon"); } } } @@ -539,8 +520,7 @@ Item { hoverEnabled: true cursorShape: Qt.PointingHandCursor onClicked: { - SettingsData.removeWorkspaceNameIcon( - modelData) + SettingsData.removeWorkspaceNameIcon(modelData); } } } @@ -560,8 +540,7 @@ Item { height: notificationSection.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 Column { @@ -603,41 +582,41 @@ Item { description: I18n.tr("Choose where notification popups appear on screen") currentValue: { if (SettingsData.notificationPopupPosition === -1) { - return "Top Center" + return "Top Center"; } switch (SettingsData.notificationPopupPosition) { case SettingsData.Position.Top: - return "Top Right" + return "Top Right"; case SettingsData.Position.Bottom: - return "Bottom Left" + return "Bottom Left"; case SettingsData.Position.Left: - return "Top Left" + return "Top Left"; case SettingsData.Position.Right: - return "Bottom Right" + return "Bottom Right"; default: - return "Top Right" + return "Top Right"; } } options: ["Top Right", "Top Left", "Top Center", "Bottom Right", "Bottom Left"] onValueChanged: value => { switch (value) { case "Top Right": - SettingsData.set("notificationPopupPosition", SettingsData.Position.Top) - break + SettingsData.set("notificationPopupPosition", SettingsData.Position.Top); + break; case "Top Left": - SettingsData.set("notificationPopupPosition", SettingsData.Position.Left) - break + SettingsData.set("notificationPopupPosition", SettingsData.Position.Left); + break; case "Top Center": - SettingsData.set("notificationPopupPosition", -1) - break + SettingsData.set("notificationPopupPosition", -1); + break; case "Bottom Right": - SettingsData.set("notificationPopupPosition", SettingsData.Position.Right) - break + SettingsData.set("notificationPopupPosition", SettingsData.Position.Right); + break; case "Bottom Left": - SettingsData.set("notificationPopupPosition", SettingsData.Position.Bottom) - break + SettingsData.set("notificationPopupPosition", SettingsData.Position.Bottom); + break; } - SettingsData.sendTestNotifications() + SettingsData.sendTestNotifications(); } } } @@ -649,8 +628,7 @@ Item { height: osdRow.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 Row { @@ -694,8 +672,8 @@ Item { anchors.verticalCenter: parent.verticalCenter checked: SettingsData.osdAlwaysShowValue onToggleCompleted: checked => { - SettingsData.set("osdAlwaysShowValue", checked) - } + SettingsData.set("osdAlwaysShowValue", checked); + } } } } @@ -705,8 +683,7 @@ Item { height: osdSection.implicitHeight + Theme.spacingL * 2 radius: Theme.cornerRadius color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) - 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: 0 Column { @@ -749,52 +726,52 @@ Item { currentValue: { switch (SettingsData.osdPosition) { case SettingsData.Position.Top: - return "Top Right" + return "Top Right"; case SettingsData.Position.Left: - return "Top Left" + return "Top Left"; case SettingsData.Position.TopCenter: - return "Top Center" + return "Top Center"; case SettingsData.Position.Right: - return "Bottom Right" + return "Bottom Right"; case SettingsData.Position.Bottom: - return "Bottom Left" + return "Bottom Left"; case SettingsData.Position.BottomCenter: - return "Bottom Center" + return "Bottom Center"; case SettingsData.Position.LeftCenter: - return "Left Center" + return "Left Center"; case SettingsData.Position.RightCenter: - return "Right Center" + return "Right Center"; default: - return "Bottom Center" + return "Bottom Center"; } } options: ["Top Right", "Top Left", "Top Center", "Bottom Right", "Bottom Left", "Bottom Center", "Left Center", "Right Center"] onValueChanged: value => { switch (value) { case "Top Right": - SettingsData.set("osdPosition", SettingsData.Position.Top) - break + SettingsData.set("osdPosition", SettingsData.Position.Top); + break; case "Top Left": - SettingsData.set("osdPosition", SettingsData.Position.Left) - break + SettingsData.set("osdPosition", SettingsData.Position.Left); + break; case "Top Center": - SettingsData.set("osdPosition", SettingsData.Position.TopCenter) - break + SettingsData.set("osdPosition", SettingsData.Position.TopCenter); + break; case "Bottom Right": - SettingsData.set("osdPosition", SettingsData.Position.Right) - break + SettingsData.set("osdPosition", SettingsData.Position.Right); + break; case "Bottom Left": - SettingsData.set("osdPosition", SettingsData.Position.Bottom) - break + SettingsData.set("osdPosition", SettingsData.Position.Bottom); + break; case "Bottom Center": - SettingsData.set("osdPosition", SettingsData.Position.BottomCenter) - break + SettingsData.set("osdPosition", SettingsData.Position.BottomCenter); + break; case "Left Center": - SettingsData.set("osdPosition", SettingsData.Position.LeftCenter) - break + SettingsData.set("osdPosition", SettingsData.Position.LeftCenter); + break; case "Right Center": - SettingsData.set("osdPosition", SettingsData.Position.RightCenter) - break + SettingsData.set("osdPosition", SettingsData.Position.RightCenter); + break; } } } @@ -806,18 +783,17 @@ Item { description: I18n.tr("Show on-screen display when volume changes") checked: SettingsData.osdVolumeEnabled onToggled: checked => { - return SettingsData.set("osdVolumeEnabled", checked) + return SettingsData.set("osdVolumeEnabled", checked); } } - DankToggle { width: parent.width text: I18n.tr("Media Volume OSD") description: I18n.tr("Show on-screen display when media player volume changes") checked: SettingsData.osdMediaVolumeEnabled onToggled: checked => { - return SettingsData.set("osdMediaVolumeEnabled", checked) + return SettingsData.set("osdMediaVolumeEnabled", checked); } } @@ -827,7 +803,7 @@ Item { description: I18n.tr("Show on-screen display when brightness changes") checked: SettingsData.osdBrightnessEnabled onToggled: checked => { - return SettingsData.set("osdBrightnessEnabled", checked) + return SettingsData.set("osdBrightnessEnabled", checked); } } @@ -837,7 +813,7 @@ Item { description: I18n.tr("Show on-screen display when idle inhibitor state changes") checked: SettingsData.osdIdleInhibitorEnabled onToggled: checked => { - return SettingsData.set("osdIdleInhibitorEnabled", checked) + return SettingsData.set("osdIdleInhibitorEnabled", checked); } } @@ -847,7 +823,7 @@ Item { description: I18n.tr("Show on-screen display when microphone is muted/unmuted") checked: SettingsData.osdMicMuteEnabled onToggled: checked => { - return SettingsData.set("osdMicMuteEnabled", checked) + return SettingsData.set("osdMicMuteEnabled", checked); } } @@ -857,7 +833,7 @@ Item { description: I18n.tr("Show on-screen display when caps lock state changes") checked: SettingsData.osdCapsLockEnabled onToggled: checked => { - return SettingsData.set("osdCapsLockEnabled", checked) + return SettingsData.set("osdCapsLockEnabled", checked); } } @@ -867,7 +843,7 @@ Item { description: I18n.tr("Show on-screen display when power profile changes") checked: SettingsData.osdPowerProfileEnabled onToggled: checked => { - return SettingsData.set("osdPowerProfileEnabled", checked) + return SettingsData.set("osdPowerProfileEnabled", checked); } } }