1

Setting up the virtual terminal appearance on a box with Arch and urxvt, I find myself unable to display which X resources are in use in a particular VT instance.

Take that workflow:

  1. Open an urxvt console, load a particular color/font/font-attribute (e.g. by editing ~/.Xresources then update this VT with xrdb merge)
  2. Open another VT, load a different setting, and repeat so to compare between them.
  3. Phone rings, time to eat or look upon some kid...
  4. Come back to the computer: Oow, what was the X resources settings in VT 1, 2 or N already?

I tried several tools that are able to show up X resources settings for a particular application but:

xrdb or xorg-appres won't show up X resources loaded in a VT instance

As you might see, xrdb will show X resources loaded by the VT at a moment, but not per VT instance. Same for xorg-appres. Here's a wider screenshot with more instances and different settings loaded

Is there a way to show up X resources loaded in a particular VT instance that you know of?

PS: My question slightly differs from the otherwise very informative How can I find the default (font) resource XTerm is using? ‒ 2013

tuk0z
  • 549

1 Answers1

2

In the good old days, and 20 years on, you can use editres to view and even change the Athena widget resources in a real xterm.

However, urxvt does not use these widgets but some other graphics library. It does however provide a perl extension, so you should be able to get any information by writing some perl. For example, I quickly cobbled together these lines which you can put in a file, say ~/myextn:

#!/usr/bin/perl
# http://unix.stackexchange.com/a/306775/119298
# for urxvt --perl-lib ~/ -pe myextn
sub on_init {
   my ($self) = @_;
   # warn "in my font info init";
   my $hotkey = "C-s";
   $self->bind_action($hotkey, "%:getinfo")
      or warn "unable to register '$hotkey' as font info\n";
   ()
}
sub on_action {
    my ($self, $action) = @_;
    if($action eq "getinfo"){
        my $term = $self->{term};
        # warn "font ",$term->resource('font');
        $term->scr_add_lines("font ".$term->resource('font')."\r\n");
    }
    ()
}

Then run urxvt --perl-lib ~ -pe myextn to use the extension and when you type control-s you should see the value of the "font" resource appear in the terminal.

meuh
  • 51,383
  • I thank you @meuh, for this works brilliantly, with your perl script without extension and in the current directory. – tuk0z Sep 02 '16 at 18:55