How To Install sway on Ubuntu 22.04

In this tutorial we learn how to install sway on Ubuntu 22.04. sway is i3-compatible Wayland compositor

Introduction

In this tutorial we learn how to install sway on Ubuntu 22.04.

What is sway

sway is:

sway (SirCmpwn’s Wayland compositor) is a tiling Wayland compositor and a drop-in replacement for the i3 window manager for X11. It works with your existing i3 configuration and supports most of i3’s features, plus a few extras. This means it is a minimalist, tiling window manager.

There are three methods to install sway on Ubuntu 22.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install sway Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install sway using apt-get by running the following command:

sudo apt-get -y install sway

Install sway Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install sway using apt by running the following command:

sudo apt -y install sway

Install sway Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install sway using aptitude by running the following command:

sudo aptitude -y install sway

How To Uninstall sway on Ubuntu 22.04

To uninstall only the sway package we can use the following command:

sudo apt-get remove sway

Uninstall sway And Its Dependencies

To uninstall sway and its dependencies that are no longer needed by Ubuntu 22.04, we can use the command below:

sudo apt-get -y autoremove sway

Remove sway Configurations and Data

To remove sway configuration and data from Ubuntu 22.04 we can use the following command:

sudo apt-get -y purge sway

Remove sway configuration, data, and all of its dependencies

We can use the following command to remove sway configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge sway

References

Summary

In this tutorial we learn how to install sway package on Ubuntu 22.04 using different package management tools: apt, apt-get and aptitude.