Rio theming in 9front
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 https://ftrv.se/_/9/patches/rio-themes.patch | hg patch -f --no-commit - mk install
To undo previous changes, run:
bind -ac /dist/plan9front / cd /sys/src/cmd/rio hg revert . rm -f *.orig menuhit.c col.h mk install
The patch makes rio export
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; sleep 0.5; grep softscreen /dev/vgactl >> /dev/vgactl; echo hwblank off >> /dev/vgactl'
/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
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).
- windows flashing, rio has to redraw all the windows to update colors
- on native installations
grep softscreen /dev/vgactl >> /dev/vgactlhas to be executed when rio background color (or image) is changed, with drawterm it should be enough to resize it a bit
Last update: May 28, 2021 08:07AM