How to fiddle with JWM tray height and width
This blog post is prompted by a forum post by BologneChe, who set the tray width to full width of screen, by editing the "width" attribute in the "Tray" tag, but found that sometimes had to reset it:
https://forum.puppylinux.com/viewtopic.php?p=54308#p54308
In ROX-mode icons-on-desktop, the JWM tray is set at a height of 30 pixels and full width of the screen.
In JWM-mode icon-free-desktop, the JWM tray height and width are determined by file /usr/local/ui/jwm/tray_dims:
#in jwm desktop mode (all icons in tray), want to automatically set tray width
# and height for different monitor resolutions.
#each entry here is screen-width:tray-height:tray-width
#tray-width=0 means tray is full width of screen.
JWM_TRAY_DIM_PROFILES="1024:31:0
1366:32:1056
1600:34:1136
1920:36:1172
2560:38:1224
9999:38:1224"
For icon-free-desktop, JWM determines its tray height and width
from this file. The script /root/.xinitrc reads this file, and
looks at each entry in JWM_TRAY_DIM_PROFILES successively.
That is, if screen width is less than or equal to 1024 pixels, tray height is set to 31 and width to 0 -- where 0 means full width of screen. If no match, looks at next line and asks the same question, and so on.
So, if you have, say, a 1920x1080 screen, and you want the tray to be wider, just change that "1172" to whatever you want, or "0" if want full screen width.
If you look at /root/.xinitrc, you will see that
JWM_TRAY_DIM_PROFILES only gets applied under certain conditions:
at very first bootup, when there is a change of screen resolution,
or the SFS layers have changed.
For anyone interested in shell code, here is the relevant section in /root/.xinitrc:
if [ "$SCRN_X" != "$oldSCRNX" -o -e /tmp/sfschg.flg.persist ];then #20220321
##may need to display app icons without labels...
#/usr/local/ui/jwm/jwmrc-insert-icons
#20220321 adjust tray width and height to suit screen...
# each entry here is screen-width:tray-height:tray-width
. /usr/local/ui/jwm/tray_dims #has JWM_TRAY_DIM_PROFILES
aH=31; aW=0
for aPROF in $JWM_TRAY_DIM_PROFILES
do
if [ $SCRN_X -le ${aPROF/:*/} ];then
aW=${aPROF/*:/} #ex: 1136
aH=${aPROF:5:2} #ex: 34
break
fi
done
PTNw="/<Tray /s/width=\"[^\"]*/width=\"${aW}/"
sed -i -e "$PTNw" /root/.jwmrc-tray
PTNh="/<Tray /s/height=\"[^\"]*/height=\"${aH}/"
sed -i -e "$PTNh" /root/.jwmrc-tray
fi
Automatic setting of JWM tray width and height is still a
work-in-progress, so the above details may
change.
Tags: easy