Skills2026年5月5日·1 分钟阅读

Sway — i3-Compatible Tiling Window Manager for Wayland

Sway is a drop-in replacement for the i3 window manager that runs on Wayland, providing tiling layouts, workspaces, and full i3 config compatibility on the modern Linux display stack.

Agent 就绪

这个资产可以被 Agent 直接读取和安装

TokRepo 同时提供通用 CLI 命令、安装契约、metadata JSON、按适配器生成的安装计划和原始内容链接,方便 Agent 判断适配度、风险和下一步动作。

Needs Confirmation · 64/100策略:需确认
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Sway
通用 CLI 安装命令
npx tokrepo install a4eb0923-485a-11f1-9bc6-00163e2b0d79

Introduction

Sway implements the i3 window manager's features and configuration format on top of the Wayland display protocol. For developers moving from X11 to Wayland, Sway provides the same keyboard-driven tiling workflow with improved security, per-monitor scaling, and modern input handling.

What Sway Does

  • Tiles windows automatically in horizontal/vertical splits and tabbed/stacked layouts
  • Uses the same config syntax as i3 so existing dotfiles work with minimal changes
  • Supports multiple monitors with per-output scaling, rotation, and arrangement
  • Manages workspaces, scratchpad, floating windows, and fullscreen modes
  • Communicates with tools and scripts via an IPC socket compatible with i3ipc

Architecture Overview

Sway is built on wlroots, a modular Wayland compositor library. wlroots handles DRM/KMS output, libinput devices, and the Wayland protocol; Sway adds the tiling layout logic, config parser, and i3-compatible IPC server on top. Rendering uses the GPU directly via EGL without an intermediate X server.

Self-Hosting & Configuration

  • Install from distro repos; requires a Wayland-capable GPU driver
  • Copy default config: mkdir -p ~/.config/sway && cp /etc/sway/config ~/.config/sway/
  • Set keybindings, output resolution, input settings, and startup apps in the config file
  • Use swaymsg to control the compositor at runtime (same as i3-msg)
  • Pair with swaybar/waybar for a status bar and swaylock/swayidle for screen locking

Key Features

  • Near-complete i3 configuration compatibility
  • Native Wayland: better security (no X11 keylogging surface), smooth HiDPI
  • Per-output fractional scaling without blurry fonts
  • Criterion-based window rules for automatic tiling/floating/workspace assignment
  • Active ecosystem: waybar, wofi, wl-clipboard, grim+slurp for screenshots

Comparison with Similar Tools

  • i3 — the X11 original; Sway is the Wayland port with the same config
  • Hyprland — Wayland compositor with animations and eye candy; less stable for daily driving
  • river — minimal Wayland tiling WM configured via an external process
  • dwl — dwm-like Wayland compositor; requires source patching to customize
  • GNOME/KDE Wayland — full desktop environments; heavier, with floating-first UX

FAQ

Q: Can I reuse my i3 config file directly? A: Mostly yes. X11-specific directives (e.g., xrandr commands) need replacement with Sway equivalents.

Q: Do X11 apps work under Sway? A: Yes, via XWayland which is enabled by default.

Q: How do I take screenshots? A: Use grim for full screen or grim -g "$(slurp)" for region selection.

Q: Does Sway support NVIDIA GPUs? A: Experimental support exists with the proprietary driver (--unsupported-gpu flag). The open-source nouveau driver works out of the box.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产