screenshots: save file for notification previews, fall back to appIcon path

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
rope 2026-06-17 15:20:53 +01:00
parent f0193eedd3
commit 7cd7a0e3dc
2 changed files with 14 additions and 4 deletions

View file

@ -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"))

View file

@ -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
}
}