Rio theming in 9front


Update, 2022/10/21: patch updated to apply on latest rio, yet again.

Update, 2022/09/12: patch updated to apply on latest rio, again.

Update, 2022/08/24: patch updated to apply on latest rio.

Update, 2022/06/20: patch updated so that rio background change should trigger necessary logic to keep “glitchy background on new windows” away.

Update, 2021/07/01: patch updated for latest 9front, instructions on applying are updated to use ape/patch since hg has been removed.

Update, 2021/05/28: subrios will try loading the theme from /dev/theme on start.

Update, 2020/11/29: jmi2k cleaned up the patch from riow and made it show image paths. The patch here contains that and can be applied to 9front’s latest rio. If you need riow, apply it on top or before.

Here is presented an approach of theming rio without having to change its code every time a change of color is needed. Each nested rio may have a different color theme.

Before doing anything, make sure to run sysupdate. I you had the patch applied before, or sysupdate resulted in conflicts, undo the patch first.

A patch should be applied, rio rebuilt, installed, and restarted.

bind -ac /dist/plan9front /
cd /sys/src/cmd/rio
hget | patch -p5
mk install

To undo previous changes, run:

bind -ac /dist/plan9front /
cd /sys/src/cmd/rio
git/revert .
rm -f *.rej *.orig menuhit.c col.h
mk install

The patch makes rio export /dev/theme file:


With simple writes to /dev/theme one can change colors dynamically without having to recompile and restart rio. Themes can be stored to files and loaded again after rio has started:


window 'cat /usr/glenda/lib/theme/rio.theme > /mnt/wsys/theme'

Writing to /dev/vgactl may cause hwblank to be enabled, hence the last line. You can skip that if on your laptop hwblank works fine.


rioback	/usr/glenda/lib/1920x1080.img
back	f1f1f1
high	cccccc
border	999999
text	000000
htext	000000
title	000000
ltitle	bcbcbc
hold	000099
lhold	005dbb
palehold	4993dd
paletext	6f6f6f
size	000000
menubar	448844
menuback	eaffea
menuhigh	448844
menubord	88cc88
menutext	000000
menuhtext	eaffea

As you can see, rioback in this example is set to a Plan 9 image, that’s the wallpaper. Images have to be of the same size as your screen and can be converted from a, for example, JPEG file as:

jpg -9t <coolwallpaper1920x1080.jpg >/usr/glenda/lib/1920x1080.img


rio theming

A more user-friendly interface is provided by installing picker and then running picker </dev/theme >/dev/theme.

Picker provides ways to snarf the entire theme, to revert a color or an entire palette, etc. With proper setup (see man picker) one can plumb a theme file to change it instantly (while picker is running).





Last update: October 21, 2022 02:16PM