Skip to content

Instantly share code, notes, and snippets.

@mainframed
Created August 15, 2021 14:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mainframed/677b8d4438c672c4798ec140cd8de167 to your computer and use it in GitHub Desktop.
Save mainframed/677b8d4438c672c4798ec140cd8de167 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Download Xresources from https://github.com/mbadolato/iTerm2-Color-Schemes/tree/master/Xresources
# Then use this USSTABLE: https://github.com/mainframed/usstable/blob/master/demo_screen.jcl
pro=~/.x3270pro
# Change delay time if you need to
SLEEPY=1
echo "[+] Xresources folder:" $1
echo "[+] Output folder :" $2
echo "[+] Server string :" $3
echo "[+] Screenshot folder:" $4
if test -f "$pro"; then
echo "[!] Backing up current x3270pro file to ~/.x3270pro_backup"
mv $pro "$pro"_backup
fi
if test -f "README.md"; then
rm README.MD
fi
cat << 'EOF' > README.MD
# x3270 themes!
No longer does your x3270 screen need to use the default colors that come with it! This repo contains all the themes from terminal.sexy in `.x3270pro` format, *over 157 themes!* Take your favorite theme and put it in your `.x3270pro` file: `cat schemes/<x3270pro> >> ~/.x3270pro`
## Make Your Own
Don't like the themes included here? Just go to [terminal.sexy](http://terminal.sexy) or [https://ciembor.github.io/4bit/#](https://ciembor.github.io/4bit/#) pick your favorite colors and save it as an `.Xresources` file, then convert it to x3270pro format with `x3270_pro_generator.py <.Xresources file> >> ~/.x3270pro`
## Color Schemes
These themes have been converted using this script from https://github.com/mbadolato/iTerm2-Color-Schemes/tree/master/Xresources
EOF
for i in $1/*
do
echo "[+] Processing : $i"
f=$(basename "$i")
echo "! model (-model)" > $pro
echo "x3270.model: 2" >> $pro
echo "x3270.scrollBar: false" >> $pro
#echo "[+] Theme name :" $f
python3 ./x3270_pro_generator.py "$i" > $2/"$f".x3270pro
cat $2/"$f".x3270pro >> $pro
x3270 -title "$f" $3&
last_pid=$!
sleep $SLEEPY
echo "" >> README.MD
echo "### $f" >> README.MD
echo "" >> README.MD
echo "![$f]($4/$f.png?raw=true)" >> README.MD
xfce4-screenshooter -w -s $4/"$f".png
disown $last_pid
kill -KILL $last_pid
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment