Sway : Refactor screenshot a bit.
This commit is contained in:
parent
f95ac78125
commit
ec5e4c450b
|
@ -36,7 +36,7 @@ in {
|
||||||
scrSelection=$(${selection})
|
scrSelection=$(${selection})
|
||||||
[[ -n "''${scrSelection}" ]] || exit
|
[[ -n "''${scrSelection}" ]] || exit
|
||||||
|
|
||||||
scrRecFile="''${XDG_VIDEOS_DIR[0]}/$(date +${format}).${container}"
|
scrFile="''${XDG_VIDEOS_DIR[0]}/$(date +${format}).${container}"
|
||||||
|
|
||||||
scrTransform="$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .transform')"
|
scrTransform="$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .transform')"
|
||||||
[[ "''${scrTransform}" = "normal" ]] && scrTransform=""
|
[[ "''${scrTransform}" = "normal" ]] && scrTransform=""
|
||||||
|
@ -44,51 +44,51 @@ in {
|
||||||
wf-recorder \
|
wf-recorder \
|
||||||
--geometry "''${scrSelection}" \
|
--geometry "''${scrSelection}" \
|
||||||
--codec ${codec} \
|
--codec ${codec} \
|
||||||
--file "''${scrRecFile}" \
|
--file "''${scrFile}" \
|
||||||
--framerate ${toString framerate} \
|
--framerate ${toString framerate} \
|
||||||
--pixel-format ${pixfmt} \
|
--pixel-format ${pixfmt} \
|
||||||
&& ffmpeg \
|
&& ffmpeg \
|
||||||
-f lavfi \
|
-f lavfi \
|
||||||
-i anullsrc=channel_layout=stereo:sample_rate=44100 \
|
-i anullsrc=channel_layout=stereo:sample_rate=44100 \
|
||||||
-i "''${scrRecFile}" \
|
-i "''${scrFile}" \
|
||||||
-c:v copy \
|
-c:v copy \
|
||||||
-c:a libopus \
|
-c:a libopus \
|
||||||
-shortest \
|
-shortest \
|
||||||
-f ${container} "''${scrRecFile}_" \
|
-f ${container} "''${scrFile}_" \
|
||||||
&& mv "''${scrRecFile}_" "''${scrRecFile}" \
|
&& mv "''${scrFile}_" "''${scrFile}" \
|
||||||
&& [[ -n "''${scrTransform}" ]] \
|
&& [[ -n "''${scrTransform}" ]] \
|
||||||
&& ffmpeg -display_rotation ''${scrTransform} -i ''${scrRecFile} -c copy -f ${container} ''${scrRecFile}_ \
|
&& ffmpeg -display_rotation ''${scrTransform} -i ''${scrFile} -c copy -f ${container} ''${scrFile}_ \
|
||||||
&& mv ''${scrRecFile}_ ''${scrRecFile} \
|
&& mv ''${scrFile}_ ''${scrFile} \
|
||||||
|| rm ''${scrRecFile}_
|
|| rm ''${scrFile}_
|
||||||
};
|
};
|
||||||
'';
|
'';
|
||||||
|
|
||||||
fullrec = pkgs.writeShellScriptBin "FullscreenRecording" ''
|
fullrec = pkgs.writeShellScriptBin "FullscreenRecording" ''
|
||||||
pkill -SIGINT wf-recorder \
|
pkill -SIGINT wf-recorder \
|
||||||
|| {
|
|| {
|
||||||
scrRecFile="''${XDG_VIDEOS_DIR[0]}/$(date +${format}).${container}"
|
scrFile="''${XDG_VIDEOS_DIR[0]}/$(date +${format}).${container}"
|
||||||
scrTransform="$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .transform')"
|
scrTransform="$(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .transform')"
|
||||||
[[ "''${scrTransform}" = "normal" ]] && scrTransform=""
|
[[ "''${scrTransform}" = "normal" ]] && scrTransform=""
|
||||||
|
|
||||||
wf-recorder \
|
wf-recorder \
|
||||||
-o $(swaymsg -t get_outputs | jq -r ".[] | select(.focused) | .name") - \
|
-o $(swaymsg -t get_outputs | jq -r ".[] | select(.focused) | .name") - \
|
||||||
--codec ${codec} \
|
--codec ${codec} \
|
||||||
--file "''${scrRecFile}" \
|
--file "''${scrFile}" \
|
||||||
--framerate ${toString framerate} \
|
--framerate ${toString framerate} \
|
||||||
--pixel-format ${pixfmt} \
|
--pixel-format ${pixfmt} \
|
||||||
&& ffmpeg \
|
&& ffmpeg \
|
||||||
-f lavfi \
|
-f lavfi \
|
||||||
-i anullsrc=channel_layout=stereo:sample_rate=44100 \
|
-i anullsrc=channel_layout=stereo:sample_rate=44100 \
|
||||||
-i "''${scrRecFile}" \
|
-i "''${scrFile}" \
|
||||||
-c:v copy \
|
-c:v copy \
|
||||||
-c:a libopus \
|
-c:a libopus \
|
||||||
-shortest \
|
-shortest \
|
||||||
-f ${container} "''${scrRecFile}_" \
|
-f ${container} "''${scrFile}_" \
|
||||||
&& mv "''${scrRecFile}_" "''${scrRecFile}" \
|
&& mv "''${scrFile}_" "''${scrFile}" \
|
||||||
&& [[ -n "''${scrTransform}" ]] \
|
&& [[ -n "''${scrTransform}" ]] \
|
||||||
&& ffmpeg -display_rotation ''${scrTransform} -i ''${scrRecFile} -c copy -f ${container} ''${scrRecFile}_ \
|
&& ffmpeg -display_rotation ''${scrTransform} -i ''${scrFile} -c copy -f ${container} ''${scrFile}_ \
|
||||||
&& mv ''${scrRecFile}_ ''${scrRecFile} \
|
&& mv ''${scrFile}_ ''${scrFile} \
|
||||||
|| rm ''${scrRecFile}_
|
|| rm ''${scrFile}_
|
||||||
};
|
};
|
||||||
'';
|
'';
|
||||||
in ''
|
in ''
|
||||||
|
|
Loading…
Reference in a new issue