Sway中文维基

Sway中文维基#

Sway不是X11窗口管理器!配置时请仔细阅读文档。

安装前#

Nvidia用户#

不支持所有专有图形驱动程序,包括英伟达专有驱动程序。可以改用开源的Nouveau驱动程序。提示:购买硬件时要考虑开源支持。

登陆管理器#

一些登录管理器支持Wayland,而另一些则不支持。如果您在启动sway时遇到问题,并且您使用了登录管理器,那么您的第一步应该是禁用登录管理器并按照man 1 sway所述运行sway。如果它有效,请向您的登录管理器反馈bug,而不是向Sway反馈。

可用的登陆管理器列表如下:

  • greetd - 一款轻量并灵活的登录管理器
    • gtkgreet - 一款基于gtk的轻量登录管理器
    • qtgreet - 一款基于qt的登录管理器
    • tuigreet - 一款简单的图形终端登录管理器
    • wlgreet - wayland登录管理器
  • emptty - dead simple CLI Display Manager on TTY
  • Ly - 一款轻量级的基于文本用户界面(类似 ncurses)的显示管理器
  • autologin - 自动登录到已配置的账户;对于单用户且采用其他启动认证方式(如加密硬盘)的计算机而言,这一功能堪称完美。

您可以在没有登录管理器的情况下自动启动sway,例如,将以下代码添加到您的.bash_profile(BASH)、.zlogin或.zprofile(ZSH)中 :

# If running from tty1 start sway
[ "$(tty)" = "/dev/tty1" ] && exec sway

对于Fish Shell, 创建文件~/.config/fish/conf.d/sway.fish写入以下内容

# If running from tty1 start sway
set TTY1 (tty)
[ "$TTY1" = "/dev/tty1" ] && exec sway

配置Sway#

建议的Sway配置文件存放位置为~/.config/sway/config,开始配置sway前,建立该目录并拷贝默认配置文件到此处。

Debian12安装Sway

2025/02/13:推荐参考Sway完整桌面配置手册,这是一份完整的sway安装配置使用手册。

选取 debian-11.5.0-amd64-netinst 镜像,安装基础系统(Base)。

升级Debian12#

sudo sed -i -e 's/bullseye/bookworm/g' /etc/apt/sources.list
sudo apt update
sudo apt upgrade 
sudo apt full-upgrade

安装sway#

sudo apt install sway swaybg swayidle swaylock foot wofi seatd waybar xwayland neofetch grim wlogout

设置自动启动sway

编辑 ~/.profile加入以下内容即可:

if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then
  exec sway
fi

配置sway#

mkdir -p ~/.config/sway
cp /etc/sway/config ~/.config/sway/

编辑~/.config/sway

配置程序启动器#

注释掉$menu行,改为以下内容:

set $menu wofi --show=drun --lines=6 --prompt=""

设置终端(foot)字体大小

vi /etc/xdg/foot/foot.ini

font=monospace:size=12

设置退出菜单(waylogout)#

~/.config/sway/config加入以下内容

bindsym $mod+p exec wlogout

以下为旧内容,请注意软件版本!!!#

推荐使用Quantum’s sway-utils Repository来安装Sway,项目地址为 https://apt.quantum2.xyz/sway-utils/

安装步骤#

添加key#

curl https://quantum5.ca/apt.key | sudo apt-key add -

添加apt源#

将以下内容添加至/etc/apt/sources.list

Ubuntu安装Sway

Sway on Ubuntu#

Installation guide for the latest sway version on Ubuntu 20.04

Source can be found on github

Introduction#

This guide aims to be an easy to follow and straightforward way to install the master version of Sway and the wlroots dependency.

It will then extend to useful projects you might want installed for a complete desktop experience. Example Sway Setup Example of Customized Sway setup (dotfiles)

Why on Ubuntu ?#

If you want to try out this wonderful window manager and you are used to Ubuntu you don’t have to make the jump directly, you can install sway and changing between Gnome and Sway will be a matter of logging out and selecting which one to boot. Desktop Selector