swc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/swc
Log | Files | Refs | README | LICENSE

README.md (3331B)


      1 swc
      2 ===
      3 swc is a small Wayland compositor implemented as a library.
      4 
      5 It has been designed primary with tiling window managers in mind. Additionally,
      6 notable features include:
      7 
      8 * Easy to follow code base
      9 * XWayland support
     10 * Can place borders around windows
     11 
     12 Dependencies
     13 ------------
     14 * wayland
     15 * wayland-protocols
     16 * libdrm
     17 * libinput (on Linux only; see my
     18   [libinput repository](https://github.com/oasislinux/libinput) if you don't
     19   want the libudev dependency)
     20 * libxkbcommon
     21 * pixman
     22 * [wld](http://github.com/michaelforney/wld)
     23 * linux\[>=3.12\] (for EVIOCREVOKE) or NetBSD\[>=9.0\]
     24 
     25 For input hotplugging on Linux, the following is also required:
     26 * libudev
     27 
     28 For XWayland support, the following are also required:
     29 * libxcb
     30 * xcb-util-wm
     31 
     32 Implementing a window manager using swc
     33 ---------------------------------------
     34 You must implement two callback functions, `new_window` and `new_screen`, which
     35 get called when a new window or screen is created. In `new_window`, you should
     36 allocate your own window window structure, and register a listener for the
     37 window's event signal. More information can be found in `swc.h`.
     38 
     39 ```C
     40 static void new_window(struct swc_window * window)
     41 {
     42     /* TODO: Implement */
     43 }
     44 
     45 static void new_screen(struct swc_screen * screen)
     46 {
     47     /* TODO: Implement */
     48 }
     49 ```
     50 
     51 Create a `struct swc_manager` containing pointers to these functions.
     52 
     53 ```C
     54 static const struct swc_manager manager = { &new_screen, &new_window };
     55 ```
     56 
     57 In your startup code, you must create a Wayland display.
     58 
     59 ```C
     60 display = wl_display_create();
     61 ```
     62 
     63 Then call `swc_initialize`.
     64 
     65 ```C
     66 swc_initialize(display, NULL, &manager);
     67 ```
     68 
     69 Finally, run the main event loop.
     70 
     71 ```C
     72 wl_display_run(display);
     73 ```
     74 
     75 An example window manager that arranges it's windows in a grid can be found in
     76 example/, and can be built with `make example`.
     77 
     78 Why not write a Weston shell plugin?
     79 ------------------------------------
     80 In my opinion the goals of Weston and swc are rather orthogonal. Weston seeks to
     81 demonstrate many of the features possible with the Wayland protocol, with
     82 various types of backends and shells supported, while swc aims to provide only
     83 what's necessary to get windows displayed on the screen.
     84 
     85 I've seen several people look at Wayland, and ask "How can I implement a tiling
     86 window manager using the Wayland protocol?", only to be turned off by the
     87 response "Write a weston shell plugin". Hopefully it is less intimidating to
     88 implement a window manager using swc.
     89 
     90 How can I try out swc?
     91 ----------------------
     92 
     93 If you are not interested in developing your own window manager, check out my
     94 swc-based window manager, [velox](http://github.com/michaelforney/velox).
     95 
     96 TODO
     97 ----
     98 * XWayland copy-paste integration.
     99 * Better multi-screen support, including mirroring and screen arrangement.
    100 * DPMS support.
    101 * Floating window Z-ordering.
    102 * Full-screen composite bypass.
    103 * Atomic modesetting support.
    104 
    105 Contact
    106 -------
    107 
    108 If you have questions or want to discuss swc feel free to join #swc on
    109 [libera.chat](ircs://irc.libera.chat:6697).
    110 
    111 Related projects
    112 ----------------
    113 
    114 Since swc's creation, several other projects with similar goals have been
    115 created.
    116 
    117 - [wlc](https://github.com/Cloudef/wlc) and
    118   [orbment](https://github.com/Cloudef/orbment)
    119 - [waysome](https://github.com/waysome/waysome)
    120 - [wlroots](https://github.com/swaywm/wlroots)