Cpp-Sway: i3-compatible Wayland compositor

sway

English - 日本語 - Français - Українська - Español - Polski - 中文-简体 - Deutsch - Nederlands - Русский - 中文-繁體 - Português - Dansk - 한국어 - Română - Magyar - Türkçe - فارسی - Ελληνικά

sway is an i3-compatible Wayland compositor. Read the FAQ. Join the IRC channel (#sway on irc.libera.chat).

Release Signatures

Releases are signed with E88F5E48 and published on GitHub.

Installation

From Packages

Sway is available in many distributions. Try installing the "sway" package for yours.

Compiling from Source

Check out this wiki page if you want to build the HEAD of sway and wlroots for testing or development.

Install dependencies:

  • meson *
  • wlroots
  • wayland
  • wayland-protocols *
  • pcre
  • json-c
  • pango
  • cairo
  • gdk-pixbuf2 (optional: system tray)
  • scdoc (optional: man pages) *
  • git (optional: version info) *

* Compile-time dep

Run these commands:

meson build/
ninja -C build/
sudo ninja -C build/ install

On systems without logind nor seatd, you need to suid the sway binary:

sudo chmod a+s /usr/local/bin/sway

Sway will drop root permissions shortly after startup.

Configuration

If you already use i3, then copy your i3 config to ~/.config/sway/config and it'll work out of the box. Otherwise, copy the sample configuration file to ~/.config/sway/config. It is usually located at /etc/sway/config. Run man 5 sway for information on the configuration.

Running

Run sway from a TTY. Some display managers may work but are not supported by sway (gdm is known to work fairly well).

Comments

  • Add --no-wrap flag to next/prev[_on_output]
    Add --no-wrap flag to next/prev[_on_output]

    Jan 10, 2022

    • Description: Please add a --no-wrap flag to next, prev, next_on_output, prev_on_output. I have currently implemented this via a script, but it's noticeably slower than the native commands. Use case is to get quickly and reliably to the first resp. last workspace (on the output).
    enhancement 
    Reply
  • Windows with variable-size content won't keep the content scaled
    Windows with variable-size content won't keep the content scaled

    Jan 11, 2022

    • Sway Version: 1.6.1

    • Debug Log:

    • https://gist.github.com/Macellatore/e3b9f62c6e5553457f2cdbd05289fc2b
    • Configuration File:
    • https://gist.github.com/Macellatore/67030cda9a7884b9468f60d559100ab6
    • Disclaimer: It's been like this since a couple of months, it was working fine before. It's not limited to Youtube, i've seen it happen with other video services; i can't come up with other tests to see if it's limited to this Picture-in-Picture window or if it's more extensive.

    • Description:

    • Open a YouTube playlist with Firefox and start it (for example https://www.youtube.com/watch?v=8v_4O44sfjM&list=PL68wb3AGXtsk6DAap2HlzHa3xPwTcCX6g)
    • Use the button appearing on the right border of the video to put it in Picture-in-Picture mode
    • Using tiling mode, keep firefox on one side of the screen and the video on the other one: the video should fit the window size, like this: https://i.imgur.com/YPTRIn1.png
    • Using YouTube controls, skip to the next video

    Expected behaviour: next video should also be scaled to fit the window size Actual behaviour: video gets resized to its actual size, exceeding the window size if bigger or getting sent to the upper left corner if smaller: https://i.imgur.com/qDMp2rJ.png

    bug 
    Reply
  • `workspace=__focused__` criteria misbehaves on empty workspaces
    `workspace=__focused__` criteria misbehaves on empty workspaces

    Jan 11, 2022

    • Sway Version: 1.6.1

    • Debug Log: https://gist.github.com/821382383c92756d99ee3e3d1d029ee4 (reproduced with my usual config, but I've confirmed this is reproducible on the most minimal config to ever exist, of 0 bytes in size)

    • Configuration File: provided verbatim below:

      Yes, this is in fact an empty file. I reproduced it with /dev/null as a config.

    • Stack Trace: n/a, no crash

    • Description:

      1. Launch sway
      2. Launch an instance of foot (the exact app is not relevant here, but the example command is geared towards it) - and type something to make the window recognisable
      3. Move to a different, empty workspace (if you started on workspace 1 and only have one monitor, move to 2)
      4. Issue the following command (via keybind or swaymsg) exactly, word to word (the app_id and the tidbit after || can be adjusted for your app of choice): exec swaymsg '[app_id="foot" workspace=__focused__] focus' || foot
      5. Observe that instead of a new window on an empty workspace, you're being transferred to workspace 1 with your previous foot instance

      The exact command I listed above, as far as I understand Sway, is supposed to either find a window of my favorite terminal on the current workspace, or, if no such window is found, spawn a new window. This is a common thing in my workflow, where I keep an instance of a browser, an editor and a terminal on a workspace for each project I work on, and it's important for me to quickly jump between them. But additionally I also wanted to spawn a new window in case there is none and I accidentally closed the last, or this is a new workspace. I could work around that with a script that would check if the workspace is completely empty, but that complicates matters.

    bug 
    Reply
  • Sway crashes in wl_event_loop_dispatch
    Sway crashes in wl_event_loop_dispatch

    Jan 12, 2022

    • Sway Version:

      • swaymsg version 1.6.1
    • Debug Log:

      • I do not have a debug log at the moment, the crash just happened and I do not know how and when it will happen again.
    • Configuration File:

      • I do not think it is a configuration problem, but I can try to attach all the files if they are needed
    • Stack Trace:

      • Sway is installed without debug symbols enabled, but this is the output of bt full
    (gdb) bt full
    #0  0x00007f0f5c9061c8 in wl_event_loop_dispatch () at /usr/lib/libwayland-server.so.0
    #1  0x00007f0f5c903d37 in wl_display_run () at /usr/lib/libwayland-server.so.0
    #2  0x000055816038a97b in  ()
    #3  0x00007f0f5c619b25 in __libc_start_main () at /usr/lib/libc.so.6
    #4  0x000055816038acee in  ()
    
    • Errors:
      • Sway is launched with sway > sway.log 2>&1. My log file contains these lines related to the time of the crash.
    [011 17:40:42.468879] [glfw error 65544]: Wayland: fatal display error: Broken pipe
    (EE) failed to read Wayland events: Broken pipe
    Gdk-Message: 17:40:42.679: Error reading events from display: Broken pipe
    Exiting due to channel error.
    Exiting due to channel error.
    Exiting due to channel error.
    Exiting due to channel error.
    Exiting due to channel error.
    Exiting due to channel error.
    Exiting due to channel error.
    Exiting due to channel error.
    Exiting due to channel error.
    Exiting due to channel error.
    Exiting due to channel error.
    Exiting due to channel error.
    Exiting due to channel error.
    Exiting due to channel error.
    Exiting due to channel error.
    Exiting due to channel error.
    Exiting due to channel error.
    Exiting due to channel error.
    Exiting due to channel error.
    Exiting due to channel error.
    Exiting due to channel error.
    Exiting due to channel error.
    Exiting due to channel error.
    Exiting due to channel error.
    Exiting due to channel error.
    Exiting due to channel error.
    Exiting due to channel error.
    Sandbox: Unexpected EOF, op 2 flags 00 path /home/simone/.config/xkb
    Exiting due to channel error.
    Exiting due to channel error.
    Exiting due to channel error.
    Exiting due to channel error.
    Sandbox: Unexpected EOF, op 2 flags 00 path /usr/share/X11/xkb
    xkbcommon: ERROR: failed to add default include path /usr/share/X11/xkb
    Exiting due to channel error.
    Exiting due to channel error.
    Exiting due to channel error.
    Exiting due to channel error.
    (EE) could not connect to wayland server
    
    • Description:
      • I was just reading a PDF file from a PDF viewer running under wine.
    bug waiting-on-reporter 
    Reply
  • Glitches with the Gstreamer waylandsink
    Glitches with the Gstreamer waylandsink

    Jan 14, 2022

    Please fill out the following:

    • Sway Version:

      • sway version 1.8-dev-d6f8820a (Jan 15 2022, branch 'master')
    • Configuration File:

      • pretty much default (minus terminal and keyboard layout)
    • Description:

      • Running the gstreamer waylandsink (which uses subsurfaces and wp_viewporter) shows minor rendering artefacts when unmapping subsurfaces.
    • Full STR: (sorry a bit tedious)

    git clone [email protected]:gstreamer/gstreamer.git
    cd gstreamer
    meson build
    cd build
    ninja
    cd ..
    ./gst-env.py
    cd subprojects/gst-plugins-bad/tests/examples/waylandsink/
    ../../../../../build/subprojects/gst-plugins-bad/tests/examples/waylandsink/waylandsink
    
    • Click on "Ready" or "Null".
    • OR: black background remains visible and sometimes the area of it start to flicker until the window gets repainted - e.g. by changing focus.
    • ER: both the video and the black background should be gone instantly.

    Note 1: this works as intended on Weston and Mutter. Note 2: After clicking "Ready" or "Null", clicking on "Play" or "Pause" should remap the surfaces but currently doesn't. That's a bug fixed in https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1483. On current main, Sway behaves exactly as intended.

    bug 
    Reply
  • xwayland: re-focus on pointer focused surface on unmap
    xwayland: re-focus on pointer focused surface on unmap

    Jan 17, 2022

    When going up in submenus, the surface under the pointer should get focus. This allows menus in REAPER to work properly.

    Closes: #6324

    Reply
  • Popups in firefox >= 92.0b2 are broken with scale != 1
    Popups in firefox >= 92.0b2 are broken with scale != 1

    Aug 9, 2021

    • Sway Version:

      • sway version 1.6-d0fe721f (Aug 9 2021, branch 'master')
      • wlroots 88f65db87f8c6cc1f5598ef1b782a7cef6303dd2 (latest master at the moment)
    • Debug Log:

      • https://gist.github.com/b5378de60dcf1e60d083927446298ca5
      • exec firefox in a sway config, then clicked menu button, then pocket button
    • Description: Since firefox bugs are allowed now, let's report https://bugzilla.mozilla.org/show_bug.cgi?id=1722767 here. Popups (both menus and right-click) in the current firefox nightly are not visible in sway.

    bug firefox 
    Reply
  • Bounties for sway development
    Bounties for sway development

    Dec 12, 2016

    We are not currently accepting bounties

    Until we finish working on integrating Sway and wlroots, it is difficult to objectively judge how bounties should be categorized and paid out.


    So I've accepted donations for sway for a while now, and they've now accumulated to a fair sum. I was asked to put some of that towards beer and pizza (which was delicious), but the majority of it remains unspent. So let's spend it! I'd like to start a bounty program for sway to encourage the development of difficult/important features. Not all changes will be eligible for a bounty, but we'll have a few important issues (tracked in this GitHub thread) that will be. I also don't want to limit the bounty pools strictly to sway features - anything that improves the sway experience, even if it's in other projects in the ecosystem, can be considered for a bounty.

    Bounties are a great way to support specific features in Sway. If you'd like to support ongoing Sway maintenance in general, consider Patreon as well.

    Read this entire issue before you do anything related to bounties

    Funds

    Current balance: $1290

    Current bounties

    sway features

    • Real time video capture (https://github.com/SirCmpwn/sway/issues/1006): $125
    • ~~Layout save/restore (https://github.com/SirCmpwn/sway/issues/1005)~~ Invalid
    • ~~ARM support (https://github.com/SirCmpwn/sway/issues/143)~~ Invalid: problem is with proprietary drivers
    • ~~i3-style marks (https://github.com/SirCmpwn/sway/issues/1007)~~: $20 claimed by #1145
    • DPMS (https://github.com/SirCmpwn/sway/issues/541): $220
    • https://github.com/SirCmpwn/sway/issues/975: $20
    • Pointer constraints (https://github.com/SirCmpwn/sway/issues/1071): $50
    • https://github.com/SirCmpwn/sway/issues/892: $70
    • Touchscreen support via wlroots: $345
    • Keyboard layout per window: $50

    wlc features

    • ~~Redshift support (https://github.com/Cloudef/wlc/issues/174)~~: $50 claimed by #1019
    • https://github.com/Cloudef/wlc/issues/87: $50
    • ~~Fixing xdg protocol support (https://github.com/Cloudef/wlc/issues/204 https://github.com/Cloudef/wlc/issues/210)~~: $20 claimed by https://github.com/Cloudef/wlc/pull/227
    • Modesetting support (https://github.com/Cloudef/wlc/issues/37): $30
    • Drag and drop (https://github.com/Cloudef/wlc/issues/213): $30

    wlroots

    • xcape feature support: $100
    • Window borders: $100
    • Fractional scaling: $100
    • Selected Wayland protocol extensions*: $100
      • input-method, pointer-constraints, presentation-time, relative-pointer, idle_inhibit, xdg-output
    • (reserved for later): $100

    other

    • Tray icons (Xembed+StatusNotifierItem): $322
    • wayland/x11 clipboard sync damon: $50

    Contributing to a bounty

    If you'd like to fund support for a specific feature, donate normally and mention what you'd like your donation to go towards, and how you'd like to be credited in this issue (if at all):

    We are not currently accepting bounties

    Feel free to donate towards something there isn't already a bounty for - I'll add one for you.

    Awarding bounties

    A pull request that addresses a bounty will not be merged on that merit alone - it will go through the same review process as any other pull request. Anyone interested in claiming a bounty is strongly encouraged to stop by the sway IRC channel or open an issue discussing the problem further to make sure everyone's on the same page and work isn't wasted.

    If several people participate in a feature, the bounty will be split between them. The awardees can agree amongst themselves how to split the bounty. If an agreement can't be reached, I'll have the final say on how to distribute a bounty.

    A bounty will not be awarded for partial completion of a task - but once the task is completed, those who contributed partial solutions that contributed to the big picture will receive some of the bounty as described above.

    Bounties will be awarded via PayPal or Bitcoin, whichever is the preference of the awardee. You could also choose to give some or all of your reward back to other bounties.

    Reply
  • DPMS and lock handling
    DPMS and lock handling

    Apr 18, 2018

    This pull request adds DPMS and lock handling and requires some wlroots changes also, that is in a separate pullrequest for wlroots. This pullrequest have the following parts:

    • idle notifications on mouse and keyhandling
    • swayidle daemon that recieves idle notifications sends dpms commands and locks screen
    • modifications to output command, adding dpms

    Fixes #541

    Reply
  • Firefox popups not rendered on some multi-output setups
    Firefox popups not rendered on some multi-output setups

    Mar 30, 2021

    1. Setup one output on the left with scale=1, and one output on the right with scale!=1
    2. Start Firefox with its Wayland backend
    3. From time to time some popups will not be displayed (I think it happens more often with the addon popups when Firefox is displayed on the scale!=1 output). The clicks will still go through just fine.
    bug client-compat firefox 
    Reply
  • i3 feature support
    i3 feature support

    Aug 9, 2015

    Layouts

    • [x] Horizontal tiling
    • [x] Vertical tiling
    • [x] Stacked
    • [x] Tabbed
    • [x] Floating
    • [ ] ~~Saving layouts to disk~~ will not support
    • [ ] ~~Loading layouts from disk~~ will not support

    Config/commands

    • [x] Config parser
    • [x] Variables/set
    • [x] bindsym
      • [x] mouse bindings
      • [x] --release
    • [x] bindcode
      • [x] --release
    • [x] focus_follows_mouse
    • [x] exit
    • [x] exec
    • [x] exec_always
    • [x] fullscreen
    • [x] workspace
      • [x] left/right/up/down
      • [x] number
      • [x] next/prev
      • [x] next_on_output/prev_on_output
      • [x] <name>
      • [x] <name> output <output>
      • [x] back_and_forth
    • [x] splith/splitv
    • [x] focus
      • [x] left/right/up/down
      • [x] parent
      • [x] mode_toggle
    • [x] move
      • [x] left/right/up/down
      • [x] workspace to output
        • [x] left/right/up/down
        • [x] named output
      • [x] position
    • [x] kill
    • [x] mode
    • [x] layout
      • [x] stacking
      • [x] tabbed
      • [x] splith
      • [x] splitv
      • [x] toggle split
    • [x] bar
    • [x] floating toggle
    • [x] floating_modifier
    • [x] for_window
    • [x] font
    • [x] default_orientation
    • [x] workspace_layout
    • [x] assign
    • [x] popup_during_fullscreen
    • [x] force_focus_wrapping
    • [x] workspace_auto_back_and_forth
    • [x] scratchpad
      • [x] move scratchpad
      • [x] scratchpad show
    • [x] resize
      • [x] grow
      • [x] shrink
    • [x] move position mouse
    • [x] sticky toggle
    • [x] show_marks
    • [x] no_focus

    Features

    • [x] IPC
    • [ ] Restart in-place
    • [x] Reload config on the fly
    • [x] Resize containers with mouse
    • [x] Command line options
    • [x] Ignore i3 commands that aren't valid (i.e. force_xinerama)
    • [x] swaybar
    • [x] swaylock - usable, but incomplete
    • [x] swaymsg
    • [x] borders
    • [x] color customization
    • [ ] Mode_switch
    • [x] gaps
    • [x] [criteria] command

    See also:

    IPC feature support: https://github.com/SirCmpwn/sway/issues/98 i3bar feature support: https://github.com/SirCmpwn/sway/issues/343 i3-gaps feature support: https://github.com/SirCmpwn/sway/issues/307

    Reply
  • Jetbrains autocomplete popup loosing focus immediately
    Jetbrains autocomplete popup loosing focus immediately

    Oct 27, 2018

    Hi,

    When I do a "fuzzy search" ( Shift Shift ) or a "search file" ( Ctrl + N ), the popup appear and disappear in 1ms, I actually tried to uncheck "Hide navigation popups on focus loss" but it doesn't works :/.

    Has anyone ever encountered this problem?

    client-compat xwayland 
    Reply