Macchina-CLI / libmacchina

A library providing access to all sorts of system information.
https://crates.io/crates/libmacchina
MIT License
68 stars 20 forks source link

Added general detection for wayland compositors #164

Closed Absolpega closed 1 year ago

Absolpega commented 1 year ago

resolves #90

this is my first ever pull request

the code is based on this stack overflow answer https://stackoverflow.com/a/72755046

grtcdr commented 1 year ago

Thanks for the contribution!

I have a minor nitpick regarding the readout's output. It seems that /proc/<pid>/comm could end in a newline, which we will want to remove, otherwise the output may appear as shown in this next picture.

2023-08-28T15:20:35,385591814+01:00

Absolpega commented 1 year ago

oh yea i didn't notice that because my fetch removes any new lines when printing

grtcdr commented 1 year ago

We have extra::pop_newline that'll do this for you :)

Absolpega commented 1 year ago

i think a cleaner option would be String::trim()

Absolpega commented 1 year ago

on second thought String::trim returns &str

Absolpega commented 1 year ago

@grtcdr made the change

grtcdr commented 1 year ago

Thanks again, @Absolpega.

A future step should be to stylize (according to conventions) the different compositor names, this pull request doesn't need to implement that, but it'd be nice to have.