1

I have a 4k laptop display and dual 1920x1200 external monitors, one rotated vertically so emacs can have a million lines in view. Font scaling is set to 200% on the laptop display and 100% on the externals. This is in Gnome under Ubuntu 22.04.2 and using Wayland, GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.16.0) of 2022-01-24, modified by Debian.

Expected and desired behavior: When I move a window from the laptop to the external monitor, as the cursor crosses over, the window shrinks to the external monitor's 100% scaling, and vice versa when I cross back. Gnome-terminal and nearly all other windows do this. The windows have approximately the same physical size on the two monitors, but of course look better on the 4k display.

Emacs behavior (undesired): The window size changes by a factor of 2 (counted in pixels, not linear measure), but the font does not change, so it looks HUGE on the external monitor, and the width in characters is unusably small.

I have searched for this problem but have not yet found it here or on other forums, nor in the Emacs Wiki. I see lots of ways to set the default font or change the font manually, but I want it to work automatically. I also want it to work for everyone, not just those of us making a fancy special hack or setting, though that would be the first step.

I'm a little surprised this hasn't been dealt with already. Retina displays have been around forever and nearly everything else "just works"...what am I missing? Is this a Wayland issue and it works on X.org? I'll switch back if so, though I think we'll all be dragged into the Wayland universe, eventually.

Joe
  • 13
  • 5
  • 1
    You didn't mention which version of emacs you're using. I'd try the (unreleased) emacs-29 compiled with the '--with-pgtk' flag (which is not intended to be used under X) – rpluim Apr 20 '23 at 18:29
  • Thanks, I've added the Emacs version string from the help. Is there a PPA that offers the version you suggest? I'm not wanting to be too bleeding edge. Production environment! – Joe Apr 21 '23 at 04:40
  • Not that I know of. All the ones I can find seem to be default builds, so not '--with-pgtk'. Cloning the emacs repository and building it yourself is not hard, and you can run from the source tree without installing – rpluim Apr 24 '23 at 17:20
  • Trying. It's been over a decade since the last time I did this for any package, and tools have changed. I found this page: https://www.emacswiki.org/emacs/EmacsFromGit, ran: git clone --depth 1 https://git.savannah.gnu.org/git/emacs.git, got Emacs 30, tried to follow the INSTALL instructions, but they broke. There is no configure script in the top level. I ran autoconf and got one, but with errors, and when I tried to run it I got a syntax error. I may not have all the packages I need on my machine. What do I need? First error: configure.ac:55: error: possibly undefined macro: AS_ECHO – Joe Apr 24 '23 at 23:29
  • Line 12 of INSTALL tells you to read INSTALL.REPO, which tells you to run autogen.sh – rpluim Apr 25 '23 at 10:59
  • Thanks, I read too fast and missed that. It took a total of 3 hours (wall clock time, not estimates) to get emacs to compile from first attempt to first successful run. But, it worked! GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) of 2023-04-26 does properly scale on Wayland when moving back and forth between monitors of different scalings. – Joe Apr 26 '23 at 06:54
  • Now, how to get it in a supported Ubuntu package...first, to find the first version with the fix. Tomorrow. – Joe Apr 26 '23 at 07:23

1 Answers1

0

Scaling under Wayland on different screens is supported, but Emacs has to be compiled with the '--with-pgtk' flag, which is available starting in Emacs 29.

rpluim
  • 4,605
  • 8
  • 22
  • Does it work in X11 in the same binary? It seemed to indicate that --with-pgtk was for non-X11 setups, but a release like Ubuntu would need a binary that works under both X11 and Wayland. – Joe Apr 26 '23 at 16:16
  • It looks like the Emacs 29.1 release will be in the next few weeks. From there, is it possible/likely that Ubuntu would push an update to 22.04LTS? It''s not a security bug, but it fixes a significant productivity problem for a common monitor setup. – Joe Apr 26 '23 at 16:25
  • I have filed an Ubuntu bug suggesting an upgrade to emacs 29.1 when it releases: https://bugs.launchpad.net/ubuntu/+source/emacs/+bug/2017803 – Joe Apr 26 '23 at 17:27
  • You can run a '--with-pgtk' emacs under XWayland, but it will complain loudly, and some things won't work correctly. – rpluim May 05 '23 at 13:25
  • So, is there a way to get a single binary emacs that runs well under both? If not, I hope GNU can make that a priority, as it's obviously necessary for Emacs to remain a viable editor under Ubuntu. Wayland isn't ready for prime time (desktop files appear over all other windows occasionally rather than being part of the background, random windows rise to the top and take focus when you close or drop another, etc.), but it's now the default, so both have large numbers of users. I'm puzzled, but that's the situation. – Joe May 05 '23 at 19:30