Once-off Terminal colour change

I have my favourite Terminal color scheme, but I wanted to be able to select a different one on a once-off basis. Not make every subsequent Terminal in the new colour, just this one. As if terminal had a --colour=XXXX parameter.

So I scripted it. Requires hdialog

#!/bin/sh

if [ -e /boot/home/config/settings/Terminal/Default ]; then
	cp -f /boot/home/config/settings/Terminal/Default /boot/home/config/settings/Terminal/oldDefault
fi
theme=$(echo -n $(hdialog --radio " Pick a colour scheme" Blue Default Midnight Professional Relaxed Retro Slate "Solarized Dark" "Solarized Light"))
cd  /boot/system/data/Terminal/Themes/
cp -f "$theme" /boot/home/config/settings/Terminal/Default
cd /boot/home
Terminal &
sleep 1
if [ -e /boot/home/config/settings/Terminal/oldDefault ]; then
	mv -f /boot/home/config/settings/Terminal/oldDefault /boot/home/config/settings/Terminal/Default
else
	rm -f /boot/home/config/settings/Terminal/Default
fi
1 Like

This is actually a bug in the Haiku installation data. The Terminal themes don’t have the mimetype set properly, otherwise you could launch them directly with something like open /boot/system/data/Terminal/Themes/Blue, for example.

If you copy the theme files elsewhere and fix the mimetype & preferred app, then they can be used with the open command.

1 Like

Yeah, I remember doing that, long ago. It looks like this doesn’t even work with newly created color schemes now, so that MIMEtype has been long forgotten.

It still works fine for me. For example, to make one of the standard settings files usable with open:

cp /boot/system/data/Terminal/Themes/Retro ~
addattr -t mime BEOS:PREF_APP application/x-vnd.Haiku-Terminal ~/Retro
addattr -t mime BEOS:TYPE text/x-terminal-pref ~/Retro
open ~/Retro

The application creating this file is responsible for setting mimetypes, so if Terminal would like a config to be openable it would have to set this when saving the theme.

Though personally I fail to see why one would want to do that :g

These files are part of the haiku install, in this specific case they are not created directly by terminal. So this is just an oversight in haiku buildsystem.