The code-wayland package provides a patch for the Visual Studio Code desktop entry (code.desktop) to enable better compatibility with Wayland-based systems. See VS Code should default to Wayland when possible and Blurry text under Wayland.
This package automatically modifies the code.desktop file whenever the code package is installed or updated, ensuring that Visual Studio Code runs with Wayland support using the appropriate --enable-ozone and --ozone-platform=wayland options.
- Automatic Patch Application: Automatically detects changes to the
code.desktopfile and re-applies the Wayland patch. - Trigger-Based: Uses Debian's trigger system to ensure that the patch is applied whenever the
codepackage is modified. - Manual Re-Patching Option: Provides a script that can be run manually if needed to re-apply the patch.
-
Make sure the
codepackage is installed on your system:sudo apt-get install code
-
Download and install the
code-waylandpackage:sudo dpkg -i code-wayland_<version>.deb
Replace
<version>with the appropriate version of thecode-waylandpackage. -
After installation, the package will automatically patch the
code.desktopfile to enable Wayland support using the--enable-ozoneflag.
The code-wayland package uses a Debian path interest-noawait trigger to watch for changes to the /usr/share/applications/code.desktop file. When the code package is installed or updated, this trigger activates the code-wayland patch script to modify the Exec entry in the desktop file.
-
Trigger File:
debian/triggersinterest-noawait /usr/share/applications/code.desktop -
Post-Installation Script:
debian/postinstThis script is executed whenever the
codepackage is modified. It runs thepatch-code-desktopscript to apply the necessary changes to the desktop file. -
Patch Script:
/usr/bin/patch-code-desktopThe patching script checks if the
Execline in/usr/share/applications/code.desktophas been modified to include the Wayland-specific flags (--enable-ozone --ozone-platform=wayland). If not, it updates the line accordingly:# Original Exec line: Exec=/usr/share/code/code # Patched Exec line: Exec=/usr/share/code/code --enable-ozone --ozone-platform=wayland
If you need to manually test or reapply the patch, you can trigger the reinstallation of the code package. This will cause the code-wayland package to reapply the patch automatically:
sudo apt-get install --reinstall codeThis command will trigger the code-wayland patch script to reapply the patch.
To confirm that the patch has been applied correctly, open the code.desktop file and look for the modified Exec line:
cat /usr/share/applications/code.desktop | grep ExecYou should see the following line (or a similar one):
Exec=/usr/share/code/code --enable-ozone --ozone-platform=wayland
To remove code-wayland from your system, use the following command:
sudo apt-get remove --purge code-waylandAfter removing the package, you may need to manually restore the original code.desktop file if it was modified:
sudo apt-get install --reinstall codeDpkgTriggers(in the Debian Wiki).deb-triggers(5)manpage.
This project is licensed under the GPL-3+ License. See the [LICENSE] file for more details.