elkowar / eww

ElKowars wacky widgets
https://elkowar.github.io/eww
MIT License
9.3k stars 382 forks source link

[FEATURE] Embedded windows #230

Open caffeine01 opened 3 years ago

caffeine01 commented 3 years ago

Description of the requested feature

Ability to embed terminals or other windows into an eww window. So for example have a box with cava inside of it for a side bar that has a spotify widget and an audio visualiser inside of it.

Proposed configuration syntax

Maybe inside of a defined box you can have <term>cava</term> or <extern>firefox</extern> And also you could do the size like <term x="" y=""> or through scss config

Additional context

none that comes to mind.

undefinedDarkness commented 3 years ago

And also a big thing im indecisive about is weather or not you do the size like or through scss config?

what?


There is no real way to do this sorry to say, you might wanna look into your window manager :) (awesome, xmonad & dwm can achieve this - not entirely sure about xmonad) You can use XEmbed compatible windows so you get functionality like st-tabbed but nothing else -> but there are very few apps that actually support this

I proposed this to elko in the past, but there isnt much of a usecase for it

elkowar commented 3 years ago

Okay, so there's a couple things to say here.

  1. This would be a pretty big, complex feature to implement, I'd guess. Assuming that its realistically possible at all, using XEmbed or reparenting, the interaction with GTK would still be unclear. The main tool that does something similar that comes to mind is suckless tabbed - which requires the embedded application to specifically do stuff for it to work (afaik). Thus, assuming its possible at all, this would probably be filled with gotchas and difficulties. If you know of any other tools that do a similar thing, please do tell - might be a good reference to look into.

  2. Usecases. There are two main places where i can see some sort of embedding be useful. Firstly, the here mentioned widgets that embed applications. This would benefit from statically included apps, as requested here. Secondly, and this is the main usecase that has had me thinking about this: window decorations. Technically, it should be possible to make eww capable of serving as window decorations. This would require specific support by the window manager, and would thus only be feasible on a few very flexible X WMs such as XMonad, awesome, dwm, or maybe qtile. It would also require more changes to eww, to support generating full windows dynamically - which is planned anyways. This, too, is a difficult task that probably won't happen for a while

undefinedDarkness commented 3 years ago

Almost any GTK app (depending on if it does fucky stuff like eww) can be embedded but most dont support it (predictably) so they would need to be edited in the source code ig

caffeine01 commented 3 years ago

And also a big thing im indecisive about is weather or not you do the size like or through scss config?

what?

Edited, i forgot to add code blocks.

JustSimplyKyle commented 2 years ago

For cava, there's a cursed solution. https://github.com/ankkax/hyprland/blob/main/eww/bar/scripts/cava-internal.sh

caffeine01 commented 2 years ago

For cava, there's a cursed solution. https://github.com/ankkax/hyprland/blob/main/eww/bar/scripts/cava-internal.sh

wtf man

JustSimplyKyle commented 2 years ago

If you just deflisten it, it'll work

rachung2510 commented 1 year ago

For cava, there's a cursed solution. https://github.com/ankkax/hyprland/blob/main/eww/bar/scripts/cava-internal.sh

Huge thanks for this! Used this with eww's progress bars to create a pseudo cava visualizer

JustSimplyKyle commented 1 year ago

printf "[general]\nframerate=60\nbars = 7\n[output]\nmethod = raw\nraw_target = /dev/stdout\ndata_format = ascii\nascii_max_range = 7\n" | cava -p /dev/stdin | sed -u 's/;//g;s/0/▁/g;s/1/▂/g;s/2/▃/g;s/3/▄/g;s/4/▅/g;s/5/▆/g;s/6/▇/g;s/7/█/g; ' A better performance version(since the original one costed cpu perf a lot)

JonathanSteininger commented 9 months ago

I have made a fork of cava which has another raw output method like the one @JustSimplyKyle made. You just need the cava config to instead be:

[output]
method = raw
data_format = unicodeBars
ascii_max_range = 23

you can change the delimiter options to what you want but by default the line delimiter is ";" and the frame delimiter is "\n"

to display it nicely in eww you just need to do an eww expresstion "${replace( [liseningVarName], ";", "
")}"

Then style it with a monospaced font like Hack to have them line up perfectly.

The height is determined by ascii_max_range.

If you have more questions I have it documented in the config example.

My cava fork

After you compile it you just need to copy the executable to your eww config and have a deflisten variable run it with the path to the cava config you made. preferably you have a cava config in the eww configuration aswell.

the deflisten command would look something like this. ./cava -p ./cavaConfig

JonathanSteininger commented 8 months ago

I have Hidden my previous Cava fork solution. A better version instead alters the output from Cava.
CavaRawBarWrapper. It is way easier to use and modify.
All that's required is to have cava installed and pipe the raw ascii output into this program. It can also use less power due to outputting dynamic amount of layers. It also has some other new features. You can read the eww section in the README.md.