Open gaming screenshots in annotated Loupe
This commit is contained in:
parent
af785503d6
commit
35959ae819
5 changed files with 63 additions and 6 deletions
|
|
@ -887,6 +887,7 @@ in
|
|||
readonly property string xdgOpen: "${pkgs.xdg-utils}/bin/xdg-open"
|
||||
readonly property string screenRec: "${screenRecScript}"
|
||||
readonly property string slurpRegion: "${slurpRegionScript}"
|
||||
readonly property string loupe: "${if isMacbook then "" else "${inputs.loupe.packages.${pkgs.stdenv.hostPlatform.system}.default}/bin/loupe"}"
|
||||
readonly property string themeApply: "${themeApply}"
|
||||
}
|
||||
'';
|
||||
|
|
@ -3418,6 +3419,7 @@ in
|
|||
// file-path appIcon (e.g. album art on disk). "" = none.
|
||||
function notifPreviewSource(notif) {
|
||||
if (!notif) return "";
|
||||
if (notif.appName === "Hyprshot") return "";
|
||||
if (notif.image && notif.image !== "") return notif.image;
|
||||
let a = notif.appIcon || "";
|
||||
if (a.startsWith("file://")) return a;
|
||||
|
|
@ -3426,9 +3428,8 @@ in
|
|||
}
|
||||
|
||||
// Glyph to fill the preview slot when there is no image to put
|
||||
// there. Screenshots run --clipboard-only, so nothing is written
|
||||
// to disk and there is no thumbnail to load — which is the point:
|
||||
// a decoded 3440x1440 texture cost ~19MB per retained shot.
|
||||
// there. Gaming screenshots stay on disk for opening in Loupe;
|
||||
// avoid holding full-screen preview textures in the bar.
|
||||
function notifPreviewIcon(notif) {
|
||||
if (!notif) return "";
|
||||
return notif.appName === "Hyprshot" ? "camera" : "";
|
||||
|
|
@ -3459,6 +3460,14 @@ in
|
|||
// behind the default action, so fire that too when they send one.
|
||||
function activateNotif(notif) {
|
||||
if (!notif) return;
|
||||
if (notif.appName === "Hyprshot" && Commands.loupe !== "") {
|
||||
let path = notif.appIcon || "";
|
||||
if (path.startsWith("file://")) path = decodeURIComponent(path.substring(7));
|
||||
if (path.startsWith("/") && path.includes("/loupe-screenshots/") && path.endsWith(".png")) {
|
||||
Quickshell.execDetached([Commands.loupe, path]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (const a of notif.actions)
|
||||
if (a.identifier === "default") { a.invoke(); break; }
|
||||
focusNotifApp(notif);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue