GithubHelp home page GithubHelp logo

kryndex / swc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from michaelforney/swc

0.0 2.0 0.0 971 KB

A library for making a simple Wayland compositor

License: MIT License

Makefile 2.98% C 97.02%

swc's Introduction

swc

swc is a small Wayland compositor implemented as a library.

It has been designed primary with tiling window managers in mind. Additionally, notable features include:

  • Easy to follow code base
  • XWayland support
  • Can place borders around windows

Dependencies

  • wayland
  • wayland-protocols
  • libdrm
  • libinput (see my libinput repository if you don't want the libudev dependency)
  • libxkbcommon
  • pixman
  • wld
  • linux[>=3.12] (for EVIOCREVOKE)

For input hotplugging, the following is also required:

  • libudev

For XWayland support, the following are also required:

  • libxcb
  • xcb-util-wm

Implementing a window manager using swc

You must implement two callback functions, new_window and new_screen, which get called when a new window or screen is created. In new_window, you should allocate your own window window structure, and register a listener for the window's event signal. More information can be found in swc.h.

static void new_window(struct swc_window * window)
{
    /* TODO: Implement */
}

static void new_screen(struct swc_screen * screen)
{
    /* TODO: Implement */
}

Create a struct swc_manager containing pointers to these functions.

static const struct swc_manager manager = { &new_screen, &new_window };

In your startup code, you must create a Wayland display.

display = wl_display_create();

Then call swc_initialize.

swc_initialize(display, NULL, &manager);

Finally, run the main event loop.

wl_display_run(display);

An example window manager that arranges it's windows in a grid can be found in example/, and can be built with make example.

Why not write a Weston shell plugin?

In my opinion the goals of Weston and swc are rather orthogonal. Weston seeks to demonstrate many of the features possible with the Wayland protocol, with various types of backends and shells supported, while swc aims to provide only what's necessary to get windows displayed on the screen.

I've seen several people look at Wayland, and ask "How can I implement a tiling window manager using the Wayland protocol?", only to be turned off by the response "Write a weston shell plugin". Hopefully it is less intimidating to implement a window manager using swc.

How can I try out swc?

If you are not interested in developing your own window manager, check out my swc-based window manager, velox.

TODO

  • XWayland copy-paste integration.
  • Better multi-screen support, including mirroring and screen arrangement.
  • DPMS support.
  • Floating window Z-ordering.
  • Full-screen composite bypass.
  • Atomic modesetting support.

Contact

If you have questions or want to discuss swc feel free to join #swc on freenode.

Related projects

Since swc's creation, several other projects with similar goals have been created.

swc's People

Contributors

auntieneo avatar jezze avatar michaelforney avatar pr2502 avatar unknownloner avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.