speedwm-personal/modules/module_dfmpeg

57 lines
1.2 KiB
Plaintext
Raw Normal View History

2022-10-08 13:17:32 +02:00
#!/bin/sh
# dfmpeg module for status/stellar
# values
DFMPEG_CMD="speedwm-dfmpeg -s"
DFMPEG_REC_PATH="$(cat /tmp/outputfilename)"
ICON="$1"
BUTTON="$(cat /tmp/speedwm-button)"
case "$TERMINAL" in
"") TERMINAL=st
esac
case "$BUTTON" in
"3") speedwm-dfmpeg ; exit ;;
2022-10-08 13:18:10 +02:00
"2") $DFMPEG_CMD ; exit ;;
2022-10-08 13:17:32 +02:00
esac
# check if recording audio
if [ -e "/tmp/isaudio" ]; then
DFMPEG_AUDIO="Recording audio"
else
DFMPEG_AUDIO="Not recording audio"
fi
# check if encoding
if [ -e "/tmp/isencoding" ]; then
if [ -e "/tmp/encoding-codec" ]; then
DFMPEG_ENCODING="Encoding with $(cat /tmp/encoding-codec)"
else
DFMPEG_ENCODING="Encoding"
fi
else
DFMPEG_ENCODING="Not encoding"
fi
# no spacing if there's no icon
if [ "$ICON" != "" ]; then
ICONSPACING=" " # one character spacing
fi
# send the notification
SEND_NOTIF() {
FULL_RECSTATUS="$(printf "${ICON}${ICONSPACING}Recording video $DFMPEG_REC_PATH\n${DFMPEG_AUDIO}, ${DFMPEG_ENCODING}\nMiddle click to stop recording.")"
notify-send "$FULL_RECSTATUS"
echo "Notification sent successfully!"
echo "INFO: $FULL_RECSTATUS"
exit 0
}
command -v notify-send > /dev/null && SEND_NOTIF
echo "FATAL: libnotify not installed, can't send notification."
exit 1