Fix: Allow vertical monitors to be recorded properly instead of erroring. (#861)
This commit is contained in:
@@ -68,19 +68,37 @@ startRecording() {
|
|||||||
w=$(echo "$monitor_info" | jq -r '.width')
|
w=$(echo "$monitor_info" | jq -r '.width')
|
||||||
h=$(echo "$monitor_info" | jq -r '.height')
|
h=$(echo "$monitor_info" | jq -r '.height')
|
||||||
scale=$(echo "$monitor_info" | jq -r '.scale')
|
scale=$(echo "$monitor_info" | jq -r '.scale')
|
||||||
scaled_width=$(awk "BEGIN { print $w / $scale }")
|
|
||||||
scaled_height=$(awk "BEGIN { print $h / $scale }")
|
|
||||||
x=$(echo "$monitor_info" | jq -r '.x')
|
x=$(echo "$monitor_info" | jq -r '.x')
|
||||||
y=$(echo "$monitor_info" | jq -r '.y')
|
y=$(echo "$monitor_info" | jq -r '.y')
|
||||||
|
|
||||||
wf-recorder $WF_RECORDER_OPTS --geometry "${x},${y} ${scaled_width}x${scaled_height}" --file "$outputPath" &
|
transform=$(echo "$monitor_info" | jq -r '.transform')
|
||||||
|
rotation_filter=""
|
||||||
|
|
||||||
|
if [ "$transform" -eq 1 ] || [ "$transform" -eq 3 ]; then
|
||||||
|
scaled_width=$(awk "BEGIN { print $h / $scale }")
|
||||||
|
scaled_height=$(awk "BEGIN { print $w / $scale }")
|
||||||
|
else
|
||||||
|
scaled_width=$(awk "BEGIN { print $w / $scale }")
|
||||||
|
scaled_height=$(awk "BEGIN { print $h / $scale }")
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$transform" in
|
||||||
|
1)
|
||||||
|
rotation_filter="-F transpose=1"
|
||||||
|
;;
|
||||||
|
3)
|
||||||
|
rotation_filter="-F transpose=2"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
wf-recorder $WF_RECORDER_OPTS $rotation_filter --geometry "${x},${y} ${scaled_width}x${scaled_height}" --file "$outputPath" &
|
||||||
elif [ "$target" == "region" ]; then
|
elif [ "$target" == "region" ]; then
|
||||||
wf-recorder $WF_RECORDER_OPTS --geometry "$(slurp)" --file "$outputPath" &
|
wf-recorder $WF_RECORDER_OPTS --geometry "$(slurp)" --file "$outputPath" &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
disown "$(jobs -p | tail -n 1)"
|
disown "$(jobs -p | tail -n 1)"
|
||||||
echo "Recording started. Saving to $outputPath"
|
echo "Recording started. Saving to $outputPath"
|
||||||
echo "$outputPath" > /tmp/last_recording_path
|
echo "$outputPath" >/tmp/last_recording_path
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to stop screen recording
|
# Function to stop screen recording
|
||||||
@@ -113,20 +131,20 @@ stopRecording() {
|
|||||||
|
|
||||||
# Handle script arguments
|
# Handle script arguments
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
startRecording "$@"
|
startRecording "$@"
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
stopRecording
|
stopRecording
|
||||||
;;
|
;;
|
||||||
status)
|
status)
|
||||||
if checkRecording; then
|
if checkRecording; then
|
||||||
echo "recording"
|
echo "recording"
|
||||||
else
|
else
|
||||||
echo "not recording"
|
echo "not recording"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Usage: $0 {start [screen <monitor_name> | region] <output_directory> | stop | status}"
|
echo "Usage: $0 {start [screen <monitor_name> | region] <output_directory> | stop | status}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
|
|||||||
3
src/lib/types/options.d.ts
vendored
3
src/lib/types/options.d.ts
vendored
@@ -3,6 +3,7 @@ import { Variable } from 'types/variable';
|
|||||||
import { defaultColorMap } from './defaults/options';
|
import { defaultColorMap } from './defaults/options';
|
||||||
import { Astal } from 'astal/gtk3';
|
import { Astal } from 'astal/gtk3';
|
||||||
import { dropdownMenuList } from '../constants/options';
|
import { dropdownMenuList } from '../constants/options';
|
||||||
|
import { FontStyle } from 'src/components/settings/shared/inputs/font/utils';
|
||||||
|
|
||||||
export type MkOptionsResult = {
|
export type MkOptionsResult = {
|
||||||
array: () => Opt[];
|
array: () => Opt[];
|
||||||
@@ -104,7 +105,7 @@ export interface RowProps<T> {
|
|||||||
subtitleLink?: string;
|
subtitleLink?: string;
|
||||||
dependencies?: string[];
|
dependencies?: string[];
|
||||||
increment?: number;
|
increment?: number;
|
||||||
fontStyle?: Opt<string>;
|
fontStyle?: Opt<FontStyle>;
|
||||||
fontLabel?: Opt<string>;
|
fontLabel?: Opt<string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user