From bdfa0e3512822d5a5ebb0da7f015717816475b06 Mon Sep 17 00:00:00 2001 From: adam01110 Date: Tue, 3 Mar 2026 22:28:08 +0100 Subject: [PATCH] changes from upstream --- EXAMPLE.md | 33 +++++++++++++++++++++++- common/Appearance.qml | 24 +++++++++--------- common/Config.qml | 35 ++++++++++++++++++++++++++ modules/overview/OverviewWidget.qml | 6 ++--- modules/overview/OverviewWindow.qml | 39 +++++++++++++++++++++++++---- nix/home-module.nix | 36 -------------------------- 6 files changed, 116 insertions(+), 57 deletions(-) diff --git a/EXAMPLE.md b/EXAMPLE.md index 3f0e920..40dca40 100644 --- a/EXAMPLE.md +++ b/EXAMPLE.md @@ -8,12 +8,43 @@ Path: `~/.config/overzicht/settings.json` ```json { + "appearance": { + "rounding": { + "unsharpen": 0, + "verysmall": 0, + "small": 0, + "normal": 0, + "large": 0, + "full": 0, + "screenRounding": 0, + "windowRounding": 0 + }, + "animation": { + "duration": { + "elementMove": 500, + "elementMoveEnter": 400, + "elementMoveFast": 200 + } + }, + "sizes": { + "elevationMargin": 10 + } + }, "overview": { "rows": 2, "columns": 4, "scale": 0.12, "enable": true, - "hideEmptyRows": false + "hideEmptyRows": false, + "workspaceSpacing": 5, + "backgroundPadding": 10, + "workspaceNumberBaseSize": 250 + }, + "windowPreview": { + "iconToWindowRatio": 0.25, + "iconToWindowRatioCompact": 0.45, + "xwaylandIndicatorToIconRatio": 0.35, + "inactiveMonitorOpacity": 0.4 }, "hacks": { "arbitraryRaceConditionDelay": 150 diff --git a/common/Appearance.qml b/common/Appearance.qml index 271b519..ca56731 100644 --- a/common/Appearance.qml +++ b/common/Appearance.qml @@ -114,14 +114,14 @@ Singleton { } rounding: QtObject { - property int unsharpen: 0 - property int verysmall: 0 - property int small: 0 - property int normal: 0 - property int large: 0 - property int full: 0 - property int screenRounding: 0 - property int windowRounding: 0 + property int unsharpen: Config.options.appearance.rounding.unsharpen + property int verysmall: Config.options.appearance.rounding.verysmall + property int small: Config.options.appearance.rounding.small + property int normal: Config.options.appearance.rounding.normal + property int large: Config.options.appearance.rounding.large + property int full: Config.options.appearance.rounding.full + property int screenRounding: Config.options.appearance.rounding.screenRounding + property int windowRounding: Config.options.appearance.rounding.windowRounding } font: QtObject { @@ -143,8 +143,8 @@ Singleton { readonly property list expressiveDefaultSpatial: [0.38, 1.21, 0.22, 1.00, 1, 1] readonly property list expressiveEffects: [0.34, 0.80, 0.34, 1.00, 1, 1] readonly property list emphasizedDecel: [0.05, 0.7, 0.1, 1, 1, 1] - readonly property real expressiveDefaultSpatialDuration: 500 - readonly property real expressiveEffectsDuration: 200 + readonly property real expressiveDefaultSpatialDuration: Config.options.appearance.animation.duration.elementMove + readonly property real expressiveEffectsDuration: Config.options.appearance.animation.duration.elementMoveFast } animation: QtObject { @@ -162,7 +162,7 @@ Singleton { } property QtObject elementMoveEnter: QtObject { - property int duration: 400 + property int duration: Config.options.appearance.animation.duration.elementMoveEnter property int type: Easing.BezierSpline property list bezierCurve: animationCurves.emphasizedDecel property Component numberAnimation: Component { @@ -189,6 +189,6 @@ Singleton { } sizes: QtObject { - property real elevationMargin: 10 + property real elevationMargin: Config.options.appearance.sizes.elevationMargin } } diff --git a/common/Config.qml b/common/Config.qml index ac47012..b78a14e 100644 --- a/common/Config.qml +++ b/common/Config.qml @@ -55,12 +55,47 @@ Singleton { Component.onCompleted: settingsData = parseSettingsData() property QtObject options: QtObject { + property QtObject appearance: QtObject { + property QtObject rounding: QtObject { + property int unsharpen: root.optionValue(["appearance", "rounding", "unsharpen"], 0) + property int verysmall: root.optionValue(["appearance", "rounding", "verysmall"], 0) + property int small: root.optionValue(["appearance", "rounding", "small"], 0) + property int normal: root.optionValue(["appearance", "rounding", "normal"], 0) + property int large: root.optionValue(["appearance", "rounding", "large"], 0) + property int full: root.optionValue(["appearance", "rounding", "full"], 0) + property int screenRounding: root.optionValue(["appearance", "rounding", "screenRounding"], 0) + property int windowRounding: root.optionValue(["appearance", "rounding", "windowRounding"], 0) + } + + property QtObject animation: QtObject { + property QtObject duration: QtObject { + property int elementMove: root.optionValue(["appearance", "animation", "duration", "elementMove"], 500) + property int elementMoveEnter: root.optionValue(["appearance", "animation", "duration", "elementMoveEnter"], 400) + property int elementMoveFast: root.optionValue(["appearance", "animation", "duration", "elementMoveFast"], 200) + } + } + + property QtObject sizes: QtObject { + property real elevationMargin: root.optionValue(["appearance", "sizes", "elevationMargin"], 10) + } + } + property QtObject overview: QtObject { property int rows: root.optionValue(["overview", "rows"], 2) property int columns: root.optionValue(["overview", "columns"], 4) property real scale: root.optionValue(["overview", "scale"], 0.12) property bool enable: root.optionValue(["overview", "enable"], true) property bool hideEmptyRows: root.optionValue(["overview", "hideEmptyRows"], false) + property real workspaceSpacing: root.optionValue(["overview", "workspaceSpacing"], 5) + property real backgroundPadding: root.optionValue(["overview", "backgroundPadding"], 10) + property real workspaceNumberBaseSize: root.optionValue(["overview", "workspaceNumberBaseSize"], 250) + } + + property QtObject windowPreview: QtObject { + property real iconToWindowRatio: root.optionValue(["windowPreview", "iconToWindowRatio"], 0.25) + property real iconToWindowRatioCompact: root.optionValue(["windowPreview", "iconToWindowRatioCompact"], 0.45) + property real xwaylandIndicatorToIconRatio: root.optionValue(["windowPreview", "xwaylandIndicatorToIconRatio"], 0.35) + property real inactiveMonitorOpacity: root.optionValue(["windowPreview", "inactiveMonitorOpacity"], 0.4) } property QtObject hacks: QtObject { diff --git a/modules/overview/OverviewWidget.qml b/modules/overview/OverviewWidget.qml index e86a21b..9473667 100644 --- a/modules/overview/OverviewWidget.qml +++ b/modules/overview/OverviewWidget.qml @@ -28,11 +28,11 @@ Item { property real workspaceImplicitHeight: (monitorData?.transform % 2 === 1) ? ((monitor.width / monitor.scale - (monitorData?.reserved?.[1] ?? 0) - (monitorData?.reserved?.[3] ?? 0)) * root.scale) : ((monitor.height / monitor.scale - (monitorData?.reserved?.[1] ?? 0) - (monitorData?.reserved?.[3] ?? 0)) * root.scale) property real workspaceNumberMargin: 80 - property real workspaceNumberSize: 250 * monitor.scale + property real workspaceNumberSize: Config.options.overview.workspaceNumberBaseSize * monitor.scale property int workspaceZ: 0 property int windowZ: 1 property int windowDraggingZ: 99999 - property real workspaceSpacing: 5 + property real workspaceSpacing: Config.options.overview.workspaceSpacing property int draggingFromWorkspace: -1 property int draggingTargetWorkspace: -1 @@ -86,7 +86,7 @@ Item { } Rectangle { // Background id: overviewBackground - property real padding: 10 + property real padding: Config.options.overview.backgroundPadding anchors.fill: parent anchors.margins: Appearance.sizes.elevationMargin diff --git a/modules/overview/OverviewWindow.qml b/modules/overview/OverviewWindow.qml index 73b96ef..74bd0e1 100644 --- a/modules/overview/OverviewWindow.qml +++ b/modules/overview/OverviewWindow.qml @@ -2,6 +2,7 @@ import QtQuick import QtQuick.Layouts import Quickshell import Quickshell.Wayland +import Quickshell.Hyprland import "../../common" import "../../common/functions" import "../../services" @@ -26,20 +27,21 @@ Item { // Window property bool hovered: false property bool pressed: false - property var iconToWindowRatio: 0.25 - property var xwaylandIndicatorToIconRatio: 0.35 - property var iconToWindowRatioCompact: 0.45 + property var iconToWindowRatio: Config.options.windowPreview.iconToWindowRatio + property var xwaylandIndicatorToIconRatio: Config.options.windowPreview.xwaylandIndicatorToIconRatio + property var iconToWindowRatioCompact: Config.options.windowPreview.iconToWindowRatioCompact property var entry: DesktopEntries.heuristicLookup(windowData?.class) property var iconPath: Quickshell.iconPath(entry?.icon ?? windowData?.class ?? "application-x-executable", "image-missing") property bool compactMode: Appearance.font.pixelSize.smaller * 4 > targetWindowHeight || Appearance.font.pixelSize.smaller * 4 > targetWindowWidth property bool indicateXWayland: windowData?.xwayland ?? false + property bool previewCaptureEnabled: true x: initX y: initY width: Math.min((windowData?.size[0] ?? 100) * root.scale, availableWorkspaceWidth) height: Math.min((windowData?.size[1] ?? 100) * root.scale, availableWorkspaceHeight) - opacity: (windowData?.monitor ?? -1) == widgetMonitorId ? 1 : 0.4 + opacity: (windowData?.monitor ?? -1) == widgetMonitorId ? 1 : Config.options.windowPreview.inactiveMonitorOpacity clip: true @@ -59,7 +61,7 @@ Item { // Window ScreencopyView { id: windowPreview anchors.fill: parent - captureSource: GlobalStates.overviewOpen ? root.toplevel : null + captureSource: GlobalStates.overviewOpen && root.previewCaptureEnabled ? root.toplevel : null live: true Rectangle { @@ -96,4 +98,31 @@ Item { // Window } } } + + function refreshCapture() { + if (!GlobalStates.overviewOpen) + return; + + root.previewCaptureEnabled = false; + previewResetTimer.restart(); + } + + Timer { + id: previewResetTimer + interval: 60 + repeat: false + onTriggered: root.previewCaptureEnabled = true + } + + Connections { + target: Hyprland + function onRawEvent(event) { + if (!GlobalStates.overviewOpen) + return; + + const eventName = `${event?.name ?? event?.event ?? event?.type ?? ""}`; + if (eventName === "closewindow" || eventName === "openwindow" || eventName === "movewindow") + root.refreshCapture(); + } + } } diff --git a/nix/home-module.nix b/nix/home-module.nix index 8243e9a..01d772d 100644 --- a/nix/home-module.nix +++ b/nix/home-module.nix @@ -39,47 +39,11 @@ in { settings = mkOption { type = types.oneOf [jsonFormat.type types.str types.path]; - default = { - overview = { - rows = 2; - columns = 4; - scale = 0.12; - enable = true; - hideEmptyRows = false; - }; - - hacks.arbitraryRaceConditionDelay = 150; - }; description = "Settings written to `~/.config/overzicht/settings.json`."; }; colors = mkOption { type = types.oneOf [jsonFormat.type types.str types.path]; - default = { - m3primary = "#fb4934"; - m3onPrimary = "#282828"; - m3primaryContainer = "#3c3836"; - m3onPrimaryContainer = "#fbf1c7"; - m3onSecondary = "#282828"; - m3secondaryContainer = "#3c3836"; - m3onSecondaryContainer = "#fbf1c7"; - m3onBackground = "#ebdbb2"; - m3surface = "#282828"; - m3surfaceContainerHigh = "#3c3836"; - m3surfaceContainerHighest = "#504945"; - m3surfaceVariant = "#504945"; - m3background = "#3c3836"; - m3secondary = "#b8bb26"; - m3surfaceContainerLow = "#282828"; - m3surfaceContainer = "#b8bb26"; - m3onSurface = "#282828"; - m3onSurfaceVariant = "#fbf1c7"; - m3inverseSurface = "#504945"; - m3inverseOnSurface = "#fbf1c7"; - m3outline = "#fbf1c7"; - m3outlineVariant = "#665c54"; - m3shadow = "#282828"; - }; description = "Colors written to `~/.config/overzicht/colors.json`."; }; }; -- 2.51.2