How to Set Up Sway Window Manager on Arch Linux
The Sway window manager is a tiling Wayland compositor inspired by i3, offering a lightweight, keyboard-driven experience for Linux users. It’s an excellent choice for those who prefer minimalism, configurability, and performance. Here’s a step-by-step guide to setting up Sway on Arch Linux.
Prerequisites
Before diving into the installation, ensure you have the following:
A basic Arch Linux installation.
A working internet connection.
Familiarity with the terminal and text editors (like
nano
,vim
, ornvim
).
Step 1: Update Your System
First, update your system to ensure all packages are up-to-date. Open a terminal and run:
sudo pacman -Syu
Step 2: Install Sway
Sway is available in the Arch Linux official repositories, so installing it is straightforward:
sudo pacman -S sway
This command installs the core Sway package. However, you’ll need additional tools for a better experience.
Step 3: Install Recommended Utilities
Here are some additional utilities to enhance your Sway experience:
Wayland utilities: Tools like
wl-clipboard
for clipboard management andgrim
for screenshots.Status bar:
swaybar
comes with Sway, but tools likewaybar
provide more customization.Background manager:
swaybg
for setting a wallpaper.Application launcher:
wofi
orrofi-lbonn-wayland
(Wayland-compatible).Notification daemon:
mako
for system notifications.
Install them with:
sudo pacman -S swaybg waybar wofi mako grim wl-clipboard
Step 4: Configure Sway
Sway’s configuration file is located at ~/.config/sway/config
. If it doesn’t exist, you can copy the default configuration file as a starting point:
mkdir -p ~/.config/sway
cp /etc/sway/config ~/.config/sway/
Edit the configuration file to customize Sway. For example, to set a wallpaper using swaybg
, add this line:
exec swaybg -i /path/to/your/wallpaper.jpg -m fill
You can also configure keybindings, layout, and other settings in this file.
Step 5: Start Sway
Once configured, you can start Sway by typing:
sway
If you’re logging in from a display manager, make sure Sway is listed as a session option. Alternatively, you can start it from a TTY.
Step 6: Fine-Tune Your Environment
Set Up Wayland-Compatible Applications
Some X11 applications may not work out of the box on Wayland. Install xwayland
to enable compatibility for legacy applications:
sudo pacman -S xorg-xwayland
Adjust Fonts and Appearance
To set fonts and GTK themes, install gtk3
and lxappearance
:
sudo pacman -S gtk3 lxappearance
Use lxappearance
to tweak the appearance of GTK apps.
Configure Waybar
Waybar is a customizable status bar. Edit its configuration and style files located at ~/.config/waybar/config
and ~/.config/waybar/style.css
. For example:
{
"layer": "top",
"position": "top",
"modules-left": ["sway/workspaces", "clock"],
"clock": {
"format": "{:%Y-%m-%d %H:%M:%S}"
}
}
Step 7: Troubleshooting
Logs
If Sway fails to start or behaves unexpectedly, check the logs for debugging:
sway -d 2> sway.log
Input Issues
If your keyboard or mouse doesn’t work, ensure Wayland-compatible input drivers are installed:
sudo pacman -S libinput
Step 8: Autostart Sway
To start Sway automatically when you log in, add it to your ~/.bash_profile
:
if [ "$(tty)" = "/dev/tty1" ]; then
exec sway
fi
Conclusion
You’ve successfully set up the Sway window manager on Arch Linux! Sway offers a streamlined and efficient workflow for users who appreciate tiling window managers. From here, you can dive deeper into customizing your environment and making it uniquely yours.
Let me know how your setup goes or if you run into any issues—happy tiling!