style(hypr): format screen cap
This commit is contained in:
parent
f25684b23b
commit
5a0f8d2777
@ -1,25 +1,25 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
mk-gif() {
|
mk-gif() {
|
||||||
local tmpfile
|
|
||||||
local program_name="Screen Capture"
|
local program_name="Screen Capture"
|
||||||
local pid_file="/tmp/mk-gif-pid"
|
local pid_file="/tmp/mk-gif-pid"
|
||||||
|
|
||||||
if [[ -f "${pid_file}" ]]; then
|
if [[ -f "${pid_file}" ]]; then
|
||||||
notify-send "End ${program_name}" "Ending Screen Capture" -a "${program_name}"
|
notify-send "Saving ${program_name}" "This May Take a Minute" -a "${program_name}"
|
||||||
if ! kill -SIGINT "$(cat /tmp/mk-gif-pid)"; then
|
if ! kill -SIGINT "$(cat /tmp/mk-gif-pid)"; then
|
||||||
notify-send "Failed ${program_name}" "Failed to Save Screen Capture" -u "critical" -a "${program_name}"
|
notify-send "Failed ${program_name}" "Failed to Save Screen Capture" -u "critical" -a "${program_name}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
inotifywait -e delete_self /tmp/mk-gif-pid && notify-send "Saved ${program_name}" "Successfully Saved Screen Capture to Clipboard" -a "${program_name}"
|
inotifywait -e delete_self /tmp/mk-gif-pid && notify-send "Saved ${program_name}" "Successfully Saved Screen Capture to Clipboard" -a "${program_name}"
|
||||||
else
|
else
|
||||||
notify-send "Start ${program_name}" "Starting Screen Capture" -a "${program_name}"
|
local input_tmpfile
|
||||||
|
notify-send "Starting ${program_name}" "Recording GIF of Selected Region" -a "${program_name}"
|
||||||
input_tmpfile="/tmp/$(mktemp wf-recorder.XXXXXXXXXXX).mp4"
|
input_tmpfile="/tmp/$(mktemp wf-recorder.XXXXXXXXXXX).mp4"
|
||||||
wf-recorder -g "$(slurp)" -f "${input_tmpfile}" &
|
wf-recorder -g "$(slurp)" -f "${input_tmpfile}" &
|
||||||
printf "%s" $! >"${pid_file}"
|
printf "%s" $! >"${pid_file}"
|
||||||
wait
|
wait
|
||||||
yes | gifski "${input_tmpfile}" --output "${input_tmpfile}.gif"
|
yes | gifski "${input_tmpfile}" --output "${input_tmpfile}.gif"
|
||||||
cat "${input_tmpfile}.gif" | wl-copy --type image/gif
|
wl-copy --type image/gif <"${input_tmpfile}.gif"
|
||||||
rm -f "${pid_file}"
|
rm -f "${pid_file}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user