capture updates
This commit is contained in:
parent
1bd70f34ca
commit
9053b258c0
|
@ -9,13 +9,14 @@
|
||||||
, bash
|
, bash
|
||||||
, feh
|
, feh
|
||||||
, jq
|
, jq
|
||||||
, ffmpeg
|
|
||||||
, fzy
|
, fzy
|
||||||
, figlet
|
, figlet
|
||||||
, curl
|
, curl
|
||||||
, ytfzf
|
, ytfzf
|
||||||
, herbe
|
, herbe
|
||||||
, xrandr
|
, xrandr
|
||||||
|
, xrectsel
|
||||||
|
, ffcast
|
||||||
, svkbd
|
, svkbd
|
||||||
, xkbset
|
, xkbset
|
||||||
, rbw
|
, rbw
|
||||||
|
@ -30,7 +31,7 @@ stdenv.mkDerivation rec {
|
||||||
src = ./utils;
|
src = ./utils;
|
||||||
|
|
||||||
nativeBuildInputs = [ makeWrapper ];
|
nativeBuildInputs = [ makeWrapper ];
|
||||||
buildInputs = [ bash feh xrandr jq curl fzy ytfzf ffmpeg sshuttle svkbd scrcpy xkbset rbw xclip libsForQt5.kolourpaint ];
|
buildInputs = [ bash feh xrandr jq curl fzy ytfzf sshuttle svkbd scrcpy xkbset rbw xclip ffcast libsForQt5.kolourpaint ];
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
|
@ -38,7 +39,7 @@ stdenv.mkDerivation rec {
|
||||||
for i in $(ls $src/sh); do
|
for i in $(ls $src/sh); do
|
||||||
cp $src/sh/$i $out/bin
|
cp $src/sh/$i $out/bin
|
||||||
ln -sf $out/bin/tmenu_run $out/bin/regenerate
|
ln -sf $out/bin/tmenu_run $out/bin/regenerate
|
||||||
wrapProgram $out/bin/$i --prefix PATH : ${lib.makeBinPath [ sxhkd bash feh xrandr jq figlet curl fzy ytfzf herbe ffmpeg sshuttle svkbd scrcpy libsForQt5.kolourpaint ]}
|
wrapProgram $out/bin/$i --prefix PATH : ${lib.makeBinPath [ sxhkd bash feh xrandr jq figlet curl fzy ytfzf herbe sshuttle svkbd scrcpy libsForQt5.kolourpaint xrectsel ffcast ]}
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,60 +1,37 @@
|
||||||
#!/bin/sh
|
display=$(xrandr \
|
||||||
|
| grep ' connected' \
|
||||||
|
| awk -F ' ' '{print $1}' \
|
||||||
|
| sed '1i select rectangle' \
|
||||||
|
| fzy)
|
||||||
|
|
||||||
# get screen info and temporary file
|
case "$display" in
|
||||||
tmp=$(mktemp -d)
|
"select"*)
|
||||||
res=$(xrandr |
|
geom=$(xrectsel)
|
||||||
grep ' connected' |
|
|
||||||
awk -F' ' '{print $1 " " $4}' |
|
|
||||||
awk -F'+' '{print $1}' |
|
|
||||||
fzy |
|
|
||||||
awk -F' ' '{print $2}' )
|
|
||||||
|
|
||||||
# still or motion
|
|
||||||
medium=$(printf ".mp4\n.png\n" | fzy)
|
|
||||||
output="$tmp/main$medium"
|
|
||||||
|
|
||||||
# capture
|
|
||||||
case "$medium" in
|
|
||||||
*mp4*)
|
|
||||||
printf "> starting video capture...\n"
|
|
||||||
ffmpeg -video_size "$res" -f x11grab -framerate 60 -i $DISPLAY -preset ultrafast -pix_fmt yuv420p "$output"
|
|
||||||
;;
|
|
||||||
*png*)
|
|
||||||
printf "> taking screenshot...\n"
|
|
||||||
# for a screenshot, we usually want an a s t h e t i c
|
|
||||||
ffmpeg -f x11grab -video_size "$res" -i $DISPLAY -vframes 1 "$output" -loglevel quiet # be quiet
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printf "not a choice\n"
|
geom=$(xrandr \
|
||||||
exit 1
|
| grep "$display" \
|
||||||
|
| awk -F ' ' '{print $3 " " $4}' \
|
||||||
|
| sed 's/primary //g' \
|
||||||
|
| awk -F ' ' '{print $1}' \
|
||||||
|
| grep '[[:digit:]]'
|
||||||
|
)
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# what to do with the capture?
|
printf "[] selected geometry is %s\n" "$geom"
|
||||||
printf "> written to %s\n" "$output"
|
|
||||||
while true; do
|
medium=$(
|
||||||
result=$(printf "delete\nmove to home directory\nupload to pastebin\nreview footage\nquit\n" | fzy --prompt="what next? ")
|
printf ".mp4\n.png\n" | fzy
|
||||||
case "$result" in
|
)
|
||||||
*upload*)
|
|
||||||
paste "$output" | xclip -i
|
printf "[] capturing in medium %s\n" "$medium"
|
||||||
printf "> pasted! check your clipboard\n"
|
|
||||||
|
case "$medium" in
|
||||||
|
*"mp4"*)
|
||||||
|
ffcast -g $geom rec
|
||||||
;;
|
;;
|
||||||
*review*)
|
*"png"*)
|
||||||
[ "$medium" = ".mp4" ] && mpv "$output" && continue
|
ffcast -g $geom png
|
||||||
feh "$output"
|
|
||||||
;;
|
|
||||||
*delete*)
|
|
||||||
printf "> removing target file...\n"
|
|
||||||
rm "$output"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
*home*)
|
|
||||||
printf "> warping your capture to home...\n"
|
|
||||||
name=$(echo "capture$medium" | fzy --prompt="name please? ")
|
|
||||||
mv "$output" "$HOME/$name"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
*quit*)
|
|
||||||
exit 1
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
|
||||||
|
|
Loading…
Reference in New Issue