ckb-next / ckb-next

RGB Driver for Linux
GNU General Public License v2.0
3.27k stars 270 forks source link

Command line interface #54

Open ckb-next-bot opened 6 years ago

ckb-next-bot commented 6 years ago

Issue by blshadow Monday Jan 08, 2018 at 17:45 GMT Originally opened as https://github.com/mattanger/ckb-next/issues/376


Hi. It is possible to control the keyboard from cli? It would be nice (for example, automate switching color profile, or for notifications), but I'm not find any documentation how to do it.

ckb-next-bot commented 6 years ago

Comment by OvermindDL1 Monday Jan 08, 2018 at 18:37 GMT


As I recall you can send raw text commands to the proper /dev/* devices, so it is as simple as echo "blah" > /dev/input/ckb#/cmd or something like that, like on my computer:

╰─➤  cd /dev/input
╰─➤  cat ckb0/connected 
/dev/input/ckb1 0702200EAE3E14A053BC1323F5001945 Corsair K95 RGB Gaming Keyboard
/dev/input/ckb2 04021031AEBA042055F2DF02F5001943 Corsair Gaming SCIMITAR RGB Mouse
╰─➤  cat ckb0/version  
v0.2.8
╰─➤  cat ckb1/features 
corsair k95 rgb pollrate bind notify fwversion fwupdate
╰─➤  cat ckb2/features 
corsair scimitar rgb pollrate adjrate bind notify fwversion fwupdate
╰─➤  echo 'iauto scroll' > ckb1/cmd

And so forth. It's all detailed at: https://github.com/mattanger/ckb-next/wiki/CKB-Daemon-Manual

:-)

ckb-next-bot commented 6 years ago

Comment by blshadow Monday Jan 08, 2018 at 19:40 GMT


Thank you!

ckb-next-bot commented 6 years ago

Comment by blshadow Monday Jan 08, 2018 at 20:30 GMT


It's not possible to change color if ckb user application is active and mode with animation is selected.

ckb-next-bot commented 6 years ago

Comment by ZirconiumX Monday Jan 08, 2018 at 20:38 GMT


The daemon has no way of communicating to the GUI that the colour has been changed by somebody else, so you end up with a desynchronization between the two.

ckb-next-bot commented 6 years ago

Comment by blshadow Monday Jan 08, 2018 at 20:46 GMT


Then it would be nice to be able to control a ckb application from cli.

ckb-next-bot commented 6 years ago

Comment by ZirconiumX Tuesday Jan 09, 2018 at 11:45 GMT


I'll see what I can do, then. It's entirely possible it won't work alongside the GUI, but that's up to you.

ckb-next-bot commented 6 years ago

Comment by blshadow Tuesday Jan 09, 2018 at 13:51 GMT


Thanks.

ckb-next-bot commented 6 years ago

Comment by OvermindDL1 Tuesday Jan 09, 2018 at 15:35 GMT


@ZirconiumX It would actually be nice if the GUI could 'suspend' it's operations when something else is using it, or if the something else would override the GUI settings until they reset it back to whatever the GUI is doing.

ckb-next-bot commented 6 years ago

Comment by ZirconiumX Tuesday Jan 09, 2018 at 17:55 GMT


@OvermindDL1 And how do you plan to detect that? We can't, at the moment.

ckb-next-bot commented 6 years ago

Comment by fleischie Tuesday Jan 09, 2018 at 18:16 GMT


I once started implementing a cli for ckb. It initially was supposed to start and controlthe GUI in the background.

It was scrapped at some point (i think) but I can't remember exactly why. It was a convincing reason enough to do so, though.

ckb-next-bot commented 6 years ago

Comment by OvermindDL1 Tuesday Jan 09, 2018 at 18:57 GMT


@ZirconiumX There is a notification built into the driver, have it send a notification when something sends a command that uses, say, a unique key or PID. If a key you could 'key' commands with a prefix to a command, so something like <key> <cmd>... so the ckb gui itself could be keyed like ckb <cmd>..., anytime something uses a new key then a notification is sent on a notify pipe.

/me is bikeshedding about the above, is not happy about the API, would prefer a connection to be established via holding a pipe open

I'm actually curious about having other programs send, say, alerts to the keyboard, so it can do a red pulse along it from the center out when an alert happens, but otherwise it continue normal operations (say back to my blue background).

ckb-next-bot commented 6 years ago

Comment by ZirconiumX Tuesday Jan 09, 2018 at 19:24 GMT


If we're going for that, we might as well just make it a dbus daemon and be done with it.

ckb-next-bot commented 6 years ago

Comment by ZirconiumX Wednesday Jan 10, 2018 at 10:53 GMT


...Judging by the reactions on that, you thought I was being serious.

Guess we should add that to the long, long list of issues I have to do. ;~;

ckb-next-bot commented 6 years ago

Comment by OvermindDL1 Wednesday Jan 10, 2018 at 15:14 GMT


...Judging by the reactions on that, you thought I was being serious.

Lol, not a bad idea though, and making DBus daemons is not a hard thing by any stretch (though still non-trivial). ^.^;

ckb-next-bot commented 6 years ago

Comment by ZirconiumX Wednesday Jan 10, 2018 at 18:01 GMT


@tatokis disagrees, quoting VLC devs for "if you use the library directly, you're in for a rough time".

The plan might be to have the GUI dbus-controllable.

ckb-next-bot commented 6 years ago

Comment by OvermindDL1 Wednesday Jan 10, 2018 at 18:11 GMT


The plan might be to have the GUI dbus-controllable.

As long as it all allows temporary modifications, like a program causing a single red pulse to go out over the keyboard when a notification comes in. :-)