Open ConercaoAlpha opened 2 years ago
I've managed to get a workaround for this working using a couple of zsh functions that replace the background image file path in the json.settings
.
init_background () {
cd /mnt/c/Users/$(whoami)/AppData/Local/Packages/Microsoft.WindowsTerminal_xxxxxxxxxxxx/LocalState/
jpg=$(grep .jpg settings.json | cut -d "\\" -f 9 | awk '{sub(/..$/,"")}1')
if [ "$jpg" != "blank.jpg" ];
then
sed -i "s|$jpg|blank.jpg|" settings.json
fi
cd $OLDPWD
}
#Run init_background on login to clear terminal
init_background
set_background () {
cd /mnt/c/Users/$(whoami)/AppData/Local/Packages/Microsoft.WindowsTerminal_xxxxxxxxxxxx/LocalState/
jpg=$(grep .jpg settings.json | cut -d "\\" -f 9 | awk '{sub(/..$/,"")}1')
case ${jpg} in
blank.jpg)
sed -i "s|blank.jpg|$ENV_PROFILE.jpg|" settings.json
;;
environment1.jpg)
sed -i "s|environment1.jpg|$ENV_PROFILE.jpg|" settings.json
;;
environment2.jpg)
sed -i "s|environment2.jpg|$ENV_PROFILE.jpg|" settings.json
;;
environment3.jpg)
sed -i "s|environment3.jpg|$ENV_PROFILE.jpg|" settings.json
;;
environment4.jpg)
sed -i "s|environment24.jpg|$ENV_PROFILE.jpg|" settings.json
;;
environment5.jpg)
sed -i "s|environment5.jpg|$ENV_PROFILE.jpg|" settings.json
esac
cd $OLDPWD
}
The init_background
function sets the background to blank (assuming that the background has been set before). This could probably go into z.logout
to clear the profile on close. The second function, set-background
allows for chopping and changing between environments. This is doing the same function as setting the badge variable in iTerm2.
Both functions require that you have created a "blank" background image and then one for each of your environments, LIVE, STAGING. DEV/TEST etc etc
Description of the new feature/enhancement
Something akin to the "badge" functionality in iTerm2. This creates a configurable "badge" in the background of a terminal that can be used to denote whatever is wished. I personally use this feature when working with multiple cloud environments to differentiate between the different terminals
Proposed technical implementation details (optional)
As for how to implement this, I am unsure but perhaps they could be added as a function to Terminal's improving theming? At present this feature is called from a function within my .zshrc file(below)
This can then be set by using
or
Example