feat: panel on focused monitor, wallpaper on all others

Panel without set_monitor so compositor places it on focused output.
Wallpaper windows on TOP layer on all monitors (below OVERLAY panel).
Transparent confirmation dialog background.
This commit is contained in:
nevaforget 2026-03-27 14:35:40 +01:00
parent e6de12ea4b
commit 63bd7cfea9
2 changed files with 21 additions and 13 deletions

View File

@ -58,7 +58,6 @@ class MoonsetApp(Gtk.Application):
def __init__(self) -> None:
super().__init__(application_id="dev.moonarch.moonset")
self._windows: list[PanelWindow] = []
def do_activate(self) -> None:
"""Create and present power menu windows on all monitors."""
@ -73,17 +72,24 @@ class MoonsetApp(Gtk.Application):
config = load_config()
bg_path = resolve_background_path(config)
# Panel window on every monitor — keyboard exclusive on all so
# the focused monitor always captures input
# Panel on focused output (no set_monitor → compositor picks focused)
panel = PanelWindow(bg_path=bg_path, application=self)
if HAS_LAYER_SHELL:
self._setup_layer_shell(panel, keyboard=True)
panel.present()
# Wallpaper on all other monitors
monitors = display.get_monitors()
for i in range(monitors.get_n_items()):
monitor = monitors.get_item(i)
panel = PanelWindow(bg_path=bg_path, application=self)
wallpaper = WallpaperWindow(bg_path=bg_path, application=self)
if HAS_LAYER_SHELL:
self._setup_layer_shell(panel, keyboard=True)
Gtk4LayerShell.set_monitor(panel, monitor)
panel.present()
self._windows.append(panel)
self._setup_layer_shell(
wallpaper, keyboard=False,
layer=Gtk4LayerShell.Layer.TOP,
)
Gtk4LayerShell.set_monitor(wallpaper, monitor)
wallpaper.present()
def _load_css(self, display: Gdk.Display) -> None:
"""Load the CSS stylesheet for the power menu."""
@ -97,11 +103,14 @@ class MoonsetApp(Gtk.Application):
)
def _setup_layer_shell(
self, window: Gtk.Window, keyboard: bool = False
self, window: Gtk.Window, keyboard: bool = False,
layer: int | None = None,
) -> None:
"""Configure gtk4-layer-shell for fullscreen OVERLAY display."""
"""Configure gtk4-layer-shell for fullscreen display."""
Gtk4LayerShell.init_for_window(window)
Gtk4LayerShell.set_layer(window, Gtk4LayerShell.Layer.OVERLAY)
Gtk4LayerShell.set_layer(
window, layer if layer is not None else Gtk4LayerShell.Layer.OVERLAY
)
Gtk4LayerShell.set_exclusive_zone(window, -1)
if keyboard:
Gtk4LayerShell.set_keyboard_mode(

View File

@ -61,8 +61,7 @@ window.wallpaper {
/* Confirmation box below action buttons */
.confirm-box {
padding: 16px 24px;
border-radius: 12px;
background-color: @theme_base_color;
background-color: transparent;
}
/* Confirmation prompt text */