The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
1

Any ideas how to change the font size for a urxvt terminal opened on a specific display or workspace?

asked 2015-04-02 13:06:33 +0000

g-eorge gravatar image

I would like to use a different font size in my terminal if it is opened on an external display. Is this possible somehow?

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted
1

answered 2015-04-07 14:21:02 +0000

g-eorge gravatar image

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
edit flag offensive delete link more

Comments

Thanks to previous posters. Sorry I don't have enough points to upvote or accept answers!

g-eorge gravatar imageg-eorge ( 2015-04-07 14:21:58 +0000 )edit
0

answered 2015-04-02 14:32:32 +0000

i3convert gravatar image

updated 2015-04-02 14:34:48 +0000

Solution sketch (assuming that urxvt is your terminal):

  1. Create two copies of .Xresources with different font sizes.
  2. Write a script that figures out which display you are on. To this end, you can process the output of i3-msg -t get_workspaces.
  3. Write another script that first, based on the output of the previous script, executes 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.

edit flag offensive delete link more

Comments

Great idea, I'll try that out. Thanks!

g-eorge gravatar imageg-eorge ( 2015-04-04 11:32:44 +0000 )edit
0

answered 2015-04-03 20:03:14 +0000

topernic gravatar image

Launch with options. See 'man urxvt' urxvt -fn "xft:Bitstream Vera Sans Mono:pixelsize=15"

edit flag offensive delete link more

Comments

Nice! I didn't know that there was a command line switch. He probably still needs an additional script to figure out what display he is on.

i3convert gravatar imagei3convert ( 2015-04-04 01:42:20 +0000 )edit

Thanks for the tip, I'll look into that.

g-eorge gravatar imageg-eorge ( 2015-04-04 11:30:29 +0000 )edit

Question Tools

Stats

Asked: 2015-04-02 13:06:33 +0000

Seen: 445 times

Last updated: Apr 07