Strange behaviour of urxvt and .Xresources on i3wm

Hi,

I have configured an instance of urxvt to be launched at start on i3wm:

exec_always "urxvt -name base"
assign [class="^URxvt$" instance="^base$"] 0

For this instance of urxvt I have a strange formatting: there are substitutions of characters (like @ and ~) by rectangles. But if I run other instances of urxvt, this problem doesn’t show up.

My .Xresources for the font is

URxvt.font: xft:NotoSansMono:style=Regular:size=13
URxvt.boldFont: xft:NotoSansMono:style=Bold:size=13 
URxvt.italicFont: xft:NotoSansMono:style=Italic:size=12 
URxvt.boldItalicFont: xft:NotoSansMono:style=Bold Italic:size=13 

Do you have any idea why this happens and how to fix it?

I have no idea if this is related, by why are you using exec always rather than plain exec?

There is not need to set exec_always is this.

Also urvxt uses the .Xresources for all instances so this is indeed a strange behavior unless you need to set the font more specific with

URxvt*font: xft:NotoSansMono:style=Regular:size=13

mind the * instead of the .

Thanks for your replies.
I think I put the exec_always for testing purposes when trying the assignment stuff (if I’m not wrong exec_always allows to execute the program when i3 is restarted, not uniquely when the system reboots), so you are right, this is not useful anymore.

I tried with the * in place of . but I get the same result.
With a closer look, it seems that the font is not quite the same (or at least not the Mono version).

Could this first instance of urxvt read another config file?
What is very strange to me is that the other configurations of my .Xresources, like background and font colors, are correctly loaded by this first instance.

It should not, but it seems to defaults to the default font for some reason.

does this also happens if you use -title instead of -name?

Could it be that the first instance is getting loaded too soon, i.e. before some other resources have had a chance to load? How early in the config does the line occur? Is it before the compositor or something? I’m just trying to think of what might have an effect on it.

could you please post your .xinitrc and the output of “xrdb -query” ?

Also check if “xrdb ~/.Xresources” does not show an output with errors

btw how do you start i3?

---- edit ----
I tried to reproduce it and I only got it in two occasions

first one was when I intentionally set a wrong config line in the Xresources file
Second one was when I did not set the following and left the xrdn line out of xinitrc. (I start i3 with startx and not with a graphical manager. )

# load the Xresources
xrdb -merge ~/.Xresources

# start the desktop
exec i3

A few observations that I might help (I hope):
1- The difference of fonts seems to be for the BOLD font only! Sorry, I didn’t notice that before.
2- I tried -title instead of -name, no changes.
3- I have two different results for xrdb -query depending if I execute
xrdb -merge ~/.Xresources or not !! (see below)
4- I had exec 'xrdb ~/.Xresources' in my i3config file. I removed it, I also tried the -merge version, and in all cases I got the same result.

Here is the result of xrdb -query (I’ve shorten the color list):

*.color0:	#263640
 ... 
