Open gaming screenshots in annotated Loupe
This commit is contained in:
parent
af785503d6
commit
35959ae819
5 changed files with 63 additions and 6 deletions
|
|
@ -79,6 +79,23 @@ in
|
|||
# land in unrelated hues from the ink the shell frame is drawn in.
|
||||
ink4 = ui.mixHex c.base05 c.base00 ui.inkMuted;
|
||||
ink3 = ui.mixHex c.base05 c.base00 ui.inkFaint;
|
||||
screenshotWithLoupe = pkgs.writeShellScript "screenshot-with-loupe" ''
|
||||
set -eu
|
||||
dir="''${XDG_RUNTIME_DIR:?}/loupe-screenshots"
|
||||
${pkgs.coreutils}/bin/mkdir -m 700 -p "$dir"
|
||||
name="$(${pkgs.coreutils}/bin/date +%Y%m%d-%H%M%S-%N).png"
|
||||
${pkgs.hyprshot}/bin/hyprshot -m "$1" -o "$dir" -f "$name" --silent
|
||||
[ -s "$dir/$name" ] || exit 0
|
||||
|
||||
# Quickshell retains at most 30 notifications. Keep the same number of
|
||||
# screenshots so notification clicks work without filling runtime tmpfs.
|
||||
${pkgs.findutils}/bin/find "$dir" -maxdepth 1 -type f -name '*.png' -printf '%f\n' \
|
||||
| ${pkgs.coreutils}/bin/sort \
|
||||
| ${pkgs.coreutils}/bin/head -n -30 \
|
||||
| while IFS= read -r old; do ${pkgs.coreutils}/bin/rm -- "$dir/$old"; done
|
||||
${pkgs.libnotify}/bin/notify-send -a Hyprshot -i "$dir/$name" \
|
||||
'Screenshot copied' 'Click to annotate in Loupe. Saved temporarily until logout.'
|
||||
'';
|
||||
in {
|
||||
# Stylix's Hyprland target injects settings.{general,decoration,group,misc}
|
||||
# as top-level keys, which render as hl.general()/hl.decoration()/… in Lua
|
||||
|
|
@ -506,11 +523,15 @@ 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).
|
||||
-- --clipboard-only: nothing hits the disk, so there is no folder to
|
||||
-- fill and no file for the notification to thumbnail. The bar draws
|
||||
-- a camera glyph instead of holding a decoded screen-sized texture.
|
||||
${if isMacbook then ''
|
||||
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"))
|
||||
'' else ''
|
||||
-- On gaming, save temporary PNGs so the notification can reopen
|
||||
-- the exact screenshot in Loupe, while hyprshot still copies it.
|
||||
hl.bind(mod .. " + SHIFT + S", hl.dsp.exec_cmd("sh -c 'qs ipc call screenshot pin; ${screenshotWithLoupe} region; qs ipc call screenshot unpin'"))
|
||||
hl.bind("Print", hl.dsp.exec_cmd("${screenshotWithLoupe} output"))
|
||||
''}
|
||||
|
||||
-- Settings shortcut — Super+I matches GNOME binding
|
||||
hl.bind(mod .. " + I", hl.dsp.exec_cmd("pavucontrol"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue