181
COSMIC: The Road to Alpha (blog.system76.com)
submitted 5 months ago by mmstick@lemmy.world to c/linux@lemmy.ml
you are viewing a single comment's thread
view the rest of the comments
[-] avidamoeba@lemmy.ca 6 points 5 months ago

It doesn't use GTK does it?

[-] mmstick@lemmy.world 29 points 5 months ago* (last edited 5 months ago)

No, we have been making our own platform toolkit (libcosmic), which is built upon iced-rs. We are using this both for our wayland compositor applets, and our desktop applications.

[-] ExLisper@linux.community 7 points 5 months ago

iced? Interesting. I though it's still pretty experimental. There's no official documentation yet, right? When I was looking at Rust UI libraries Yew and Leptos looked more mature. I guess you're confident iced have enough backing and isn't going anywhere.

How do you find working in Rust on a bigger UI project? Any issues?

[-] mmstick@lemmy.world 9 points 5 months ago

Iced is a lower level GUI library, similar to what GDK is to GTK. We built our own COSMIC-themed GUI toolkit around iced, which is called libcosmic. As we've gotten more and more widgets and application logic developed, actual application development with libcosmic is a breeze. Even if you do have to create a custom widget, it's much easier to creating custom widgets in GTK. We're able to develop much faster than we ever could with GTK now.

Yew and Leptos aren't comparable since they're not native GUI toolkits. These are for web developers rather than application development. It wouldn't be possible to use this for developing layer shell applets for COSMIC, either.

[-] ExLisper@linux.community 3 points 5 months ago

This sounds really cool. I don't see any documentation for libcosmic. Are you planning to promote it as an alternative toolkit for building desktop apps or do you see it more as an internal tool strictly for COSMIC DE development?

[-] mmstick@lemmy.world 6 points 5 months ago
[-] devfuuu@lemmy.world 3 points 5 months ago

What's the accessibility story for blind users for example?

Is it going to be suitable to use with proper bindings with other languages or it's not an interest at this time or are there plans to support things like that and stability of apis, etc?

[-] mmstick@lemmy.world 2 points 5 months ago

We are integrating AccessKit into libcosmic for accessibility support.

If you want to develop applets and/or applications with libcosmic, you must do so with Rust. There are no plans to develop C bindings for libcosmic.

[-] mmstick@lemmy.world 3 points 5 months ago* (last edited 5 months ago)

You can generate documentation by running cargo doc and browsing the generated web pages in target/doc. There are also examples in the examples directory of libcosmic, as well as a design demo example which is a WIP.

libcosmic is an alternative toolkit for building desktop applications and layer shell applets. It wouldn't make much sense to build a toolkit only for ourselves. It's the best way to develop layer shell applets for COSMIC, and other Wayland compositors that support the layer shell protocol.

[-] Blisterexe@lemmy.zip 1 points 5 months ago

Btw, is this the only reason that cosmic isn't gtk, or are there other reasons? Because afiak gtk uses/can use rust.

[-] mmstick@lemmy.world 2 points 5 months ago* (last edited 5 months ago)

The GTK4 project was cancelled for multiple reasons. We originally began working on Relm4 to use GTK4 for COSMIC applets. While others on the team were also experimenting with alternative Rust GUI libraries.

It required a lot of effort to patch GTK4 to support the Wayland layer shell protocol. Getting those patches merged into GTK4 was also taking a much longer time. There were long delays between code reviews; and they also wanted a series of much larger refactoring changes to be made to GTK4 before exposing the layer shell feature. It was much easier to get layer-shell working with iced, as it is a much leaner and concise code base.

GTK does not support fractional scaling, which is something we want our applets to support on day one. This was one of our major concerns. A concern that didn't apply to iced.

It was also exceedingly difficult to create custom widgets with GTK in Rust. Even those of us with years of experience considered it to be unreasonably difficult. So it was not feasible to expect new hires on the team to be able to comfortably develop COSMIC components with it. In comparison, our team was able to develop custom widgets with iced with much less effort and with greater flexibility, so the demand for iced grew stronger.

At the end of the day, GTK is not a Rust toolkit, and its API is cumbersome to adapt to Rust. Use of GTK would always be a compromise that lessens the developer experience for COSMIC app and applet development. A compromise that would eventually require us to rewrite everything in a native Rust GUI library the moment it would become possible to do so.

Since we are developing a desktop environment from the ground up anyway, we decided that there would be much more value for our time if we contribute to the Rust ecosystem and utilize iced to make a fully featured GUI library for application development.

[-] Blisterexe@lemmy.zip 1 points 5 months ago* (last edited 5 months ago)

Makes sense, thank you for the detailed answer! By the way, I saw that gtk apps will be automatically themed, is that only gtk3 or also gtk4? Edit: typo

[-] mmstick@lemmy.world 1 points 5 months ago

We will be adding integrations to our theme engine to automatically generate themes for GTK3, GTK4, and libadwaita.

[-] Blisterexe@lemmy.zip 1 points 5 months ago

Great! Cant wait to try out cosmic, thank you for all the great work you guys have been doing!

[-] avidamoeba@lemmy.ca -3 points 5 months ago* (last edited 5 months ago)

Why develop libcosmic around iced instead of going with something else modern that's easy to develop in such as Flutter? Iced/libcosmic is probably a bit more efficient resource-wise but that probably wasn't a huge point.

[-] mmstick@lemmy.world 3 points 5 months ago* (last edited 5 months ago)

That would compromise our vision of a GUI platform built from the ground up in Rust. It would also not be feasible to use Flutter for applet development. We can easily make modifications directly to iced for all the Wayland integrations that we need in COSMIC, as the iced code base is very lean, and written in Rust.

[-] avidamoeba@lemmy.ca 1 points 5 months ago* (last edited 5 months ago)

Got it. So being written in Rust is one of the requirements. Makes sense. Flutter is great for self-contained applications but we can definitely use another sane native toolkit besides Qt that has wider applicability.

[-] avidamoeba@lemmy.ca 6 points 5 months ago* (last edited 5 months ago)

Beautiful, so there's a good chance for it to not be a hot mess! Looking forward to it. 😊

load more comments (14 replies)
this post was submitted on 11 Jan 2024
181 points (98.9% liked)

Linux

45457 readers
1393 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS