site  contact  subhomenews

Changes needed to fix JWMDesk

February 13, 2022 — BarryK

I mentioned that Roger's (radky in the forum) JWMDesk PET is not in EasyOS 3.4 due to incompatibility with the format of /root/.jwmrc-tray and /root/.jwm/jwmrc-personal.

I have tidied up /root/.jwmrc-tray a little bit more, and this is what I propose it will be ongoing:

<JWM>
<Tray autohide="off" insert="right" x="0" y="-1" height="26" width="1024" halign="center">

<!-- the main app menu. root:3 means mouse right-click -->
<TrayButton popup="Menu" icon="apps24.png">root:3</TrayButton>

<!-- TrayButton tags for extra menus -->
<!--STARTMENU-->
<!--ENDMENU-->

<Pager/>

<!-- TrayButton tags for apps -->
<!--STARTICONS-->
<!--ENDICONS-->

<TaskList labeled="false"/>

<Dock/>

<Swallow name="xload" width="32">
xload -nolabel -bg "#888888" -fg red -hl white
</Swallow>

<Clock format="%H:%M">exec:minixcal</Clock>

<!-- TrayButton tags for apps at right side of tray -->
<!--STARTEXTRA-->
<!--ENDEXTRA-->

</Tray>
</JWM>

EasyOS has scripts in /usr/local/ui/jwm to manipulate the content. For example, /usr/local/ui/jwm/jwmrc-insert-icons inserts icons to launch apps:

#!/bin/sh

LABEL='popup'
sed -n '/^<JWM>$/,/<!--STARTICONS-->/p' /root/.jwmrc-tray > /tmp/tmp-jwmrc-tray-top.txt
sed -n '/<!--ENDICONS-->/,/^<\/JWM>$/p' /root/.jwmrc-tray > /tmp/tmp-jwmrc-tray-bottom.txt

echo " <TrayButton ${LABEL}=\"files\" icon=\"folder24.png\">exec:/usr/local/bin/rox --dir=/files</TrayButton>
<TrayButton ${LABEL}=\"www\" icon=\"www24.png\">exec:defaultbrowser</TrayButton>
<TrayButton ${LABEL}=\"apps\" icon=\"apps24.png\">exec:pupapps</TrayButton>
<TrayButton ${LABEL}=\"pkgget\" icon=\"pet24.png\">exec:dotpup</TrayButton>
<TrayButton ${LABEL}=\"sfsget\" icon=\"pet24.png\">exec:sfsget</TrayButton>
<TrayButton ${LABEL}=\"setup\" icon=\"configuration24.png\">exec:wizardwizard</TrayButton>
<TrayButton ${LABEL}=\"edit\" icon=\"edit24.png\">exec:defaulttexteditor</TrayButton>
<TrayButton ${LABEL}=\"console\" icon=\"console24.png\">exec:defaultterminal</TrayButton>
<TrayButton ${LABEL}=\"connect\" icon=\"connect24.png\">exec:/usr/local/apps/Connect</TrayButton>
<TrayButton ${LABEL}=\"share\" icon=\"network24.png\">exec:/usr/local/EasyShare/easyshare</TrayButton>
<TrayButton ${LABEL}=\"update\" icon=\"update24.png\">exec:easy-update</TrayButton>" > /tmp/tmp-jwmrc-middle.txt

cat /tmp/tmp-jwmrc-tray-top.txt > /tmp/tmp-jwmrc-tray.txt
cat /tmp/tmp-jwmrc-middle.txt >> /tmp/tmp-jwmrc-tray.txt
cat /tmp/tmp-jwmrc-tray-bottom.txt >> /tmp/tmp-jwmrc-tray.txt

cp -f /tmp/tmp-jwmrc-tray.txt /root/.jwmrc-tray
###end###

...those sed commands will extract multiple lines from a file, between a start-pattern and an end-pattern -- most useful. A bit inefficient, too many 'cat' operations, anyway it works.

So, if JWMDesk wants to insert anything between those markers, the above script shows how.

The other script that will probably upset JWMDesk is /root/.jwm/jwmrc-personal, which has this change to the Desktops tag:

<!-- Number of virtual desktops. 20220208 added image -->
<Desktops width="2" height="1">
<Background type="image">/usr/share/backgrounds/default.jpg</Background>
</Desktops>

