[Swaybar] Cava in swaybar - eviltoast

Distro: Gentoo

WM: Sway

Bar: Swaybar

It seems swaybar gets very little love, but it is honestly amazing how easily customizable it is.

I have only been able to find similar things for waybar, so I thought I should probably just code up a solution for spectrum visualization myself.

In the background runs a little selfmade C program that uses cava in binary raw mode, playerctl, pactl and some system functions to gather all the necessary information like the spectrum analyzer, song currently playing, volume and date/time.

Some rudimentary optimization was done to keep swaybar from drawing when the levels haven’t changed, so if no audio is playing it takes up basically no computing power.

The source code is pretty hacked together, but if someone wants it, just comment and I’ll provide it.

A small moving demo of the spectrum analyzer: https://youtu.be/S7IFNHgnybU

Edit: turns out YouTube doesn’t like weird aspect ratios and stopped processing the video, so here we go again, this time hosted on my server: https://jears.at/pub/swaybar-demo.webm

  • wh0_cares@lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    11 months ago

    >:)

    I’ll happily break my machine to try to get cava on my bar working eventually

    Skimming thru, doesn’t look too bad, but I’m sure I’ll find the horrors soon enough