Bspwm: On Wayland

Created on 15 Jan 2015  Â·  41Comments  Â·  Source: baskerville/bspwm

I'm just a bit curious what your thoughts are on Wayland, and if you'd be willing to consider porting/rewriting bspwm for Wayland?

Most helpful comment

If it happens, it would be a rewrite (probably in Rust) with a testable core.

All 41 comments

If so I wouldn't mind helping out, although I can't guarantee that I'll have all that much time to work on it.

It would have to be a pretty complete re-write and a fork. Unfortunately, sxhkd would have to be built-in to the window manager because wayland clients can't intercept key presses. Alternatively, you could build a pluggable compositor and dynamically load a window manager, key binding manager, and lock screen manager as plugins.

Personally, I'd use https://github.com/michaelforney/swc to provide the underlying wayland support.

I'd be very interested in a Wayland version.

Yes, please do this! :D

+1

If it happens, it would be a rewrite (probably in Rust) with a testable core.

:+1: :heavy_multiplication_x: :100: to rewriting bspwm in rust.

:+1: on this! :D

+1 for Rust

This would be very, very awesome. Another +1 for me. Any particular reason for rust? Just curious.

I'd like to point out that there's also a library on its way to the default Wayland distribution (not yet in 1.8 but likely in 1.9) called libweston. If I've understood correctly, it includes the building blocks to create a basic Wayland compositor, handle input etc. isolated from the Weston reference compositor. It includes, for example, a basic compositor code which every Wayland WM would otherwise have to reimplement.

I like Rust too. But what is the difference between rust and c? Isn't c faster a lot?

I like Rust too. But what is the difference between rust and c? Isn't c faster a lot?

We are talking about a window manager here. Many tasks of a window manager are triggered by user interaction, such as selecting a window or switching desktops. The difference in performance between Rust and C for tasks such as this lies in the range of a few milliseconds, I presume. Users don't notice that.

If you are talking about something like a webserver that has to handle as many requests per second as possible, then every bit of performance counts. If you are talking about a program that mostly reacts or signals events to a human user, you have the benefit of slow human reaction times.

I don't actually know the performance characteristics of Rust, but I would assume that it's faster than Python or Lua, which we know is fast enough for WMs.

More imporant would be the linking- and startup time (eg think of Java-programs such as Eclipse), but as Rust is pre-compiled I doubt that is much of an issue.

//edit: Also +1 for a wayland-version of bspwm

+1 for Rust.

We are talking about a window manager here. Many tasks of a window manager are triggered by user interaction, such as selecting a window or switching desktops. The difference in performance between Rust and C for tasks such as this lies in the range of a few milliseconds, I presume. Users don't notice that.

What about memory usage, a slight difference such as 100MB don't affect much but it may be a big difference for those whose RAM is less than 1GB.

I don't actually know the performance characteristics of Rust, but I would assume that it's faster than Python or Lua, which we know is fast enough for WMs.

I don't know about Lua, but I am sure Rust is a lot faster than Python.

And I hope the Rust can add more feature such as monocle when rewriting in Rust.

@pickfire

Rust has the same performance characteristics as C or C++. It's statically compiled, with manual memory management, using value types by default.

The biggest slow-down on the Rust side is mandatory array bounds checks, which are replaced by iterators which safely eliminate them most of the time.

Rust also has some features that have the potential to make it faster than C or C++- more control over pointer aliasing, and stronger safety when using pointers into other objects, which allow for more compiler optimizations and more easily maintained program optimizations.

Rust's compiler is, however, a lot newer than most C compilers, so while it does usually match/beat/approach C-level performance, there are still cases where it can be improved.

@rpjohnst

Thanks, I hope Rust some day will be successor of C and C++.

Well, would be awesome to have bspwm on Wayland.

+1

Can't offer much dev assistance, but I'd certainly be happy to test a Wayland version of bspwm.

For this to work, someone will need to start drawing up a spec. To my knowledge, creating things like an external hotkey daemon or a bar with Wayland is trickier because of how it deals with compositors.

The plans for libweston look promising – seems it could some day serve as a sane base for a small compositor without the need of reinventing the wheel (ie. doing the low level graphics stuff etc.). The plugin design is still an open question. Hopefully they'll come up with a good plugin interface – if I understand correctly, that's what we'd need to create external hotkey daemons etc. I'd say there's no rush to Wayland as there are things just like this that need some time to mature.

