mirror of
https://github.com/scorpion-26/gBar.git
synced 2024-11-22 03:02:49 +00:00
Layer audioflyin on top of fullscreen windows
LAYER_TOP (The previously hardcoded layer) draws below fullscreen windows (at least on Hyprland). For the flyin we want it to be always on top, so LAYER_OVERLAY is used instead now.
This commit is contained in:
parent
3a0b0e0699
commit
b19b091c92
3 changed files with 17 additions and 1 deletions
|
@ -150,6 +150,8 @@ namespace AudioFlyin
|
||||||
padding = Widget::Create<Box>();
|
padding = Widget::Create<Box>();
|
||||||
mainWidget->AddChild(std::move(padding));
|
mainWidget->AddChild(std::move(padding));
|
||||||
|
|
||||||
|
// We want the audio flyin on top of fullscreen windows
|
||||||
|
window.SetLayer(Layer::Overlay);
|
||||||
window.SetExclusive(false);
|
window.SetExclusive(false);
|
||||||
window.SetAnchor(Anchor::Bottom);
|
window.SetAnchor(Anchor::Bottom);
|
||||||
window.SetMainWidget(std::move(mainWidget));
|
window.SetMainWidget(std::move(mainWidget));
|
||||||
|
|
|
@ -48,7 +48,13 @@ void Window::Run()
|
||||||
m_Window = (GtkWindow*)gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
m_Window = (GtkWindow*)gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||||
|
|
||||||
gtk_layer_init_for_window(m_Window);
|
gtk_layer_init_for_window(m_Window);
|
||||||
gtk_layer_set_layer(m_Window, GTK_LAYER_SHELL_LAYER_TOP);
|
|
||||||
|
switch (m_Layer)
|
||||||
|
{
|
||||||
|
case Layer::Top: gtk_layer_set_layer(m_Window, GTK_LAYER_SHELL_LAYER_TOP); break;
|
||||||
|
case Layer::Overlay: gtk_layer_set_layer(m_Window, GTK_LAYER_SHELL_LAYER_OVERLAY); break;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_Exclusive)
|
if (m_Exclusive)
|
||||||
gtk_layer_auto_exclusive_zone_enable(m_Window);
|
gtk_layer_auto_exclusive_zone_enable(m_Window);
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,12 @@ enum class Anchor
|
||||||
};
|
};
|
||||||
DEFINE_ENUM_FLAGS(Anchor);
|
DEFINE_ENUM_FLAGS(Anchor);
|
||||||
|
|
||||||
|
enum class Layer
|
||||||
|
{
|
||||||
|
Top,
|
||||||
|
Overlay
|
||||||
|
};
|
||||||
|
|
||||||
class Window
|
class Window
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -29,6 +35,7 @@ public:
|
||||||
void SetAnchor(Anchor anchor) { m_Anchor = anchor; }
|
void SetAnchor(Anchor anchor) { m_Anchor = anchor; }
|
||||||
void SetMargin(Anchor anchor, int32_t margin);
|
void SetMargin(Anchor anchor, int32_t margin);
|
||||||
void SetExclusive(bool exclusive) { m_Exclusive = exclusive; }
|
void SetExclusive(bool exclusive) { m_Exclusive = exclusive; }
|
||||||
|
void SetLayer(Layer layer) { m_Layer = layer;}
|
||||||
|
|
||||||
void SetMainWidget(std::unique_ptr<Widget>&& mainWidget);
|
void SetMainWidget(std::unique_ptr<Widget>&& mainWidget);
|
||||||
|
|
||||||
|
@ -47,6 +54,7 @@ private:
|
||||||
Anchor m_Anchor;
|
Anchor m_Anchor;
|
||||||
std::array<std::pair<Anchor, int32_t>, 4> m_Margin;
|
std::array<std::pair<Anchor, int32_t>, 4> m_Margin;
|
||||||
bool m_Exclusive = true;
|
bool m_Exclusive = true;
|
||||||
|
Layer m_Layer = Layer::Top;
|
||||||
|
|
||||||
int32_t m_MonitorID;
|
int32_t m_MonitorID;
|
||||||
GdkMonitor* m_Monitor = nullptr;
|
GdkMonitor* m_Monitor = nullptr;
|
||||||
|
|
Loading…
Reference in a new issue