forked from Shinonome/dots-hyprland
overview: add allow not centering icons
This commit is contained in:
@@ -358,6 +358,7 @@ Singleton {
|
|||||||
property real scale: 0.18 // Relative to screen size
|
property real scale: 0.18 // Relative to screen size
|
||||||
property real rows: 2
|
property real rows: 2
|
||||||
property real columns: 5
|
property real columns: 5
|
||||||
|
property bool centerIcons: true
|
||||||
}
|
}
|
||||||
|
|
||||||
property JsonObject regionSelector: JsonObject {
|
property JsonObject regionSelector: JsonObject {
|
||||||
|
|||||||
@@ -43,10 +43,12 @@ Item { // Window
|
|||||||
property bool hovered: false
|
property bool hovered: false
|
||||||
property bool pressed: false
|
property bool pressed: false
|
||||||
|
|
||||||
property var iconToWindowRatio: 0.35
|
property bool centerIcons: Config.options.overview.centerIcons
|
||||||
property var xwaylandIndicatorToIconRatio: 0.35
|
property real iconGapRatio: 0.06
|
||||||
property var iconToWindowRatioCompact: 0.6
|
property real iconToWindowRatio: centerIcons ? 0.35 : 0.15
|
||||||
property var iconPath: Quickshell.iconPath(AppSearch.guessIcon(windowData?.class), "image-missing")
|
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 compactMode: Appearance.font.pixelSize.smaller * 4 > targetWindowHeight || Appearance.font.pixelSize.smaller * 4 > targetWindowWidth
|
||||||
|
|
||||||
property bool indicateXWayland: windowData?.xwayland ?? false
|
property bool indicateXWayland: windowData?.xwayland ?? false
|
||||||
@@ -109,14 +111,20 @@ Item { // Window
|
|||||||
|
|
||||||
Image {
|
Image {
|
||||||
id: windowIcon
|
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: {
|
property var iconSize: {
|
||||||
// console.log("-=-=-", root.toplevel.title, "-=-=-")
|
// console.log("-=-=-", root.toplevel.title, "-=-=-")
|
||||||
// console.log("Target window size:", targetWindowWidth, targetWindowHeight)
|
// console.log("Target window size:", targetWindowWidth, targetWindowHeight)
|
||||||
// console.log("Icon ratio:", root.compactMode ? root.iconToWindowRatioCompact : root.iconToWindowRatio)
|
// console.log("Icon ratio:", root.compactMode ? root.iconToWindowRatioCompact : root.iconToWindowRatio)
|
||||||
// console.log("Scale:", root.monitorData.scale)
|
// console.log("Scale:", root.monitorData.scale)
|
||||||
// console.log("Final:", Math.min(targetWindowWidth, targetWindowHeight) * (root.compactMode ? root.iconToWindowRatioCompact : root.iconToWindowRatio) / 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
|
// mipmap: true
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
|||||||
@@ -961,6 +961,14 @@ ContentPage {
|
|||||||
Config.options.overview.enable = checked;
|
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 {
|
ConfigSpinBox {
|
||||||
icon: "loupe"
|
icon: "loupe"
|
||||||
text: Translation.tr("Scale (%)")
|
text: Translation.tr("Scale (%)")
|
||||||
|
|||||||
Reference in New Issue
Block a user