Of course, there are also swc and wlc, and sway is making great progress.

I would like to use velox too but the kernel doesn't have drm support.

I would also love to help out with something like this. bspwm + rust + wayland would be awesome!

Hm, NVIDIA drivers just added Wayland support today, seems things are nearing actual usability soon.

I'm kinda on the fence about this. On one hand, I'm not a huge fan of Wayland, specifically because of the reasons listed here that make programming for it so difficult, e.g. "sxhkd would have to be built-in to the window manager because wayland clients can't intercept key presses."

On the other hand, this is (apparently) a proposal to rewrite my favorite wm in my favorite language.

Not gonna say I know enough to make anything _close_ to bspwm, but I will say I have some experience using the XCB binding for Rust (from cloning wmutils and cloning swm). I'll definitely try to help out if this happens.

e.g. "sxhkd would have to be built-in to the window manager because wayland clients can't intercept key presses."

Yes and not at all. bspwm would only have to provide sxhkd with the keyboard events instead of sxhkd gathering it from X. That's more or less Wayland's way of doing things: the compositor has the last word, but it doesn't mean it has to do everything.

I don't know if freedesktop has arrived at any conclusions regarding hotkey daemons, but there could be be a cross-desktop standard interface for them.

Hi, there is a i3 -> Wayland rewrite going on (Sway). You may want to take a look on it, just in the case of still not.

+1 to bspwm on Wayland ::o:

+1 to bspwm in rust on Wayland! with the candlestick in the dining room...

@baskerville But when will development for it start?

Just going to chime in here with my experience making a Wayland compositor (and my current work of moving awesome over to Wayland).

If you want to use Rust, in terms of bindings the most stable and mature one right now is probably wlc.rs. It is bindings to wlc, which is the framework Sway (C), Way Cooler (Rust + Lua), and Fireplace (Rust) uses.

However, wlc is on life support right now, and while forks exist the majority of development is going to wlroots (which is spear headed by the Sway developer, but it's written in C). I plan to move Way Cooler over to wlroots and I'm experimenting with bindings while I wait for it to stabilize.

Another option is the one Fireplace is going with, Smithay which is a compositor framework written entirely in Rust. Development is a little slower with this, but once it is complete it will be more easy to verify as safe, be easier to use with Rust, and could potentially be used in a core Wayland implementation written in Rust (basically everybody uses the reference implementation, due to churn and it being the defacto reference to understanding Wayland in depth).

What if the rewrite was done in Haskell? There's even a Haskell implementation of the wayland protocol: https://github.com/abooij/sudbury

Also, for reference there are other tiling window managers for wayland in addition to sway such as http://way-cooler.org/ which is already written in Rust.

An update on using Rust to write a Wayland compositor for 2018:

if you want to use Rust, you two best options are either Smithay (though progress is slow, not sure how complete this is) or wlroots-rs (might still be buggy / have safety holes I haven't fixed, but is currently used by Way Cooler and is generally pretty solid).

There's currently a (very incomplete) guide using C here. I plan to write one for Rust later this year since it's a little different and I want to encourage others to use my Rust bindings 😉

It's not written in Rust but just in C, but in case any of you is interested in working on this, here's a repo you can join.

why not https://en.wikipedia.org/wiki/Dart_(programming_language) ?

One advantage of Rust over dart, is that it doesn't need any runtime while still enforcing type safety

As long as we're talking rewrites, a bspwm with 9P -- like wmii -- would be very cool.

Something to consider...

@Gingersnap1991 I don't think there's any point in implementing wmii as a part of bspwm, it could easily be created outside of it

@baskerville will you do this or are you doing?

Whats the status?

For those that are interested, there is a Wayland re-write going on over at SourceHut by Simon Zeni called bspwc. I don't believe it's in a usable state (or even close) but perhaps the community may be able to help. As it mentions in the README, there is an IRC for the project on Freenode, #bspwc.

Sadly it's been abandoned now

Was this page helpful?
0 / 5 - 0 ratings

Related issues

baskerville picture baskerville  Â·  3Comments

alecive picture alecive  Â·  7Comments

KGOH picture KGOH  Â·  5Comments

JKomoroski picture JKomoroski  Â·  5Comments

nebulaw2081d picture nebulaw2081d  Â·  4Comments