aboutsummaryrefslogtreecommitdiffstats
path: root/modules/media/screen-recording/screen-recording.sh
diff options
context:
space:
mode:
Diffstat (limited to 'modules/media/screen-recording/screen-recording.sh')
-rw-r--r--modules/media/screen-recording/screen-recording.sh49
1 files changed, 26 insertions, 23 deletions
diff --git a/modules/media/screen-recording/screen-recording.sh b/modules/media/screen-recording/screen-recording.sh
index 90cbc85..1afa239 100644
--- a/modules/media/screen-recording/screen-recording.sh
+++ b/modules/media/screen-recording/screen-recording.sh
@@ -5,36 +5,39 @@
OUT_DIR="$HOME/Videos/Recordings"
mkdir -p "$OUT_DIR"
-info() { printf '\033[1;34m==>\033[0m %s\n' "$*"; }
-warn() { printf '\033[1;33m==> warning:\033[0m %s\n' "$*" >&2; }
+info() { printf '\033[1;34m==>\033[0m %s\n' "$*"; }
+warn() { printf '\033[1;33m==> warning:\033[0m %s\n' "$*" >&2; }
error() { printf '\033[1;31m==> error:\033[0m %s\n' "$*" >&2; }
-die() { error "$*"; exit 1; }
+die() {
+ error "$*"
+ exit 1
+}
# Argument parsing
SELECT_MODE=false
-while [[ "$#" -gt 0 ]]; do
- case $1 in
- -s|--select) SELECT_MODE=true ;;
- esac
- shift
+while [[ $# -gt 0 ]]; do
+ case $1 in
+ -s | --select) SELECT_MODE=true ;;
+ esac
+ shift
done
# Geometry selection
GEOMETRY=""
if [ "$SELECT_MODE" = true ]; then
- if command -v slurp >/dev/null 2>&1; then
- info "Select a window or draw a box..."
- GEOMETRY=$(slurp)
-
- if [ -z "$GEOMETRY" ]; then
- info "Selection cancelled. Exiting."
- exit 1
- fi
- else
- warn "slurp not found. Recording full screen..."
- sleep 1
- fi
+ if command -v slurp >/dev/null 2>&1; then
+ info "Select a window or draw a box..."
+ GEOMETRY=$(slurp)
+
+ if [ -z "$GEOMETRY" ]; then
+ info "Selection cancelled. Exiting."
+ exit 1
+ fi
+ else
+ warn "slurp not found. Recording full screen..."
+ sleep 1
+ fi
fi
# Start recording
@@ -45,9 +48,9 @@ echo " Press 'q' in this terminal to stop."
echo " File: $FILENAME"
if [ -n "$GEOMETRY" ]; then
- wf-recorder -g "$GEOMETRY" -f "$FILENAME"
+ wf-recorder -g "$GEOMETRY" -f "$FILENAME"
else
- wf-recorder -f "$FILENAME"
+ wf-recorder -f "$FILENAME"
fi
-info "Done! Video saved to $FILENAME" \ No newline at end of file
+info "Done! Video saved to $FILENAME"