Tuesday, October 13, 2015

How to customize x11/sterm on FreeBSD

Looking for a more lightwieght and minimal replacement for rxvt-unicode, one that supported more unicode than urxvt, I stumbled upon Termite. I was trying to get Termite to install, but had 20 show stopping errors at the last part and decided to check around for something else. I stumbled upon st from suckless. I'm already using dmenu, and I liked their philosophy, so if they made st, why not give it a shot.

As a side note, I was trying to figure out how to get st installed on FreeBSD 10.2 and almost gave up, until by complete accident, I saw x11/sterm, and decided to give it a try, and lo and behold, checking it out on portmon it said the projects home page was..dun dun dunnn..st.suckless.org. x11/sterm was FreeBSD's port of st! Install. Now.

Okay great, I installed and got the famous termcap error. Solution was to apply the TERM="xterm=256color" fix. Great, done. It's installed and working, but urxvt is still looking sexier.

st isn't picking up my .Xdefaults file. Okay, so how do I configure it? I have to create my own config.h, edit it to suit my needs and recompile it in...whuh?

I won't bore (or amuse) you with my trials and error. This is for others out there who were lost like me, and for my future self to save me time.

This is how to generate your own config.h:

  1. cd /usr/ports/x11/sterm && make extract
  2. This is my preference, you can get it this way or get it another way by cloning st from github. I prefer to get it from the extract method as my way of ensuring I'm up to date with the FreeBSD port. Copying the extracted directory also has an added bonus as we'll see later on. cp work/st-0.6 /home/Jason/.config/ You can rename it st or keep it as st-0.6, you can also copy the folder wherever you like, I just prefer .config to keep things sane.
  3. Include the newly copied st directory into your dotfiles or git repo. That way if you have to upgrade, or move to a new computer, you will always have your personal settings saved.
  4. cd into the new st directory and cp config.def.h config.h
  5. Modify config.h to your hearts content.
  6. Then when you're finished, go back to /usr/ports/x11/sterm.
  7. Important, if sterm is already installed, please deinstall it. make deinstall clean Also note that whenever clean is run, you lose the work directory.
  8. make ST_CONF=/home/Jason/.config/st-0.6/config.h install clean
  9. Test out st and witness your changes.

So, I already applied my newly found bestest and mostest eye pleasing preferred font of Hack size 14 with antialiasing set to true. I already applied the FreeBSD fix of setting the TERM to xterm-256color.

Which was simple enough as all I had to do was reinstall with the ST_CONF option.

Looking for a more lightwieght and minimal replacement for rxvt-unicode, one that supported more unicode than urxvt, I stumbled upon Termite. I was trying to get Termite to install, but had 20 show stopping errors at the last part and decided to check around for something else. I stumbled upon st from suckless. I'm already using dmenu, and I liked their philosophy, so if they made st, why not give it a shot.

As a side note, I was trying to figure out how to get st installed on FreeBSD 10.2 and almost gave up, until by complete accident, I saw x11/sterm, and decided to give it a try, and lo and behold, checking it out on portmon it said the projects home page was..dun dun dunnn..st.suckless.org. x11/sterm was FreeBSD's port of st! Install. Now.

Okay great, I installed and got the famous termcap error. Solution was to apply the TERM="xterm=256color" fix. Great, done. It's installed and working, but urxvt is still looking sexier.

st isn't picking up my .Xdefaults file. Okay, so how do I configure it? I have to create my own config.h, edit it to suit my needs and recompile it in...whuh?

I won't bore (or amuse) you with my trials and error. This is for others out there who were lost like me, and for my future self to save me time.

This is how to generate your own config.h:

  1. cd /usr/ports/x11/sterm && make extract
  2. This is my preference, you can get it this way or get it another way by cloning st from github. I prefer to get it from the extract method as my way of ensuring I'm up to date with the FreeBSD port. Copying the extracted directory also has an added bonus as we'll see later on. cp work/st-0.6 /home/Jason/.config/ You can rename it st or keep it as st-0.6, you can also copy the folder wherever you like, I just prefer .config to keep things sane.
  3. Include the newly copied st directory into your dotfiles or git repo. That way if you have to upgrade, or move to a new computer, you will always have your personal settings saved.
  4. cd into the new st directory and cp config.def.h config.h
  5. Modify config.h to your hearts content.
  6. Then when you're finished, go back to /usr/ports/x11/sterm.
  7. Important, if sterm is already installed, please deinstall it. make deinstall clean Also note that whenever clean is run, you lose the work directory.
  8. make ST_CONF=/home/Jason/.config/st-0.6/config.h install clean
  9. Test out st and witness your changes.

So, I already applied my preferred font of Dejavu Sans Mono size 12 with antialiasing set to true. I already applied the FreeBSD fix of setting the TERM to xterm-256color.

Which was simple enough as all I had to do was reinstall with the ST_CONF option.

However, wanting to completely replace rxvt-unicode, I needed transparency. I am in luck, as st provides the ARGBBG patch. However my so called luck quickly dissipated like morning mist, as I realised I had no clue how to apply the patch. The more advanced users can now sit back in amusement at my ignorance.

This is how in my newbness I applied suckless patches to sterm.

In my local copy of st-0.6, I made the changes from the diff file...by hand. Yes, I painstakingly checked the diffs and applied the changes to the individual files.

Afterwords...

  1. # cd /usr/ports/x11/sterm
  2. # make deinstall clean
  3. # make ST_CONF=/home/Jason/.config/st-0.6/config.h extract
  4. # cd work/st-0.6
  5. # rm config.mk st.c
  6. # cp /home/Jason/.config/st-0.6/config.mk .
  7. # cp /home/Jason/.config/st-0.6/st.c .
  8. # cd ../..
  9. # make ST_CONF=/home/Jason/.config/st-0.6/config.h install clean
  10. Enjoy new transparent st.
  11. Find out that there is a better way as discussed in the Porter's Handbook.

If anyone has done it more efficiently, please, please, please! I implore you. PLEASE share it with us, so we can spend more time enjoying what st has to offer us and less time in the configs. Thanks in advance.

No comments:

Post a Comment