Any ideas how to change the font size for a urxvt terminal opened on a specific display or workspace?
I would like to use a different font size in my terminal if it is opened on an external display. Is this possible somehow?
I would like to use a different font size in my terminal if it is opened on an external display. Is this possible somehow?
Here's the solution I went with for my system which has a hidpi display on eDP1. It uses a combination of both previous answers, since I suspect that updating the Xresources would change settings for all displays, instead of just the current one (haven't tested that though).
term_for_display.sh
- a script to open a terminal differently on a particular display
#!/bin/bash
hidpi_display="eDP1"
current_display=$(get_display.py)
if [ "$current_display" != "$hidpi_display" ]; then
urxvt -fn "xft:Terminus:pixelsize=18,style=Regular"
else
urxvt
fi
get_display.py
- a script to find the name of the current display
#!/usr/bin/env python
import json
from subprocess import check_output
out = check_output(["i3-msg", "-t", "get_workspaces"])
workspaces = json.loads(out.decode("utf-8"))
focused_workspace = filter(lambda x: x["focused"], workspaces)
print(next(focused_workspace)["output"])
.i3/config
- run the new script to open a terminal
bindsym Mod1+Return exec --no-startup-id /path/to/term_for_display.sh
Solution sketch (assuming that urxvt is your terminal):
.Xresources
with different font sizes.i3-msg -t get_workspaces
.xrdb /path/.Xresources-with-specific-font-size
(which loads a specific configuration) and then runs urxvt
.I hope you know how to write scripts (it's never too late to learn!). If not, I hope someone else fills out the gaps.
Launch with options. See 'man urxvt' urxvt -fn "xft:Bitstream Vera Sans Mono:pixelsize=15"
Asked: 2015-04-02 13:06:33 +0000
Seen: 445 times
Last updated: Apr 07