site  contact  subhomenews

Automatic gap between drive icons and tray

April 13, 2022 — BarryK

I posted about the gap between the drive partition icons and the JWM systray recently:

https://bkhome.org/news/202203/increased-gap-between-drive-icons-and-tray.html

I suggested that this could be automatic, instead of a hard-coded offset. I have now implemented that. File /etc/eventmanager now has this:

#091208 adjust drive icons placement, read by /sbin/pup_event_frontend_d
#TODO: GUI in /usr/sbin/eventmanager
#gap between icons and edge of screen (>0 if need to leave space for a tray)...
#20220327 bump from 64 to 68, as tray height got bumped from 28 to 30...
#20220412 now support 'auto[+/-offset]', ex: 'auto+2' just above tray plus extra 2 pixels...
# note, currently only place that reads this is /usr/local/pup_event/frontend_funcs
ICON_PLACE_EDGE_GAP='auto+2'

This variable is read in /usr/local/pup_event/frontend_funcs, and I have inserted this into the "free_coord" function:

 #20220412 handle ICON_PLACE_EDGE_GAP=auto[+/-offset] ...
if [ "${ICON_PLACE_EDGE_GAP:0:1}" == "a" ];then
GAP_OFFSET=${ICON_PLACE_EDGE_GAP/auto/}
GAP_TRAY0="$(grep '<Tray ' /root/.jwmrc-tray | grep -o 'height="[^"]*')"
GAP_TRAY="${GAP_TRAY0/height=\"/}"
if [ ! "$GAP_TRAY" ];then
GAP_TRAY='34'
fi
ICON_PLACE_EDGE_GAP=$((${GAP_TRAY}+38${GAP_OFFSET}))
fi

Great!   

Tags: easy