NickvisionApps / Cavalier

Visualize audio with CAVA
MIT License
156 stars 8 forks source link

Background mode #110

Closed Suyashtnt closed 1 year ago

Suyashtnt commented 1 year ago

Wayland and X11 has the ability to draw windows/widgets in the background (bg on both) or as an overlay (overlay on wayland) underneath the main windows. Being able to set the background or overlay as cavalier would be sick as a dynamic animated wallpaper

fsobolev commented 1 year ago

On Wayland this requires layer shell protocol support, and GNOME on Wayland doesn't have it. Still, I tried to do this for other compositors, but unfortunately gtk4-layer-shell works extremely bad: random crashes in KDE and labwc, and Wayfire crashes itself upon application start. And it's not like I was doing something wrong, I had the same problems with gtk4-layer-shell demo. And I don't want to enforce Cavalier to run in X11 just for that feature. If you really want, there's no need to change anything in the app itself, you can make Cavalier run as background app with additional tools (Flatseal to enforce X11 and something to change the properties of X11 window, don't remember the name).

Suyashtnt commented 1 year ago

On Wayland this requires layer shell protocol support, and GNOME on Wayland doesn't have it. Still, I tried to do this for other compositors, but unfortunately gtk4-layer-shell works extremely bad: random crashes in KDE and labwc, and Wayfire crashes itself upon application start. And it's not like I was doing something wrong, I had the same problems with gtk4-layer-shell demo. And I don't want to enforce Cavalier to run in X11 just for that feature. If you really want, there's no need to change anything in the app itself, you can make Cavalier run as background app with additional tools (Flatseal to enforce X11 and something to change the properties of X11 window, don't remember the name).

Is there an equivalent on wayland? I'm currently using hyprland

fsobolev commented 1 year ago

Is there an equivalent on wayland? I'm currently using hyprland

If Cavalier is running in X11 (using XWayland in your case) then it doesn't matter whether you use X11 window manager or wayland compositor, X11 tools should work for it.

Suyashtnt commented 1 year ago

Is there an equivalent on wayland? I'm currently using hyprland

If Cavalier is running in X11 (using XWayland in your case) then it doesn't matter whether you use X11 window manager or wayland compositor, X11 tools should work for it.

Cavalier is running on non-xwayland (as a native wayland client)

fsobolev commented 1 year ago

Cavalier is running on non-xwayland (as a native wayland client)

As I said, use Flatseal to run it in XWayland. Disable wayland socket and enable X11. If you use AUR package then try running it with GDK_BACKEND=x11. I found the name of the tool to set X11 window attributes - wmctrl. I suppose with a simple script you can automate launching Cavalier and using wmctrl on it.

EDIT: another tool is xwinwrap

Suyashtnt commented 1 year ago

Cavalier is running on non-xwayland (as a native wayland client)

As I said, use Flatseal to run it in XWayland. Disable wayland socket and enable X11. If you use AUR package then try running it with GDK_BACKEND=x11. I found the name of the tool to set X11 window attributes - wmctrl. I suppose with a simple script you can automate launching Cavalier and using wmctrl on it.

EDIT: another tool is xwinwrap

wmctrl doesn't work on hyprland and neither does xwinwrap

fsobolev commented 1 year ago

wmctrl doesn't work on hyprland and neither does xwinwrap

I will later try in KDE and give you step-by-step guide.

fsobolev commented 1 year ago

This is what worked for me on KDE Wayland:

#!/bin/sh

flatpak run org.nickvision.cavalier &
sleep 3
wmctrl -r Cavalier -b add,below,skip_taskbar

sticky didn't work. Anyway, on KDE there are window rules in settings, so wmctrl isn't needed at all. And hyprland have window rules too, at least float and pin seems to be what you're interested it, so if at least wmctrl's below works in hyprland then Cavalier will be like an animated wallpaper.

Also, again, make sure Cavalier is running using XWayland to make it work with wmctrl, you can check this by pressing Ctrl+Shift+I when Cavalier window is focused to open GTK Inspector, then in Global tab there will be GDK Backend - X11.