Wprintidle: Print Idle Time in Wayland

Greetings! I thought I’d drop by and share a little project I’ve been working on to obtain the users idle time for Wayland environments, wprintidle.

Essentially, it is an xprintidle replacement for Wayland compositors that implement the ext-idle-notify protocol. That is, any compositor compatible with swayidle will work with wprintidle.

While I doubt such a utility will be of great use for Wayland, this was my first time mixing Zig with their protocols so I chose something on the simpler end. I had considered doing a re-write of swayidle outright, but again I wasn’t not convinced the effort was either wanted or necessary.

Feel free to provide criticism, undying praise, shouting, and/or insults :upside_down_face: Well, except for the over-engineered doc comments, I obviously had too much fun exploring autodoc.

4 Likes

I for one find it very interesting, I was considering dipping my toes into some Wayland and Zig development, but am rather inexperienced with the former, so the detailed comments and documentation is very much appreciated. This seems like a great project to use as a guide for the basics and a “real-world” example that isn’t too complicated with Wayland concepts that are over my head.

Thanks for sharing. :+1:

2 Likes

No problem, thanks for your feedback!

I think that’s a great point too. One of the struggles I had early on with this project was how few (maintained) examples there are.

To be fair, it’s not like there’s zero information - yet I felt like I spent way to much time in the weeds with basic memory problems in the case of grabbing the seat name from the compositor. The solution turned out to be pretty simple in the end, but not intuitive for me. Even if all I accomplished was saving someone else a lot of head-scratching I’m OK with that.