From 22fb48cd0afe51363fa427128b677710043d166f Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Mon, 3 Nov 2025 21:36:12 +0100 Subject: [PATCH] overview: add allow not centering icons --- .../quickshell/ii/modules/common/Config.qml | 1 + .../ii/modules/overview/OverviewWindow.qml | 20 +++++++++++++------ .../ii/modules/settings/InterfaceConfig.qml | 8 ++++++++ 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/dots/.config/quickshell/ii/modules/common/Config.qml b/dots/.config/quickshell/ii/modules/common/Config.qml index 39c0ef131..4df736237 100644 --- a/dots/.config/quickshell/ii/modules/common/Config.qml +++ b/dots/.config/quickshell/ii/modules/common/Config.qml @@ -358,6 +358,7 @@ Singleton { property real scale: 0.18 // Relative to screen size property real rows: 2 property real columns: 5 + property bool centerIcons: true } property JsonObject regionSelector: JsonObject { diff --git a/dots/.config/quickshell/ii/modules/overview/OverviewWindow.qml b/dots/.config/quickshell/ii/modules/overview/OverviewWindow.qml index e531c4b8c..a05fde09b 100644 --- a/dots/.config/quickshell/ii/modules/overview/OverviewWindow.qml +++ b/dots/.config/quickshell/ii/modules/overview/OverviewWindow.qml @@ -43,10 +43,12 @@ Item { // Window property bool hovered: false property bool pressed: false - property var iconToWindowRatio: 0.35 - property var xwaylandIndicatorToIconRatio: 0.35 - property var iconToWindowRatioCompact: 0.6 - property var iconPath: Quickshell.iconPath(AppSearch.guessIcon(windowData?.class), "image-missing") + property bool centerIcons: Config.options.overview.centerIcons + property real iconGapRatio: 0.06 + property real iconToWindowRatio: centerIcons ? 0.35 : 0.15 + property real xwaylandIndicatorToIconRatio: 0.35 + property real iconToWindowRatioCompact: 0.6 + property string iconPath: Quickshell.iconPath(AppSearch.guessIcon(windowData?.class), "image-missing") property bool compactMode: Appearance.font.pixelSize.smaller * 4 > targetWindowHeight || Appearance.font.pixelSize.smaller * 4 > targetWindowWidth property bool indicateXWayland: windowData?.xwayland ?? false @@ -109,14 +111,20 @@ Item { // Window Image { id: windowIcon - anchors.centerIn: parent + property real baseSize: Math.min(root.targetWindowWidth, root.targetWindowHeight) + anchors { + top: root.centerIcons ? undefined : parent.top + left: root.centerIcons ? undefined : parent.left + centerIn: root.centerIcons ? parent : undefined + margins: baseSize * root.iconGapRatio + } property var iconSize: { // console.log("-=-=-", root.toplevel.title, "-=-=-") // console.log("Target window size:", targetWindowWidth, targetWindowHeight) // console.log("Icon ratio:", root.compactMode ? root.iconToWindowRatioCompact : root.iconToWindowRatio) // console.log("Scale:", root.monitorData.scale) // console.log("Final:", Math.min(targetWindowWidth, targetWindowHeight) * (root.compactMode ? root.iconToWindowRatioCompact : root.iconToWindowRatio) / root.monitorData.scale) - return Math.min(root.targetWindowWidth, root.targetWindowHeight) * (root.compactMode ? root.iconToWindowRatioCompact : root.iconToWindowRatio); + return baseSize * (root.compactMode ? root.iconToWindowRatioCompact : root.iconToWindowRatio); } // mipmap: true Layout.alignment: Qt.AlignHCenter diff --git a/dots/.config/quickshell/ii/modules/settings/InterfaceConfig.qml b/dots/.config/quickshell/ii/modules/settings/InterfaceConfig.qml index 13a909cbb..89e202e0c 100644 --- a/dots/.config/quickshell/ii/modules/settings/InterfaceConfig.qml +++ b/dots/.config/quickshell/ii/modules/settings/InterfaceConfig.qml @@ -961,6 +961,14 @@ ContentPage { Config.options.overview.enable = checked; } } + ConfigSwitch { + buttonIcon: "center_focus_strong" + text: Translation.tr("Center icons") + checked: Config.options.overview.centerIcons + onCheckedChanged: { + Config.options.overview.centerIcons = checked; + } + } ConfigSpinBox { icon: "loupe" text: Translation.tr("Scale (%)")