Rio theming in 9front
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.
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
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 1; grep softscreen /dev/vgactl >> /dev/vgactl'
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
- image file as a color isn’t shown in
/dev/theme, patches welcome
- the patch provided has riow functionality along with theming, didn’t have time to clean that one out; it shouldn’t cause any issues anyway
Last update: September 02, 2020 08:44AM