From d2e6e6b5de1d56d53aee2da81c2e9ee553971c72 Mon Sep 17 00:00:00 2001 From: arpitchakladar Date: Wed, 9 Sep 2026 23:29:20 +0530 Subject: refactor(modules): consistent message formats across all scripts --- modules/media/screen-recording/screen-recording.sh | 24 ++++++++++------------ 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'modules/media/screen-recording') diff --git a/modules/media/screen-recording/screen-recording.sh b/modules/media/screen-recording/screen-recording.sh index 336c32e..f4e65ab 100644 --- a/modules/media/screen-recording/screen-recording.sh +++ b/modules/media/screen-recording/screen-recording.sh @@ -2,11 +2,10 @@ OUT_DIR="$HOME/Videos/Recordings" mkdir -p "$OUT_DIR" -# Colors -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -RED='\033[0;31m' -NC='\033[0m' +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; } # Argument parsing SELECT_MODE=false @@ -22,15 +21,15 @@ GEOMETRY="" if [ "$SELECT_MODE" = true ]; then if command -v slurp >/dev/null 2>&1; then - echo -e "${YELLOW}Select a window or draw a box...${NC}" + info "Select a window or draw a box..." GEOMETRY=$(slurp) if [ -z "$GEOMETRY" ]; then - echo "Selection cancelled. Exiting." + info "Selection cancelled. Exiting." exit 1 fi else - echo -e "${RED}Error: 'slurp' not found.${NC} Recording full screen..." + warn "slurp not found. Recording full screen..." sleep 1 fi fi @@ -38,10 +37,9 @@ fi # Start recording FILENAME="$OUT_DIR/recording-$(date +%Y%m%d-%H%M%S).mp4" -echo -e "${GREEN}Recording started!${NC}" -echo -e "Press ${YELLOW}'q'${NC} in this terminal to stop." -echo "File: $FILENAME" -echo "------------------------------------------------" +info "Recording started!" +echo " Press 'q' in this terminal to stop." +echo " File: $FILENAME" if [ -n "$GEOMETRY" ]; then wf-recorder -g "$GEOMETRY" -f "$FILENAME" @@ -49,4 +47,4 @@ else wf-recorder -f "$FILENAME" fi -echo -e "\n${GREEN}Done!${NC} Video saved to $FILENAME" +info "Done! Video saved to $FILENAME" \ No newline at end of file -- cgit v1.2.3