Support for updated somebar

Better logging
This commit is contained in:
Mahesh Asolkar 2023-12-25 11:30:33 -08:00
parent ccf2897cb8
commit c9e3e7ae53

View File

@ -1,9 +1,14 @@
#!/usr/bin/env bash
echo "Entourage: $XDG_RUNTIME_DIR - $DWL_TAGS_FILE" >> $DWL_LOG_FILE
function log_this() {
TSTMP=$(date)
echo "$TSTMP : " $1 >> $DWL_LOG_FILE
}
NUM_DISPS=$(wlr-randr | egrep "^\w+" | wc -l)
echo "Entourage: Configuring ${NUM_DISPS} displays" >> $DWL_LOG_FILE
log_this "Entourage: $XDG_RUNTIME_DIR - $DWL_TAGS_FILE"
NUM_DISPS=$(wlr-randr | grep -E "^\w+" | wc -l)
log_this "Entourage: Configuring ${NUM_DISPS} displays"
if [[ $NUM_DISPS > 1 ]]; then
# Dual screen
@ -21,39 +26,11 @@ fi
# ----------------------------------------------------------
while [ ! -e "$XDG_RUNTIME_DIR/wayland-0.lock" ]
do
echo "DWL getting ready..." >> $DWL_LOG_FILE
log_this "DWL getting ready..."
sleep 1
done
echo "DWL ready!" >> $DWL_LOG_FILE
echo "Entourage: " $DWL_TAGS_FILE >> $DWL_LOG_FILE
if [ -e /usr/local/bin/somebar ]; then
dbus-run-session /usr/local/bin/somebar > $XDG_RUNTIME_DIR/somebar.log &
(sleep 2 && conky -c ~/.conkyrc > $XDG_RUNTIME_DIR/somebar-0) &
echo "Entourage: Started somebar " >> $DWL_LOG_FILE
else
DISPLAYS=$(wlr-randr | perl -ne 'print "$1 " if /^([\w-]+)/')
DISP_NUM=$(expr 0)
for DISP in $DISPLAYS; do
DISP_NUM=$(expr $DISP_NUM + 1)
TF=${DWL_TAGS_FILE}.${DISP}
# ----------------------------------------------------------
# Top bar for displaying DWL tags
# ----------------------------------------------------------
# Dependency - needs inotify-tools package
echo "Entourage: Monitor - ${DISP_NUM} ${DISP}, new tags file " ${TF} >> $DWL_LOG_FILE
touch ${TF}
inotifywait -q -m -e close_write ${TF} |
(cat ${TF} ;
while read -r filename event; do
cat ${TF}
done) | dtao -z -z -xs ${DISP_NUM} -ta l -tw 100 -expand r -h 22 -fn 'Iosevka:style=Regular:size=12' &
# ----------------------------------------------------------
# Bottom bar for displaying context information
# ----------------------------------------------------------
(conky -c ~/.conkyrc) | dtao -xs ${DISP_NUM} -ta r -tw 100 -expand l -h 22 -fn 'Iosevka:style=Regular:size=12' &
done
fi
log_this "DWL ready!"
log_this "Entourage: $DWL_TAGS_FILE"
# ----------------------------------------------------------
# Background
@ -64,13 +41,22 @@ fi
# ----------------------------------------------------------
# Lock when idle
# ----------------------------------------------------------
log_this "Entourage: Starting screen locker with 10min idle time"
swayidle -w timeout 600 swaylock &
# ----------------------------------------------------------
# Redirect STDIN to STDOUT and pass along to tags script
# ----------------------------------------------------------
BAR_PATH=/usr/local/bin/somebar
# BAR_PATH=/home/mahesh/git/somebar_20231001/build/somebar
export SOMEBAR_FIFO=$XDG_RUNTIME_DIR/somebar.fifo
mkfifo $SOMEBAR_FIFO -m666
log_this "Entourage: Starting somebar using $SOMEBAR_FIFO"
conky -c ~/.conkyrc > $SOMEBAR_FIFO &
(while read line
do
echo $line
done) | dwltags.pl --file $DWL_TAGS_FILE
done) | ($BAR_PATH -s $SOMEBAR_FIFO > $XDG_RUNTIME_DIR/somebar.log 2>&1)