cm-rgb icon indicating copy to clipboard operation
cm-rgb copied to clipboard

Add GUI for cm-rgb-monitor

Open groovykiwi opened this issue 4 years ago • 24 comments

Thank you for merging my original script, I'm glad it could be useful ! I updated the original a bit (mainly cleaning it) and made another script for cm-rgb-monitor this time.
The "Open CM-RGB" button requires the cm-rgb-gui script to be in a PATH folder, I don't really know how the installation is setup but it should be pointed out. Also, the script probably won't run on anything other than Linux as I used some basic commands (cut, sed) and bashism.

groovykiwi avatar Jun 28 '20 16:06 groovykiwi

Awesome work!

Take a look at the current cm-rgb-monitor we have couple of new features which may benefit from your gui.

gfduszynski avatar Jun 28 '20 17:06 gfduszynski

I just checked the new features and the CPU frequency is really handy. I'll work on adding it to the script ! However, the mirage function didn't work for me. I guess I need to specify the fan speed source, but how can I list the sources?

groovykiwi avatar Jun 28 '20 17:06 groovykiwi

Try cm-rgb-monitor --list-temp-sources (I know, super intuitive :smile:) There is a section for fan speed sensors. I have an issue with drivers on my motherboard and I was unable to test this feature.

gfduszynski avatar Jun 28 '20 17:06 gfduszynski

Ok, I think it works? But apparently I don't have any fan speed sensors or it doesn'T pick them up. Also it means that I have to update my script to take into consideration the new lines that come after the temperature sensors.

groovykiwi avatar Jun 28 '20 17:06 groovykiwi

Try running sensors and see if your system recognizes any fans.

Underlying code is very simple and I think it may be better to actually duplicate it rather than parse the output.

def print_available_sources(ctx,value):
    if value:
        print("Available sensors:")
        sensorDict = psutil.sensors_temperatures()
        for chipname, chip in sensorDict.items():
            for feature in chip:
                print(chipname + "/" + feature.label," -> ", feature.current)
                
        print("Available fan speed sensors for mirage:")
        fanDict = psutil.sensors_fans()
        for chipname, chip in fanDict.items():
            i = 0
            for feature in chip:
                print(chipname + "/" + str(i)," -> ", feature.current)

        ctx.exit()

gfduszynski avatar Jun 28 '20 17:06 gfduszynski

No the sensors command doesn't return any fans meaning it's an issue from my end.

I came up with cm-rgb-monitor --list-temp-sources | sed -n '/Available sensors:/d ; /Available fan.*/q;p' | cut -d' ' -f1 to parse it.
Since it's a GUI I don't really want the user to be reliant on my script to troubleshoot it if something goes wrong. That's your job ;)

groovykiwi avatar Jun 28 '20 18:06 groovykiwi

Fair enough :)

gfduszynski avatar Jun 28 '20 18:06 gfduszynski

Functionally this looks fine, however I imagine people would like to run run monitor as a systemd service or whatever the windows has. In order to join those 2 things together monitor would have to have an ability to load the settings from config file i guess.

I have to think this through and see how other apps do it.

My current setup is saved led config that is activated when my pc is booting with breathing mode on fan and ring. This is taken over by the service as soon as usb device becomes available to the system. As a whole I think this looks very nice and your gui would make it very easy to set up.

I'll have some time on the next weekend and I hope to come up with something.

gfduszynski avatar Jun 28 '20 18:06 gfduszynski

A great idea ! I could also make the gui create a config file and save it. It would be easy since I already have all the inputs.

groovykiwi avatar Jun 28 '20 18:06 groovykiwi

I added support for all the new features.
But I encountered an issue while running cm-rgb-cli, the fan rgb blinks continuously when I set a color using cm-rgb-cli. The breathing works fine but its blinking while doing it.
There's no issue with the logo or the ring, and running cm-rgb-monitor seemingly fixes it (until exited)
On windows using the official software there's this issue is not present. I'm really confused it just appeared out of nowhere.

groovykiwi avatar Jun 28 '20 21:06 groovykiwi

Interval might be to small it was changed recently, it can be changed using argument.

gfduszynski avatar Jun 29 '20 07:06 gfduszynski

Thanks for the answer, if I set the color and mode with the cli and then set the interval with monitor and exit its fixed. I couldn't seem to find an interval option in cm-rgb-cli tho.

groovykiwi avatar Jun 29 '20 07:06 groovykiwi

That's great to hear. Regarding CLI that is correct, it sends it's settings once so there is no need for an interval.

gfduszynski avatar Jun 29 '20 13:06 gfduszynski

Where are the initial settings stored? Because the blinking is constant when I use cm-rgb-cli alone, the workaround is pretty tedious too. I was looking through the code and I noticed the new effects for the ring, do you think they could be implemented to the fan ?

groovykiwi avatar Jun 29 '20 13:06 groovykiwi

If I remember correctly on the original app from the manufacturer fan and ring have different modes available and I can't do much about it.

As for the blinking with the cli, could you perhaps do a short video + executed command ?

gfduszynski avatar Jun 29 '20 14:06 gfduszynski

Alright I'll do it later today

groovykiwi avatar Jun 29 '20 14:06 groovykiwi

$ cm-rgb-cli set logo --mode=static --color=ffffff --brightness=5 fan --mode=static --color=ff0000

GIF-200629_231627

$ cm-rgb-cli set logo --mode=static --color=ffffff --brightness=5 fan --mode=static --color=ff0000 save
$ cm-rgb-monitor
^C
Aborted!
$

GIF-200629_233317

groovykiwi avatar Jun 29 '20 20:06 groovykiwi

That is so weird ! I bet this is a bug with mirage support, this is most likely very low frequency mirage on red channel. Try fiddling with those arguments you should see a change. I'm pretty sure I'm not properly clearing those settings out.

gfduszynski avatar Jun 29 '20 22:06 gfduszynski

Also please run cm-rgb-cli version perhaps you have slightly different firmware version; worth checking out.

gfduszynski avatar Jun 29 '20 22:06 gfduszynski

You were right, maxing the mirage frequencies fixes the issue. The default of 0 was causing the problem.

groovykiwi avatar Jun 29 '20 22:06 groovykiwi

I'll have to recreate this on my setup and fix this. I'm done for today, rough day :) Good day to you.

gfduszynski avatar Jun 29 '20 22:06 gfduszynski

I've isolated the issue to the cli script. Turns out when you don't specify mirage frequency instead of default 0hz click clamps the value to 3hz.

gfduszynski avatar Jun 30 '20 19:06 gfduszynski

There is new version available with fix in place

gfduszynski avatar Jun 30 '20 19:06 gfduszynski

Yes it is fixed, nice job !

groovykiwi avatar Jun 30 '20 21:06 groovykiwi