From db696a65d4c603cdc13aa1e86a5bc3fcf775b150 Mon Sep 17 00:00:00 2001 From: barbiefan Date: Thu, 14 Nov 2024 10:51:59 +0400 Subject: [PATCH] perf(grim): replaces grim with wayshot Grim takes more than half a second on my machine when taking a full screen screenshot, so I replaced its use with wayshot | command | user | system | cpu | total | | ---------------------------------------------- | ----- | ------ | --- | ----- | | grim -g '0,0 3440x1440' \| wl-copy | 0.62s | 0.00s | 98% | 0.635 | | wayshot -s '0,0 3440x1440' --stdout \| wl-copy | 0.03s | 0.01s | 70% | 0.057 | --- README.md | 2 +- hyprshot | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ddbcf18..23d3d2c 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Activate wayland overlay as described in [README](https://github.com/bsd-ac/wayl - hyprland (this one should be obvious) - jq (to parse and manipulate json) -- grim (to take the screenshot) +- wayshot (to take the screenshot) - slurp (to select what to screenshot) - wl-clipboard (to copy screenshot to clipboard) - libnotify (to get notified when a screenshot is saved) diff --git a/hyprshot b/hyprshot index 0fb976f..19d6fbc 100755 --- a/hyprshot +++ b/hyprshot @@ -111,20 +111,20 @@ function save_geometry() { local output="" if [ $RAW -eq 1 ]; then - grim -g "${geometry}" - + wayshot -s "${geometry}" --stdout return 0 fi if [ $CLIPBOARD -eq 0 ]; then mkdir -p "$SAVEDIR" - grim -g "${geometry}" "$SAVE_FULLPATH" + wayshot -s "${geometry}" -f "$SAVE_FULLPATH" output="$SAVE_FULLPATH" wl-copy --type image/png < "$output" [ -z "$COMMAND" ] || { "$COMMAND" "$output" } else - wl-copy --type image/png < <(grim -g "${geometry}" -) + wl-copy --type image/png < <(wayshot -s "${geometry}" --stdout) fi send_notification $output