From 7cd7a0e3dcc3839c19cbf98d6d1ac42005397a80 Mon Sep 17 00:00:00 2001 From: rope Date: Wed, 17 Jun 2026 15:20:53 +0100 Subject: [PATCH] screenshots: save file for notification previews, fall back to appIcon path Co-Authored-By: Claude Opus 4.8 --- settings/hyprland.nix | 4 ++-- settings/quickshell.nix | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/settings/hyprland.nix b/settings/hyprland.nix index abbf620..4347614 100644 --- a/settings/hyprland.nix +++ b/settings/hyprland.nix @@ -283,8 +283,8 @@ in -- Screenshots — Shift+Super+S matches GNOME binding -- Pin/unpin quickshell's focus grab around the region select so an -- open menu survives slurp's input grab (no-ops if qs isn't up). - hl.bind(mod .. " + SHIFT + S", hl.dsp.exec_cmd("sh -c 'qs ipc call screenshot pin; hyprshot -m region --clipboard-only; qs ipc call screenshot unpin'")) - hl.bind("Print", hl.dsp.exec_cmd("hyprshot -m output --clipboard-only")) + hl.bind(mod .. " + SHIFT + S", hl.dsp.exec_cmd("sh -c 'qs ipc call screenshot pin; hyprshot -m region; qs ipc call screenshot unpin'")) + hl.bind("Print", hl.dsp.exec_cmd("hyprshot -m output")) -- Settings shortcut — Super+I matches GNOME binding hl.bind(mod .. " + I", hl.dsp.exec_cmd("pavucontrol")) diff --git a/settings/quickshell.nix b/settings/quickshell.nix index 09956ab..cb30da4 100644 --- a/settings/quickshell.nix +++ b/settings/quickshell.nix @@ -2625,6 +2625,16 @@ in Rectangle { id: notifItem required property var modelData + // Prefer the notification's image; fall back to a + // file-path appIcon (e.g. hyprshot's saved shot). + readonly property string previewSource: { + let m = notifItem.modelData; + if (m.image && m.image !== "") return m.image; + let a = m.appIcon || ""; + if (a.startsWith("file://")) return a; + if (a.startsWith("/")) return "file://" + a; + return ""; + } width: parent.width height: Math.max(notifPreview.visible ? 48 : 0, ncBody.height) + 16 radius: Theme.radiusSmall @@ -2633,7 +2643,7 @@ in // Image preview (album art, screenshot thumb…) ClippingRectangle { id: notifPreview - visible: notifItem.modelData.image != "" + visible: notifItem.previewSource !== "" anchors.left: parent.left anchors.top: parent.top anchors.margins: 8 @@ -2643,7 +2653,7 @@ in Image { anchors.fill: parent fillMode: Image.PreserveAspectCrop - source: notifItem.modelData.image + source: notifItem.previewSource } }