aboutsummaryrefslogtreecommitdiffstats
path: root/modules/media
diff options
context:
space:
mode:
authorarpitchakladar <arpitchakladar@gmail.com>2026-09-09 23:29:20 +0530
committerarpitchakladar <arpitchakladar@gmail.com>2026-09-09 23:29:20 +0530
commitd2e6e6b5de1d56d53aee2da81c2e9ee553971c72 (patch)
treefeee7479f6b4574696cc6d780f55ce044cafa3bc /modules/media
parent7879122dfc8e7ca7b905e10d5f55df09f9051295 (diff)
downloadhome-manager-config-d2e6e6b5de1d56d53aee2da81c2e9ee553971c72.tar.gz
home-manager-config-d2e6e6b5de1d56d53aee2da81c2e9ee553971c72.zip
refactor(modules): consistent message formats across all scripts
Diffstat (limited to 'modules/media')
-rw-r--r--modules/media/screen-recording/screen-recording.sh24
1 files changed, 11 insertions, 13 deletions
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