oh hey thats nice

This commit is contained in:
Reid 2025-01-02 16:19:49 -06:00
parent 542d57342e
commit c4fa167aaa
Signed by: reidlab
GPG key ID: DAF5EAF6665839FD
3 changed files with 15 additions and 1 deletions

View file

@ -92,6 +92,8 @@ in {
];
bind = let
screenshotScript = pkgs.writeShellScript "screenshot" ''
set -euo pipefail
temp_file=$(mktemp)
trap 'rm -f "$temp_file"' EXIT
@ -112,7 +114,7 @@ in {
;;
esac
${lib.getExe pkgs.grimblast} --freeze save "$mode" - > "$temp_file" || exit 0 # exit successful, highly unlikely that grimblast failed, and it is more likely that the user cancelled the screenshot
${lib.getExe pkgs.grimblast} --freeze save "$mode" - > "$temp_file"
cat "$temp_file" | ${lib.getExe pkgs.wl-clipboard-x11} -selection clipboard -t image/png
@ -130,6 +132,8 @@ in {
esac
'';
pickerScript = pkgs.writeShellScript "picker" ''
set -euo pipefail
${lib.getExe pkgs.hyprpicker} --render-inactive --format hex | sed -z 's/\n//g' | ${lib.getExe pkgs.wl-clipboard-x11} -selection clipboard -t text/plain
${pkgs.libnotify}/bin/notify-send "Color Captured" \
@ -138,6 +142,8 @@ in {
"Color copied to clipboard"
'';
ocrScript = pkgs.writeShellScript "ocr" ''
set -euo pipefail
output=$(${lib.getExe pkgs.grimblast} --freeze save area - | ${lib.getExe pkgs.tesseract5} - -)
echo "$output" | ${lib.getExe pkgs.wl-clipboard-x11} -selection clipboard -t text/plain