Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cava: Add format_silent option and css triggers #3523

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

S0nter
Copy link

@S0nter S0nter commented Aug 14, 2024

This PR adds format_silent config option; updated and silent css triggers.

Explanation:

  • If format_silent is set and hide_on_silence is set to false and audio has not been playing for sleep_timer seconds, then cava module will be showing format_silent string until audio starts playing.
  • #cava.updated triggers when a new frame is shown
  • #cava.silent triggers when there has been no audio for sleep_timer seconds

When this PR gets merged, I will write documentation for these options

@Alexays if there is anything wrong with this PR, please point it out

@S0nter S0nter changed the title Add format_silent to cava module Add format_silent configuration and .silent css to cava module Aug 14, 2024
@S0nter S0nter changed the title Add format_silent configuration and .silent css to cava module Add format_silent configuration and .silence css to cava module Aug 14, 2024
@S0nter S0nter changed the title Add format_silent configuration and .silence css to cava module Add format_silent configuration and .silent, .updated css to cava module Aug 14, 2024
@S0nter
Copy link
Author

S0nter commented Aug 16, 2024

Merging this makes the following configuration possible:

cava

~/.config/waybar/config.jsonc

{
    "layer": "top",
    "spacing": 10,
    "modules-center": ["cava"],
    "cava": {
        "framerate": 60,
        "autosens": 1,
        "bars": 10,
        "lower_cutoff_freq": 50,
        "higher_cutoff_freq": 10000,
        "stereo": true,
        "reverse": false,
        "bar_delimiter": 0,
        "monstercat": false,
        "waves": true,
        "sleep_timer": 1,
        "format_silent": "quiet",
        "hide_on_silence": false,
        "input_delay": 1,
        "format-icons" : [" ", "▁", "▂", "▃", "▄", "▅", "▆", "▇", "█", ],
        "on-click": "playerctl play-pause",
    },
}

~/.config/waybar/style.css

@define-color base #303446;
@define-color text #f2d5cf;

window#waybar {
    background: none;
}

.module {
    background-color: @base;
    color: @text;
    padding: 0px 10px;
    margin: 5px 0px;
    border-radius: 10px;
    border: none;
}

#cava {
    font-family: 'Hack Nerd Font';
    font-size: 25px;
    
    transition-property: min-width, color;
    transition-timing-function: ease-in-out;
}

#cava:not(.silent) {
    min-width: 150px;
    color: transparent;

    transition-duration: 1s;
}

#cava.silent {
    animation-name: show;
    animation-duration: 1s;
    animation-timing-function: steps(12);
    animation-iteration-count: 1;
    animation-direction: normal;

    transition-duration: 1s;
}

#cava.updated {
    color: @text;
    transition-duration: 0.4s;
}

@keyframes show {
    from {
        color: transparent;
    }
}

@S0nter S0nter changed the title Add format_silent configuration and .silent, .updated css to cava module cava: Add format_silent option and css triggers Aug 31, 2024
@Alexays Alexays force-pushed the master branch 2 times, most recently from d623a89 to a4d31ab Compare September 13, 2024 07:40
@Alexays
Copy link
Owner

Alexays commented Sep 16, 2024

LGTM, can you update the man?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants