💾 Archived View for ftrv.se › 14 captured on 2020-09-24 at 00:40:05. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
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 `/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:
`/usr/glenda/bin/rc/riostart`
window 'cat /usr/glenda/lib/theme/rio.theme > /mnt/wsys/theme; sleep 1; grep softscreen /dev/vgactl >> /dev/vgactl'
`/usr/glenda/lib/theme/rio.theme`
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[1] 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).