From fea06c2164ef863b772f6903b7633bcc40e9835e Mon Sep 17 00:00:00 2001 From: ItsLemmy Date: Mon, 3 Nov 2025 10:29:49 -0500 Subject: [PATCH] Shadows: conditional via settings q --- Assets/Translations/de.json | 4 ++++ Assets/Translations/en.json | 4 ++++ Assets/Translations/es.json | 4 ++++ Assets/Translations/fr.json | 4 ++++ Assets/Translations/pt.json | 4 ++++ Assets/Translations/zh-CN.json | 4 ++++ Assets/settings-default.json | 23 +++++++++++------- Commons/Settings.qml | 28 ++++++++++++---------- Modules/Settings/Tabs/UserInterfaceTab.qml | 7 ++++++ Widgets/NFullScreenWindow.qml | 7 +++--- Widgets/NPanel.qml | 23 ++++++++++++++---- 11 files changed, 81 insertions(+), 31 deletions(-) diff --git a/Assets/Translations/de.json b/Assets/Translations/de.json index 4949b25f..c7df24cf 100644 --- a/Assets/Translations/de.json +++ b/Assets/Translations/de.json @@ -884,6 +884,10 @@ "dim-desktop": { "description": "Den Desktop abdunkeln, wenn Fenster oder Menüs geöffnet sind.", "label": "Dimmer Schreibtisch" + }, + "shadows": { + "description": "Aktiviert Schlagschatten unter Balken und Panels.", + "label": "Schlagschatten" } }, "lock-screen": { diff --git a/Assets/Translations/en.json b/Assets/Translations/en.json index 8bee2a80..66f7f28b 100644 --- a/Assets/Translations/en.json +++ b/Assets/Translations/en.json @@ -859,6 +859,10 @@ "description": "Changes the size of the general user interface, excluding the bar.", "reset-scaling": "Reset interface scaling" }, + "shadows": { + "label": "Drop shadows", + "description": "Enables drop shadows under bars and panels." + }, "dim-desktop": { "label": "Dim desktop", "description": "Dim the desktop when panels or menus are open." diff --git a/Assets/Translations/es.json b/Assets/Translations/es.json index e4eb12b6..a6344bf9 100644 --- a/Assets/Translations/es.json +++ b/Assets/Translations/es.json @@ -884,6 +884,10 @@ "dim-desktop": { "description": "Atenuar el escritorio cuando los paneles o menús estén abiertos.", "label": "Dim escritorio" + }, + "shadows": { + "description": "Habilita sombras paralelas debajo de las barras y los paneles.", + "label": "Sombras paralelas" } }, "lock-screen": { diff --git a/Assets/Translations/fr.json b/Assets/Translations/fr.json index cadc7836..5e741f0a 100644 --- a/Assets/Translations/fr.json +++ b/Assets/Translations/fr.json @@ -884,6 +884,10 @@ "dim-desktop": { "description": "Atténuer le bureau lorsque des panneaux ou des menus sont ouverts.", "label": "Dim bureau" + }, + "shadows": { + "description": "Active les ombres portées sous les barres et les panneaux.", + "label": "Ombres portées" } }, "lock-screen": { diff --git a/Assets/Translations/pt.json b/Assets/Translations/pt.json index 41ca38e0..06021582 100644 --- a/Assets/Translations/pt.json +++ b/Assets/Translations/pt.json @@ -884,6 +884,10 @@ "dim-desktop": { "description": "Escurecer a área de trabalho quando painéis ou menus estiverem abertos.", "label": "Dim área de trabalho" + }, + "shadows": { + "description": "Ativa sombras projetadas sob barras e painéis.", + "label": "Sombras projetadas" } }, "lock-screen": { diff --git a/Assets/Translations/zh-CN.json b/Assets/Translations/zh-CN.json index 11a1b176..518e3ea2 100644 --- a/Assets/Translations/zh-CN.json +++ b/Assets/Translations/zh-CN.json @@ -884,6 +884,10 @@ "dim-desktop": { "description": "当面板或菜单打开时,桌面变暗。", "label": "昏暗的桌面" + }, + "shadows": { + "description": "启用条形图和面板下的阴影。", + "label": "阴影" } }, "lock-screen": { diff --git a/Assets/settings-default.json b/Assets/settings-default.json index 60096117..2c1e418a 100644 --- a/Assets/settings-default.json +++ b/Assets/settings-default.json @@ -10,6 +10,8 @@ "floating": false, "marginVertical": 0.25, "marginHorizontal": 0.25, + "outerCorners": true, + "exclusive": true, "widgets": { "left": [ { @@ -57,6 +59,7 @@ }, "general": { "avatarImage": "", + "dimDesktop": true, "showScreenCorners": false, "forceBlackScreenCorners": false, "scaleRatio": 1, @@ -66,8 +69,18 @@ "animationDisabled": false, "compactLockScreen": false, "lockOnSuspend": true, + "enableShadows": true, "language": "" }, + "ui": { + "fontDefault": "Roboto", + "fontFixed": "DejaVu Sans Mono", + "fontDefaultScale": 1, + "fontFixedScale": 1, + "tooltipsEnabled": true, + "panelsAttachedToBar": true, + "panelsOverlayLayer": true + }, "location": { "name": "Tokyo", "weatherEnabled": true, @@ -212,15 +225,6 @@ "mprisBlacklist": [], "preferredPlayer": "" }, - "ui": { - "fontDefault": "Roboto", - "fontFixed": "DejaVu Sans Mono", - "fontDefaultScale": 1, - "fontFixedScale": 1, - "tooltipsEnabled": true, - "panelsAttachedToBar": true, - "panelsOverlayLayer": true - }, "brightness": { "brightnessStep": 5, "enforceMinimum": true @@ -239,6 +243,7 @@ "gtk": false, "qt": false, "kcolorscheme": false, + "alacritty": false, "kitty": false, "ghostty": false, "foot": false, diff --git a/Commons/Settings.qml b/Commons/Settings.qml index 105b6df4..b445ba61 100644 --- a/Commons/Settings.qml +++ b/Commons/Settings.qml @@ -54,8 +54,9 @@ Singleton { // This should only be activated once when the settings structure has changed // Then it should be commented out again, regular users don't need to generate // default settings on every start - // TODO: automate this someday! - //generateDefaultSettings() + if (isDebug) { + generateDefaultSettings() + } // Patch-in the local default, resolved to user's home adapter.general.avatarImage = defaultAvatar @@ -198,9 +199,21 @@ Singleton { property bool animationDisabled: false property bool compactLockScreen: false property bool lockOnSuspend: true + property bool enableShadows: true property string language: "" } + // ui + property JsonObject ui: JsonObject { + property string fontDefault: "Roboto" + property string fontFixed: "DejaVu Sans Mono" + property real fontDefaultScale: 1.0 + property real fontFixedScale: 1.0 + property bool tooltipsEnabled: true + property bool panelsAttachedToBar: true + property bool panelsOverlayLayer: true + } + // location property JsonObject location: JsonObject { property string name: defaultLocation @@ -353,17 +366,6 @@ Singleton { property string preferredPlayer: "" } - // ui - property JsonObject ui: JsonObject { - property string fontDefault: "Roboto" - property string fontFixed: "DejaVu Sans Mono" - property real fontDefaultScale: 1.0 - property real fontFixedScale: 1.0 - property bool tooltipsEnabled: true - property bool panelsAttachedToBar: true - property bool panelsOverlayLayer: true - } - // brightness property JsonObject brightness: JsonObject { property int brightnessStep: 5 diff --git a/Modules/Settings/Tabs/UserInterfaceTab.qml b/Modules/Settings/Tabs/UserInterfaceTab.qml index a466c7ec..f93c2e8e 100644 --- a/Modules/Settings/Tabs/UserInterfaceTab.qml +++ b/Modules/Settings/Tabs/UserInterfaceTab.qml @@ -40,6 +40,13 @@ ColumnLayout { onToggled: checked => Settings.data.ui.panelsAttachedToBar = checked } + NToggle { + label: I18n.tr("settings.user-interface.shadows.label") + description: I18n.tr("settings.user-interface.shadows.description") + checked: Settings.data.general.enableShadows + onToggled: checked => Settings.data.general.enableShadows = checked + } + NToggle { label: I18n.tr("settings.user-interface.panels-overlay.label") description: I18n.tr("settings.user-interface.panels-overlay.description") diff --git a/Widgets/NFullScreenWindow.qml b/Widgets/NFullScreenWindow.qml index 6c6737a3..911916c1 100644 --- a/Widgets/NFullScreenWindow.qml +++ b/Widgets/NFullScreenWindow.qml @@ -16,7 +16,6 @@ PanelWindow { required property var panelComponents // Shadow properties - property bool shadowEnabled: true property real shadowOpacity: 1.0 property real shadowBlur: 1.0 property real shadowHorizontalOffset: 2 @@ -193,14 +192,14 @@ PanelWindow { height: root.height // Apply shadow effect - layer.enabled: root.shadowEnabled + layer.enabled: Settings.data.general.enableShadows layer.smooth: true // layer.textureSize: { // var dpr = CompositorService.getDisplayScale(screen.name) // return Qt.size(width * dpr, height * dpr) // } layer.effect: MultiEffect { - shadowEnabled: root.shadowEnabled + shadowEnabled: true shadowOpacity: root.shadowOpacity shadowHorizontalOffset: root.shadowHorizontalOffset shadowVerticalOffset: root.shadowVerticalOffset @@ -213,7 +212,7 @@ PanelWindow { // Always positioned at actual screen edges Loader { id: screenCornersLoader - active: Settings.data.general.showScreenCorners && (!Settings.data.ui.panelsAttachedToBar || Settings.data.bar.backgroundOpacity >= 1 || Settings.data.bar.floating) + active: Settings.data.general.showScreenCorners anchors.fill: parent z: 1000 // Very high z-index to be on top of everything diff --git a/Widgets/NPanel.qml b/Widgets/NPanel.qml index 2a1c20ac..a78ae508 100644 --- a/Widgets/NPanel.qml +++ b/Widgets/NPanel.qml @@ -52,6 +52,7 @@ Item { // Animation properties property real animationProgress: 0 + property bool isClosing: false // Keyboard event handlers - override these in specific panels to handle shortcuts // These are called from NFullScreenWindow's centralized shortcuts @@ -76,6 +77,13 @@ Item { NumberAnimation { duration: Style.animationFast easing.type: Easing.OutCubic + onRunningChanged: { + // When close animation finishes, actually hide the panel + if (!running && root.isClosing) { + root.isClosing = false + root.isPanelOpen = false + } + } } } @@ -106,7 +114,8 @@ Item { signal closed // Panel visibility and sizing - visible: isPanelOpen + // Keep visible during close animation + visible: isPanelOpen || isClosing width: parent ? parent.width : 0 height: parent ? parent.height : 0 @@ -156,15 +165,18 @@ Item { } function close() { - isPanelOpen = false + // Start close animation + isClosing = true animationProgress = 0 - // Notify PanelService + // Notify PanelService immediately PanelService.closedPanel(root) + // Emit closed signal closed() - Logger.d("NPanel", "Closed panel", objectName) + Logger.d("NPanel", "Closing panel with animation", objectName) + // isPanelOpen will be set to false when animation completes } function setPosition() {// Position calculation will be handled here @@ -175,7 +187,8 @@ Item { Loader { id: panelContentContainer anchors.fill: parent - active: root.isPanelOpen + // Keep active during close animation + active: root.isPanelOpen || root.isClosing asynchronous: false sourceComponent: Item {