Skip to content

Example code of a Plasma widget using a Backend implemented in Rust

License

Notifications You must be signed in to change notification settings

brummer-simon/bcdt-rust_plasmoid_example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Black Cat Desktop Toys proudly presents: A Plasmoid (KDE6) with a backend written in Rust

Motivation

I like to develop in rust and as KDE user, I though at some point "I really would like to implement Plasmoids with Rust instead of C++". Then I searched for examples and howtos and did not find anything. Then I thought "It can't be that hard to do that", so ended up creating a PoC/this repo.

To get this to work, I basically merged code from three separate examples/project that solved parts of my problem.

I am standing here on the shoulders of giants so many thanks to:

What does it do?

It is a click counter widget, manipulating a counter maintained in the rust crate.

How does it work?

Since all QT bindings crate I tested either don't have a good ergonomics as soon as inheritance is required (and QT heavily relies on it) or just don't work then loaded as QML type in Plasma (KDE6), I've decided to not use Rust QT bindings.

Instead I implement the QT interfacing in C++, the inner logic in Rust and connect both worlds with bindings generated by CXX crate. Although it is the most verbose way to achieve my goal, it also is the most flexible way.

The rust part is build to a static library, linkend to the C++ part forming the plugin. All of this is built via CMake and the standard Plasmoid build mechanisms.

Build instructions

It is assumed that Rust, QT and KDE develop requirements are met and cxxbridge-cmd was installed via cargo install. The following make targets build and install the project: make build install

To run the build in a contained environment, run make viewer after installation.

About

Example code of a Plasma widget using a Backend implemented in Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published