wmstartup: Add xob logic

This commit is contained in:
Salt 2018-08-21 22:59:37 -05:00
parent 5719840326
commit 26d8ea7043

View File

@ -129,6 +129,35 @@ fi
# XOB
if which xob > /dev/null 2>&1; then
printf " [INFO] Starting xob instances\n"
pipes="XOB_PIPE_BRIGHTNESS XOB_PIPE_VOLUME XOB_PIPE_MISC"
# Clean up earlier temp folders
for file in /tmp/$USER-xob-*; do
printf " [INFO] Found old xob directory \"$file\"\n"
for pipe in $pipes; do
if [ -p "$file/$pipe" ]; then
printf " [INFO] Contained old pipe \"$pipe\". Removing\n"
rm "$file/$pipe"
fi
done
rmdir "$file" && printf " [INFO] Successfully cleaned up\n" || printf " [WARN] Failed to clean up\n"
done
# Set up new pipes
export XOB_PIPE_DIR="/tmp/$USER-xob-$(date +%s)-$(uuidgen)"
printf " [INFO] Using pipe directory \"$XOB_PIPE_DIR\"\n"
mkdir -m 700 "$XOB_PIPE_DIR"
for pipe in $pipes; do
if [ -p "$XOB_PIPE_DIR/$pipe" ]; then
printf " [INFO] Removing existing pipe \"$pipe\"\n"
rm "$XOB_PIPE_DIR/$pipe"
fi
mkfifo "$XOB_PIPE_DIR/$pipe"
if [ -p "$XOB_PIPE_DIR/$pipe" ]; then
printf " [INFO] Successfully created pipe \"$pipe\". Binding an xob instance to it\n"
tail -f "$XOB_PIPE_DIR/$pipe" | xob -s "$pipe" &
else
printf " [WARN] Failed to create pipe \"$pipe\"\n"
fi
done
else
printf " [INFO] Could not find a bar overlay application\n"
fi