{"id":13440287,"url":"https://github.com/michaelforney/swc","last_synced_at":"2025-04-13T05:06:39.609Z","repository":{"id":8950253,"uuid":"10686699","full_name":"michaelforney/swc","owner":"michaelforney","description":"a library for making a simple Wayland compositor","archived":false,"fork":false,"pushed_at":"2024-05-19T15:59:18.000Z","size":1134,"stargazers_count":641,"open_issues_count":17,"forks_count":52,"subscribers_count":29,"default_branch":"master","last_synced_at":"2025-04-13T05:06:30.432Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michaelforney.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-06-14T10:21:36.000Z","updated_at":"2025-03-26T16:47:14.000Z","dependencies_parsed_at":"2024-01-07T00:07:03.813Z","dependency_job_id":null,"html_url":"https://github.com/michaelforney/swc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelforney%2Fswc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelforney%2Fswc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelforney%2Fswc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelforney%2Fswc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaelforney","download_url":"https://codeload.github.com/michaelforney/swc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248665748,"owners_count":21142123,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T03:01:21.358Z","updated_at":"2025-04-13T05:06:39.588Z","avatar_url":"https://github.com/michaelforney.png","language":"C","funding_links":[],"categories":["C","Libraries"],"sub_categories":[],"readme":"swc\n===\nswc is a small Wayland compositor implemented as a library.\n\nIt has been designed primary with tiling window managers in mind. Additionally,\nnotable features include:\n\n* Easy to follow code base\n* XWayland support\n* Can place borders around windows\n\nDependencies\n------------\n* wayland\n* wayland-protocols\n* libdrm\n* libinput (on Linux only; see my\n  [libinput repository](https://github.com/oasislinux/libinput) if you don't\n  want the libudev dependency)\n* libxkbcommon\n* pixman\n* [wld](http://github.com/michaelforney/wld)\n* linux\\[\u003e=3.12\\] (for EVIOCREVOKE) or NetBSD\\[\u003e=9.0\\]\n\nFor input hotplugging on Linux, the following is also required:\n* libudev\n\nFor XWayland support, the following are also required:\n* libxcb\n* xcb-util-wm\n\nImplementing a window manager using swc\n---------------------------------------\nYou must implement two callback functions, `new_window` and `new_screen`, which\nget called when a new window or screen is created. In `new_window`, you should\nallocate your own window window structure, and register a listener for the\nwindow's event signal. More information can be found in `swc.h`.\n\n```C\nstatic void new_window(struct swc_window * window)\n{\n    /* TODO: Implement */\n}\n\nstatic void new_screen(struct swc_screen * screen)\n{\n    /* TODO: Implement */\n}\n```\n\nCreate a `struct swc_manager` containing pointers to these functions.\n\n```C\nstatic const struct swc_manager manager = { \u0026new_screen, \u0026new_window };\n```\n\nIn your startup code, you must create a Wayland display.\n\n```C\ndisplay = wl_display_create();\n```\n\nThen call `swc_initialize`.\n\n```C\nswc_initialize(display, NULL, \u0026manager);\n```\n\nFinally, run the main event loop.\n\n```C\nwl_display_run(display);\n```\n\nAn example window manager that arranges it's windows in a grid can be found in\nexample/, and can be built with `make example`.\n\nWhy not write a Weston shell plugin?\n------------------------------------\nIn my opinion the goals of Weston and swc are rather orthogonal. Weston seeks to\ndemonstrate many of the features possible with the Wayland protocol, with\nvarious types of backends and shells supported, while swc aims to provide only\nwhat's necessary to get windows displayed on the screen.\n\nI've seen several people look at Wayland, and ask \"How can I implement a tiling\nwindow manager using the Wayland protocol?\", only to be turned off by the\nresponse \"Write a weston shell plugin\". Hopefully it is less intimidating to\nimplement a window manager using swc.\n\nHow can I try out swc?\n----------------------\n\nIf you are not interested in developing your own window manager, check out my\nswc-based window manager, [velox](http://github.com/michaelforney/velox).\n\nTODO\n----\n* XWayland copy-paste integration.\n* Better multi-screen support, including mirroring and screen arrangement.\n* DPMS support.\n* Floating window Z-ordering.\n* Full-screen composite bypass.\n* Atomic modesetting support.\n\nContact\n-------\n\nIf you have questions or want to discuss swc feel free to join #swc on\n[libera.chat](ircs://irc.libera.chat:6697).\n\nRelated projects\n----------------\n\nSince swc's creation, several other projects with similar goals have been\ncreated.\n\n- [wlc](https://github.com/Cloudef/wlc) and\n  [orbment](https://github.com/Cloudef/orbment)\n- [waysome](https://github.com/waysome/waysome)\n- [wlroots](https://github.com/swaywm/wlroots)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelforney%2Fswc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaelforney%2Fswc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelforney%2Fswc/lists"}