*.color9:	#fa3935
*.cursorColor:	#99A650
*background:	#1F1F1F
*fadeColor:	black
*fading:	8
*foreground:	#E0E0E0
*pointerColorBackground:	#2B2C2B
*pointerColorForeground:	#16A085
URxvt*boldFont:	xft:NotoSansMono:style=Bold:size=13
URxvt*boldItalicFont:	xft:NotoSansMono:style=Bold Italic:size=13
URxvt*font:	xft:NotoSansMono:style=Regular:size=13
URxvt*italicFont:	xft:NotoSansMono:style=Italic:size=12
URxvt.cursorBlink:	true
URxvt.cursorUnderline:	false
URxvt.depth:	24
URxvt.geometry:	92x24
URxvt.internalBorder:	24
URxvt.iso14755:	false
URxvt.keysym.Control-Down:	\033[1;5B
URxvt.keysym.Control-Left:	\033[1;5D
URxvt.keysym.Control-Right:	\033[1;5C
URxvt.keysym.Control-Up:	\033[1;5A
URxvt.keysym.Shift-Control-C:	eval:selection_to_clipboard
URxvt.keysym.Shift-Control-Down:	\033[1;6B
URxvt.keysym.Shift-Control-Left:	\033[1;6D
URxvt.keysym.Shift-Control-Right:	\033[1;6C
URxvt.keysym.Shift-Control-Up:	\033[1;6A
URxvt.keysym.Shift-Control-V:	eval:paste_clipboard
URxvt.letterSpace:	0
URxvt.lineSpace:	0
URxvt.saveline:	5000
URxvt.scrollBar:	false
URxvt.scrollBar_right:	false
URxvt.urgentOnBell:	true
XTerm*faceName:	Fixed
XTerm*faceSize:	11
XTerm*pointerColor:	#1ABB9B
XTerm*reverseVideo:	on
XTerm*selectToClipboard:	true
Xcursor.size:	24
Xcursor.theme:	xcursor-breeze-snow
Xft.antialias:	1
Xft.autohint:	false
Xft.dpi:	101
Xft.hinting:	1
Xft.hintstyle:	hintslight
Xft.lcdfilter:	lcddefault
Xft.rgba:	rgb

If I execute 'xrdb -merge ~/.Xresources' then xrdb -query gives me the same except for the following part:

Xcursor.size:	10
Xcursor.theme:	xcursor-breeze-snow
Xft.antialias:	true
Xft.autohint:	false
Xft.dpi:	96
Xft.hinting:	true
Xft.hintstyle:	hintslight
Xft.lcdfilter:	lcddefault
Xft.rgba:	rgb

The latter coincides with my ~/.Xresources.
In both cases (before and after the execution of 'xrdb -merge ~/.Xresources') the other instances of urxvt work well. :man_shrugging:

Here is my .xinitrc:

#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap

DEFAULT_SESSION=gnome-session

 merge in defaults and keymaps
[[ -f ~/.Xresources ]] && xrdb -merge ~/.Xresources

if [ -f $sysresources ]; then
    xrdb -merge $sysresources
fi

if [ -f $sysmodmap ]; then
    xmodmap $sysmodmap
fi

if [ -f "$userresources" ]; then
    xrdb -merge "$userresources"
fi

if [ -f "$usermodmap" ]; then
    xmodmap "$usermodmap"
fi

# start some nice programs

if [ -d /etc/X11/xinit/xinitrc.d ] ; then
    for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
        [ -x "$f" ] && . "$f"
    done
    unset f
fi

get_session(){
	local dbus_args=(--sh-syntax --exit-with-session)
	case $1 in
		awesome) dbus_args+=(awesome) ;;
		bspwm) dbus_args+=(bspwm-session) ;;
		budgie) dbus_args+=(budgie-desktop) ;;
		cinnamon) dbus_args+=(cinnamon-session) ;;
		deepin) dbus_args+=(startdde) ;;
		enlightenment) dbus_args+=(enlightenment_start) ;;
		fluxbox) dbus_args+=(startfluxbox) ;;
		gnome) dbus_args+=(gnome-session) ;;
		i3|i3wm) dbus_args+=(i3 --shmlog-size 0) ;;
		jwm) dbus_args+=(jwm) ;;
		kde) dbus_args+=(startkde) ;;
		lxde) dbus_args+=(startlxde) ;;
		lxqt) dbus_args+=(lxqt-session) ;;
		mate) dbus_args+=(mate-session) ;;
		xfce) dbus_args+=(xfce4-session) ;;
		openbox) dbus_args+=(openbox-session) ;;
		*) dbus_args+=($DEFAULT_SESSION) ;;
	esac

	echo "dbus-launch ${dbus_args[*]}"
}

exec $(get_session)

I don’t have the file /etc/X11/xinit/.Xresources

If I use that instead of

xrdb -merge ~/.Xresources

I also get a wrong font.

So chance (only) that line and see if that helps.

(dont forget the line must be above the exec)

I changed this line but I still get the same result, even if I remove it completely.

If, from the i3config file, I remove
exec 'xrdb -merge ~/.Xresources' and exec '~/.xinitrc'.
then all the instances of urxvt have this problem of font. But even in this case all these instances have the other configurations from .Xresources. So somehow .xinitrc or Xresources is loaded, right? There is definitely something I don’t understand.

If I understand correctly you had or have a

exec ~/.xinitrc

In your i3 config?

I wonder why and it makes me wonder how you start your environment in the first place.
Do you use a graphical desktop manager?
(I guess you use “xinit i3” but I could be wrong

Second I wonder about is how do you start the new instances of urxvt?

Hi,

In my original i3 config file I had exec 'xrdb ~/.Xresources' .
Then I tried a few changes in this file to see what happens and I replaced 'xrdb ~/.Xresources' by exec ~/.xinitrc at some point (well, probably it was a bit stupid).

I don’t know how the environment starts. I use Manjaro’s settings I suppose, there is lightDM as a greeter to select the desktops or wm (I also have gnome which was my former desktop).
To start urxvt instances I execute i3-sensible-terminal.
Here is part of my original i3config file (I removed most of the bindings and windows config, etc):

# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart

bindsym $mod+Return exec i3-sensible-terminal

exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork
exec_always --no-startup-id gnome-power-manager
exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1

exec "keepassxc"
exec "xrdb ~/.Xresources"

exec "urxvt -name base"
assign [class="^URxvt$" instance="^base$"] 0

exec --no-startup-id $HOME/.config/polybar/launch.sh

It is a long time ago I used LightDM but if I am not mistaking it does not do anything with .xinitrc (by default) but rather with .xprofile

Since it looks like there is an issue with reading the .Xresources file and your using a starter I have not uses in ages I don’t have any suggestions left.

Perhaps there is something in you LightDM config or in (if you have it) the .xprofile config what triggers this behavior.

Well, thanks for your time. I will continue to investigate that.