A problem I'm having with my HiDPI display, remote X, and (X) cursors

March 17, 2020

When I set up my HiDPI display on my home Linux machine, I had to do some wrestling with general DPI and scaling settings but after that most everything just worked and I didn't think about it. Due to world and local events, I spent a chunk of today getting set up for an extended period of working from home, including getting my work exmh configured to display properly over remote X on my HiDPI home display.

(Exmh is one of the things that I really miss when I don't have X across the network, and my current DSL link is actually fast enough to make it useful for reading email. If I'm going to be working from home for an extended period of time, I need a good email environment so it was worth the effort to see if exmh could run decently over my DSL link.)

This worked in general (with a few mistakes along the way), but after using exmh for a while I realized that the (X) mouse cursors that I was seeing when my mouse was over the exmh windows were unusually and suspiciously small, as if they hadn't been scaled up to HiDPI levels. At first I thought that this was a TCL/TK issue, but then I looked at the mouse cursors I was seeing in other programs run over the remote X connection (such as sam and even xterm), I saw the same issue. My local xterm windows have a mouse cursor that's the right size (roughly the size of a capital letter in the xterm), but an xterm on our Ubuntu machines run over remote X has one that's half the correct size. The same is true of the cursors in exmh, GNU Emacs, and sam.

(In the process of writing this entry, I checked my office Fedora machine and to my surprise, these programs all work correctly there over a remote X connection.)

X mouse cursors are a very old thing and in the way of X they've gone through a number of evolutions over the years (and then things like GUI toolkits and theming added extra layers of fun). The result is relatively opaque and underdocumented, especially if what you care about is basic X stuff like xterm and TCL/TK (for natural reasons, most people focus on writing about full scale desktops like GNOME and KDE). I found a variety of things on the Internet, some of which didn't work for me and some of which aren't feasible because the remote machines are multi-user ones and not everyone doing remote X to it has a HiDPI display (I won't when we go back to work, for example).

These days, there are apparently cursor themes, as discussed a bit in the Gentoo wiki and this article (and see also). Some basic X programs in some environments pay attention to this, through both X resources settings and environment variables (per the Arch wiki), but on our Ubuntu machines the various X programs seem to ignore the environment variables (although this stackoverflow answer talks about them). On Fedora the $XCURSOR_SIZE environment variable and so on does work.

Our Ubuntu machines have the libxcursor shared library installed (as 'libXcursor.so') and a running xterm uses it, but they don't seem to have any X cursor files installed (we don't have the xcursor-themes package present, for example). This may mean that our Ubuntu machines are forced to fall back to some very old X protocol thing and that X protocol thing only has one size, that being the tiny non-HiDPI cursors. My Fedora machines do appear to have cursor themes installed in stuff under /usr/share/icons, and it looks like if I copy the right one ('Adwaita') to our Ubuntu machine and set $XCURSOR_PATH and $XCURSOR_THEME, my exmh, xterm, and so on work right.

(I think that setting these environment variables in general is harmless for non-HiDPI sessions, because I believe that the X cursor library magically picks the right size based on your display DPI.)

I suspect that this is a sign that our Ubuntu machines don't really have all of the X related packages that they should have in order to make modern X programs happy in modern X environments (which definitely include HiDPI screens). I'm not sure what additional packages we need, though, which means that I have a new project. In the mean time, writing this entry has gotten me to do enough research to find a workaround for now.

Written on 17 March 2020.
« How Firefox could support automatically using local DNS over HTTPS servers
Understanding X mouse cursors (and their several layers of history) »

Page tools: View Source, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Tue Mar 17 01:33:34 2020
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.