Alexays / Waybar

Highly customizable Wayland bar for Sway and Wlroots based compositors. :v: :tada:
MIT License
5.82k stars 657 forks source link

Dynamic background color #3290

Open carlosV2 opened 1 month ago

carlosV2 commented 1 month ago

Is there a way to define the waybar's background color to match the opened app's color?

Of course this has a ton of caveats (like what happens if there are multiple windows, etc) but, in the simplest form, I'm looking for a way to set the color programmatically (even if I had to define the colors manually). For example, with a long-running process.

I've seen there are some GTK variables that can be used but they are related to the GTK theme instead of the screen's contents (unless I'm mistaken).

Here are some examples of what I mean.

This is how my bar looks like without windows open: image

The background color is set to match the one in my terminal so that when the terminal is open, it looks like this: image

However, if I open Spotify (for example), the color does not adjust dynamically: image

apiraino commented 3 weeks ago

The most brutal way I can think of to achieving that is - hope you're sitting on a chair:

(only half-joking)

carlosV2 commented 3 weeks ago

Hang on, this might not be that crazy!

I mean, like you said, it is a very crude way but waybar has a mechanism to reload the CSS automatically when it changes. In addition to this, I can tap onto the Hyprland socket to know what workspace I am on and what screens are in there... I might actually try it!

Only concern is the CPU usage but, by my estimates, it should not have that big of an impact actually!

Thank a lot for the half-joke that I'm taking half-seriously.