67 lines
1.4 KiB
Bash
Executable file
67 lines
1.4 KiB
Bash
Executable file
#!/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)"
|
|
|
|
# load status config
|
|
if [ -e "$HOME/.config/speedwm-de/status/config" ]; then
|
|
. $HOME/.config/speedwm-de/status/config
|
|
if [ "$1" = "" ]; then
|
|
ICON="$ITEM7_ICON"
|
|
fi
|
|
fi
|
|
|
|
pgrep -x ffmpeg || exit 1
|
|
|
|
case "$TERMINAL" in
|
|
"") TERMINAL=st
|
|
esac
|
|
|
|
case "$BUTTON" in
|
|
"3") speedwm-dfmpeg ; exit ;;
|
|
"2") $DFMPEG_CMD ; exit ;;
|
|
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
|