Hund

How to use alternative settings for URxvt

Published: Friday, June 5, 2020

Ever since I retired my HTPC I have been using my desktop computer as my HTPC with my TV connected to it. My HTPC consisted (and still) does of some terminal emulator running software like Newsboat and Ranger, but because I want to be able to read the text on the TV from the distance of my sofa I have up until now been lazy and used a secondary terminal emulator with alteranative settings that better suited with large text and another colourscheme.

I didn’t really like the approach of having two terminal emulators, so I decided to do some research to see if I could solve it by only using my main terminal emulator URxvt. Spoiler: I could.

It turns out that you can add alternative settings for URxvt and then optionally enable them with an argument. I found out about this in an old thread over at the Arch Linux forums.

How it works

You can add a custom setting with the name URxvt-<word>, like URxvt-tv and when you run URxvt wit the flag -name URxvt-tv it will use these settings.

Example

I added the following settings to my file ~/.Xresources:

! TV settings

URxvt-tv.font: xft:Monospace:pixelsize=40
URxvt-tv.boldFont:xft:Monospace:pixelsize=40

! Tango colours 
URxvt-tv.background: #000000
URxvt-tv.foreground: #FFFFFF

! Black dark/light
URxvt-tv.color0:             #2e3436
URxvt-tv.color8:             #6e706b
! Red dark/light
URxvt-tv.color1:             #cc0000
URxvt-tv.color9:             #ef2929
! Green dark/light
URxvt-tv.color2:             #4e9a06
URxvt-tv.color10:            #8ae234
! Yellow dark/light
URxvt-tv.color3:             #edd400
URxvt-tv.color11:            #fce94f
! Blue dark/light
URxvt-tv.color4:             #3465a4
URxvt-tv.color12:            #729fcf
! Magenta dark/light
URxvt-tv.color5:             #92659a
URxvt-tv.color13:            #c19fbe
! Cyan dark/light
URxvt-tv.color6:             #07c7ca
URxvt-tv.color14:            #63e9e9
! White dark/light
URxvt-tv.color7:             #d3d7cf
URxvt-tv.color15:            #eeeeec

When I run the command urxvt -name URxvt-tv it will launch URxvt with my alternative settigns.

Extras

This is not related to the title of this post but I thought I would include it anyway. I wanted to be able to instantly spawn the “TV terminal” on my TV from any monitor and workspace and have it automatically disable the decoration. I solved this by adding this keybinding to i3:

bindsym Mod4+Return workspace 10; exec --no-startup-id "tvterm"

I also added these two rules to i3::

for_window [title="tvterm"] border none
workspace 10 output HDMI-0

The script tvterm includes this snippet:

#!/bin/bash

urxvt -name URxvt-tv -hold -e sh -c 'printf "\33]2;%s\007" "tvterm"; zsh'

I don’t know why, but I didn’t get it to work when I added that command direcly to the configuration file for i3. And the printf part is to trigger the rules for i3.


Meta

Comments

If you want to leave feedback you can do so by either sending me a message via e-mail or by commenting on my post for this article on the fediverse.