0

I have an issue with keyboard shortcuts conflict (an event is triggered upon a key press instead of release). (This is a very old issue which is common for users using 2 or more keyboard layouts).

An X server patch exists for this issue. I'd like to apply it but I'm not sure how to properly do that.

The solution from this comment:

As an ordinary Gentoo Linux user, I:
- download patch attached to this issue named "The same patch, but based on 1.19.1 (fixed)" into directory /etc/portage/patches/x11-base/xorg-server/
- run emerge xorg-server to reinstall Xorg with this patch applied
- restart X to enjoy working hotkeys :)

Question: How do you (properly) patch the X server on Ubuntu? (I'm currently using Ubuntu 24.04.)

1 Answer 1

1

In terminal:

  1. Get the sources with git clone https://gitlab.freedesktop.org/xorg/xserver

  2. Enter the cloned directory cd xserver

    • (optional): you might want to switch the code to some release branch with git checkout branch-name. Doesn't matter much in terms of stability because xserver has very little devel activity these days (because people mostly moved to Wayland). But if the patch doesn't apply, you might have to switch to some older branch.
  3. Put the patch to the current dir (e.g. by downloading with wget url-to-the.patch)

  4. Apply it: git am -3 your.patch.

    Worth noting here, sometimes people mistakenly call "patch" what is actually a diff. The big difference is that α) git-am will throw a file-format error β) applying a diff works worse than a patch because git can't look down the history for renames and other changes that might have messed up the application of the diff but in a way that git could handle just fine.

    git apply your.diff has to be used if it's actually a diff and not a patch.

Note that patch/diff application may fail if the code it's being applied to has changed. Two things you can do in this case: 1. Resolve conflicts manually 2. Use git checkout … to find a version of XServer that works.

Further steps are out of scope of your question, but basically you then have to compile xserver with meson setup build --prefix=/usr […other options…] && ninja -C build, make a package of it (it's important, because otherwise a system update might overwrite files), then install it. Don't forget during meson configuration to pass --prefix=/usr option (like in the previous sentence). For an example of script that creates a package out of the build you can look the bottom of this answer, alternatively you can use checkinstall. For an example of meson-configuration options in XServer you can look up this block.

7
  • Thank you for your detailed answer! Just letting anybody interested in this topic know: I tried, seems like managed to build and install, but the bug is still here. Commented Mar 30, 2025 at 12:24
  • @ENIAC I did a cursory search over the report on freedesktop, someone claimed it is not a problem on Gnome Wayland. Did you try it? Commented Mar 30, 2025 at 14:20
  • I tested Wayland today (even installed a newer Nvidia driver that is claimed to have better support for Wayland) and that issue persists there (together with some additional issues not available in X). Commented Mar 30, 2025 at 14:27
  • By the way, in the thread you provided, it is mentioned that Wayland has the same issue. Commented Mar 30, 2025 at 15:15
  • As it was reminded here, GNOME and Wayland don't get fixed by the patch. Commented Mar 31, 2025 at 5:35

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.