Skip to content

Animations

Tasos Sahanidis edited this page Jul 24, 2019 · 8 revisions

Using ckb-next animations

mviz (Music Visualizer)

on Linux with PulseAudio:

After adding the mviz animation, you will need to use the PulseAudio Volume Control utility pavucontrol to set the capture device.

Once pavucontrol is open, switch to the Recording tab. There you will see the ckb-next music visualizer listed. pavucontrol

Click on the dropdown located to the right, and select the device you want to use the visualizer on. Usually that will be one of the monitor ones, but you can also use it on microphones and line in. pavucontrol dropdown

on macOS or Linux with PortAudio:

macOS only: You need to install software that creates an input device that lets you record system audio. Such software is SoundFlower.

By default, the music visualiser will capture audio from the default device, most likely the microphone. Unfortunately, due to some limitations currently, the only way to choose a device is by incrementing the Device field in the visualiser settings. mviz settings dev id

0 is the default device. Each positive non-zero number corresponds to one of the audio capture devices available on the system.

pipe

This animation lets you control color assignments via external programs.

Usage

Example:

  • echo "rgb ff00ffff" > /tmp/ckbpipe000
  • echo "rgb space:00ff00ff" > /tmp/ckbpipe000

Syntax is either rgb <r><g><b><a> or rgb <k>:<r><g><b><a>:

  • <r> is the red value of the color in 2-digit hexadecimal notation
  • <g> is the green value of the color in 2-digit hexadecimal notation
  • <b> is the blue value of the color in 2-digit hexadecimal notation
  • <a> is the alpha value of the color in 2-digit hexadecimal notation
  • <k> is the optional key name you want to assign a color to
Specifically "<k>" corresponds to a led zone, which includes each individual key on a keyboard, the front and back panels of a mouse, or specific zones on a three-zone keyboard.

If you are really curious as to what zones your device has, check src/gui/keymap.cpp and check the third item in the Key struct.

Example

Show network status in number block

If you want to have a visual indicator on how your network is behaving you can use the pipe animation together with the ping command.

First, select the zones you would like to assign this animation to and then select the pipe animation via the "New animation..." button. You can assign a specific number to the pipe, so that in case you add multiple ones in a single profile they do not conflict with each other.

ckb-next gui showing a keyboard selection

ckb-next pipe animation settings dialog

After setting up the animation in the ckb-next GUI, run the following command in a terminal:

while true; \
do \
    ping -c1 1.1.1.1 &>/dev/null \
        && echo "rgb 00ff00ff" > /tmp/ckbpipe000 \
        || echo "rgb ff0000ff" > /tmp/ckbpipe000; \
    sleep 0.3; \
done;

This will assign either green or red to your selected zones, depending on whether ping exitted successfully or not respectfully.

Show project working tree status

If you'd like to visually represent the current software project you are working on, you can combine the pipe animation with the git program.

First, select the zones you would like to assign this animation to and then select the pipe animation via the "New animation..." button. Assign a number to the ckbpipe name if you already have other pipe animations.

ckb-next pipe animation settings dialog

After setting up the animation in the GUI, run the following command in the project you would like to monitor:

while true; \
do \
    [[ -z $(git status --porcelain) ]] \
        && echo "rgb 00ff00ff" > /tmp/ckbpipe001 \
        || echo "rgb cc0055ff" > /tmp/ckbpipe001; \
    sleep 5; \
done;

Optionally, you can assign individual keys to show whether new files were created:

while true; \
do \
    [[ -n $(git status --porcelain | grep "^??") ]] \
        && echo "rgb space:0000ffff" > /tmp/ckbpipe001 \
        || echo "rgb space:5500ccff" > /tmp/ckbpipe001; \
    sleep 2.5; \
done;

Both of these commands inspect the result of git status --porcelain. They either set the whole keyboard green/red, depending on whether the working directory is clean/dirty respectively, or only the space key blue/purple when a new file exists in the working directory