From 30c54cb7ce25ca2824c1470dc142f0ccbb191194 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Sun, 29 Jun 2025 21:05:29 +0200 Subject: [PATCH] screenshot: account for scaled monitors (#1539) --- .config/quickshell/screenshot.qml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.config/quickshell/screenshot.qml b/.config/quickshell/screenshot.qml index 5d61062cc..9312aa238 100644 --- a/.config/quickshell/screenshot.qml +++ b/.config/quickshell/screenshot.qml @@ -87,7 +87,8 @@ ShellRoot { PanelWindow { id: panelWindow required property var modelData - property HyprlandMonitor hyprlandMonitor: Hyprland.monitorFor(modelData) + readonly property HyprlandMonitor hyprlandMonitor: Hyprland.monitorFor(modelData) + readonly property real monitorScale: hyprlandMonitor.scale property int activeWorkspaceId: hyprlandMonitor.activeWorkspace?.id ?? 0 property string screenshotPath: `${root.screenshotDir}/image-${modelData.name}` property real dragStartX: 0 @@ -293,7 +294,10 @@ ShellRoot { snipProc.startDetached(); Qt.quit(); } - command: ["bash", "-c", `magick ${StringUtils.shellSingleQuoteEscape(panelWindow.screenshotPath)} -crop ${panelWindow.regionWidth}x${panelWindow.regionHeight}+${panelWindow.regionX}+${panelWindow.regionY} - ` + `| ${panelWindow.mouseButton === Qt.LeftButton ? "wl-copy" : "swappy -f -"}`] + command: ["bash", "-c", + `magick ${StringUtils.shellSingleQuoteEscape(panelWindow.screenshotPath)} ` + + `-crop ${panelWindow.regionWidth * panelWindow.monitorScale}x${panelWindow.regionHeight * panelWindow.monitorScale}+${panelWindow.regionX * panelWindow.monitorScale}+${panelWindow.regionY * panelWindow.monitorScale} - ` + + `| ${panelWindow.mouseButton === Qt.LeftButton ? "wl-copy" : "swappy -f -"}`] } ScreencopyView {