snips/dwl.entourage

72 lines
2.6 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env bash
2021-05-29 22:40:00 +00:00
echo "Entourage: $XDG_RUNTIME_DIR - $DWL_TAGS_FILE" >> $DWL_LOG_FILE
2021-06-14 01:19:49 +00:00
NUM_DISPS=$(wlr-randr | egrep "^\w+" | wc -l)
echo "Entourage: Configuring ${NUM_DISPS} displays" >> $DWL_LOG_FILE
2021-06-01 05:23:35 +00:00
2021-06-14 01:19:49 +00:00
if [[ $NUM_DISPS > 1 ]]; then
# Dual screen
wlr-randr --output HDMI-A-1 --on --pos 0,0 --output eDP-1 --on --pos 0,1050
else
# Single laptop screen
wlr-randr --output HDMI-A-1 --off --output eDP-1 --on --pos 0,0
fi
2021-06-01 05:23:35 +00:00
2021-05-29 22:40:00 +00:00
# ----------------------------------------------------------
# Let DWL start
2021-05-29 22:40:00 +00:00
# ----------------------------------------------------------
while [ ! -e "$XDG_RUNTIME_DIR/wayland-0.lock" ]
do
2021-05-29 22:40:00 +00:00
echo "DWL getting ready..." >> $DWL_LOG_FILE
sleep 1
done
2021-05-29 22:40:00 +00:00
echo "DWL ready!" >> $DWL_LOG_FILE
echo "Entourage: " $DWL_TAGS_FILE >> $DWL_LOG_FILE
2022-02-13 00:09:24 +00:00
if [ -e /usr/local/bin/somebar ]; then
/usr/local/bin/somebar &
(sleep 2 && conky -c ~/.conkyrc > $XDG_RUNTIME_DIR/somebar-0) &
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
2021-05-29 22:40:00 +00:00
# ----------------------------------------------------------
# Background
2021-05-29 22:40:00 +00:00
# ----------------------------------------------------------
swaybg --mode fill --image ~/.config/wallpaper.jpg &
# ----------------------------------------------------------
# Lock when idle
# ----------------------------------------------------------
swayidle -w timeout 600 swaylock &
2021-05-29 22:40:00 +00:00
# ----------------------------------------------------------
# Redirect STDIN to STDOUT and pass along to tags script
2021-05-29 22:40:00 +00:00
# ----------------------------------------------------------
(while read line
do
echo $line
2021-05-29 22:40:00 +00:00
done) | dwltags.pl --file $DWL_TAGS_FILE