
Sublime 3 Working Under Wayland
Sublime is a great editor, but I truly liked its version 3 and have not migrated to version 4. I also had it setup for development with all necessary code extensions and when v4 was released most of these extensions (PHP, Lua, HTML, code formatting, code help etc.) were not available.
So I stayed with Sublime 3 and have been using without issues. However after switching to a new computer, the editor started to have intermittent issues suddenly. The main menu would pop up in different place than clicked, i.e. mouse click would be registered in wrong location. Also some weird blurry interlaced mangling of new windows would happen when opening a recent project over an existing window.
Sublime3 and Wayland
All this comes to using Sublime v3 editor under Wayland. I used X11 before and it played nicely with that, but Wayland clearly brought some backward incompatible changes. Since Sublime3 has not been updated for way over 4 years, there are some incompatibilities under Wayland.
How to resolve menu mouse click to correct position?
You can either switch to X11, but that is often a unwanted switch. But one solution that I have tested and works is launching sublime with this option:
GDK_BACKEND=x11 subl
This ensures that sublime is provided a backward compatible X11 backend specifically while you continue to run Wayland.
I recommend editing /usr/bin/subl file and change it to this (with added option in bold):
#!/bin/sh
GDK_BACKEND=x11 exec /opt/sublime_text/sublime_text --fwdargv0 "$0" "$@"
I also recommend you to change an existing desktop menu launcher to include this option in front of actual sublime editor path.
After this change Sublime 3 works fine and mouse clicks register in correct location. Also the context window will pop up correctly as some people complained about incorrect location behavior as well.
The only downside seems to be that on right click the cursor changes to X for context menu, but that’s a cosmetic annoyance.