...I am being inconsistent, haven't indented with tabs.

The Background tag is for JWM to render the wallpaper, instead of ROX-Filer. Note, there is a global variable in /etc/uimanager that scripts read to determine whether ROX-Filer is managing the desktop, or JWM.
In the case of wallpaper, the GUI is Qwallpaper, but the background script that does the actual setting of wallpaper is /usr/sbin/set_bg and that reads /etc/uimanager and will set the wallpaper in /root/.jwm/jwmrc-personal or in PuppyPin as appropriate.

JWMDesk will probably not want to touch what is between the STARTMENU and ENDMENU markers. That is used for EasyOS running in icon-free desktop mode. Unless JWMDesk wants to get more ambitious and control switching between icon-free-desktop and icons-on-desktop.

Here is /root/.jwmrc-tray in Easy 3.4:

<JWM>
<Tray autohide="off" insert="right" x="0" y="-1" height="26" width="1024" halign="center">

<!-- Additional TrayButton attribute: label -->
<TrayButton popup="Menu" icon="apps24.png">root:3</TrayButton>

<!--STARTMENU-->
<TrayButton popup="Drives" icon="drives24.png">root:2</TrayButton>
<TrayButton popup="Containers" icon="container24.png">root:4</TrayButton>
<!--ENDMENU-->

<Pager/>

<!--STARTICONS-->
<TrayButton popup="files" icon="folder24.png">exec:/usr/local/bin/rox --dir=/files</TrayButton>
<TrayButton popup="www" icon="www24.png">exec:defaultbrowser</TrayButton>
<TrayButton popup="apps" icon="apps24.png">exec:pupapps</TrayButton>
<TrayButton popup="pkgget" icon="pet24.png">exec:dotpup</TrayButton>
<TrayButton popup="sfsget" icon="pet24.png">exec:sfsget</TrayButton>
<TrayButton popup="setup" icon="configuration24.png">exec:wizardwizard</TrayButton>
<TrayButton popup="edit" icon="edit24.png">exec:defaulttexteditor</TrayButton>
<TrayButton popup="console" icon="console24.png">exec:defaultterminal</TrayButton>
<TrayButton popup="connect" icon="connect24.png">exec:/usr/local/apps/Connect</TrayButton>
<TrayButton popup="share" icon="network24.png">exec:/usr/local/EasyShare/easyshare</TrayButton>
<TrayButton popup="update" icon="update24.png">exec:easy-update</TrayButton>
<!--ENDICONS-->

<TaskList labeled="false"/>

<Dock/>

<Swallow name="xload" width="32">
xload -nolabel -bg "#ff9d63" -fg "#c00000" -hl white
</Swallow>

<Clock format="%H:%M">exec:minixcal</Clock>

<!--STARTEXTRA-->
<TrayButton popup="Lock the screen" icon="lock-screen24.png">exec:/usr/local/apps/Xlock/AppRun</TrayButton>
<!--ENDEXTRA-->

</Tray>
</JWM>

Those entries between STARTMENU and ENDMENU also require these Include tags in /root/.jwmrc:

<Include>/root/.jwmrc-drives</Include>
<Include>/root/.jwmrc-containers</Include>

And in the case of icon-free-desktop those files will have some content, for example /root/.jwmrc-containers:

<JWM>
<RootMenu label="Containers" labeled="false" height="24" onroot="4">
<Program label="console" icon="/usr/local/lib/X11/pixmaps/ec-console48.png">/usr/sbin/ec-chroot-console</Program>
<Program label="dunfell" icon="/usr/local/lib/X11/pixmaps/ec-easy48.png">/usr/sbin/ec-chroot-dunfell</Program>
<Program label="www" icon="/usr/local/lib/X11/pixmaps/ec-www48.png">/usr/sbin/ec-chroot-www</Program>
</RootMenu>
</JWM>

We will need to think about either modifying JWMdesk to work with these files, at least with the modified /root/.jwmrc-tray and /root/.jwm/jwmrc-personal, or write a new JWM configuration GUI app.

EDIT:
Script /usr/local/ui/jwm/jwmrc-insert-icons and others improved, see:

https://bkhome.org/news/202202/sed-one-liner-to-extract-lines-between-two-patterns.html      

Tags: easy