Jappie3 / vigiland

Inhibit idle behaviour of a Wayland compositor
GNU Affero General Public License v3.0
12 stars 1 forks source link

Features request #2

Open IceDBorn opened 4 months ago

IceDBorn commented 4 months ago

I have a similar project in mind, in which you'll be able to control various scenarios which should inhibit the system.

https://github.com/IceDBorn/IceDOS/blob/main/system/desktop/hyprland/modules/disk-watcher.nix https://github.com/IceDBorn/IceDOS/blob/main/system/desktop/hyprland/modules/cpu-watcher.nix https://github.com/IceDBorn/IceDOS/blob/main/system/desktop/hyprland/modules/network-watcher.nix https://github.com/IceDBorn/IceDOS/blob/main/system/desktop/hyprland/modules/pipewire-watcher.nix

My goal is to move all these scripts into a single application, which will run as a background service and inhibit the system based on your settings. You'll be able to set systemd to only inhibit suspend when your system has a download/upload speed higher than the threshold, for example. This is possible using systemd-inhibit.

With all that in mind, I'd love to contribute these features here, instead of making a new project from the ground up.

Jappie3 commented 3 months ago

Thank you for showing interest in this project! I'm gonna be honest - I think writing functionality like your Bash scripts in a language like Rust would massively overcomplicate things (not that I'm that experienced with Rust), Bash seems like a very good choice for getting random system information... My advice would be to call vigiland in your bash scripts rather than implementing your Bash scripts' functionalities in Rust.

Vigiland was a project I started to learn more about Rust & the Wayland protocol, it inhibits a compositor's idle behaviour through Wayland's idle-inhibit-unstable-v1 protocol. I don't know anyone using systemd-inhibit to achieve the same functionality on Wayland, and from a quick test it seems like running systemd-inhibit doesn't register an idle inhibitor (at least, not according to Hyprland's logs).

Last but not least: this project barely has 200 lines of code, a lot of it boilerplate. The only things it does are

Recreating this functionality in Rust (or any other language with decent Wayland bindings) would be trivial.

IceDBorn commented 3 months ago

I thought that the bindings would make this easier than the nightmare I had to go through with bash...

Jappie3 commented 3 months ago

With bindings I refer to being able to use libwayland in e.g. Rust, even though the library is written in C++ or something.

Doing idle inhibit (communicating via the Wayland protocol like Vigiland does) in Bash is indeed a nightmare, however I was talking about the functionality of deciding when to idle inhibit (e.g. when there's network or disk activity -> that's easily doable with Bash)

IceDBorn commented 3 months ago

That's what I meant too