diff --git a/.gitignore b/.gitignore index b32f0fc..7f6c9d8 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,9 @@ build/ .pytest_cache/ .pyright/ *.egg + +# makepkg build artifacts +pkg/src/ +pkg/pkg/ +pkg/*.pkg.tar* +pkg/moonset/ diff --git a/pkg/PKGBUILD b/pkg/PKGBUILD new file mode 100644 index 0000000..9254af5 --- /dev/null +++ b/pkg/PKGBUILD @@ -0,0 +1,47 @@ +# ABOUTME: PKGBUILD for Moonset — Wayland session power menu. +# ABOUTME: Builds from git source with automatic version detection. + +# Maintainer: Dominik Kressler + +pkgname=moonset-git +pkgver=0.1.0.r6.g63bd7cf +pkgrel=1 +pkgdesc="A Wayland session power menu with GTK4 and Layer Shell" +arch=('any') +url="https://gitea.moonarch.de/nevaforget/moonset" +license=('MIT') +depends=( + 'python' + 'python-gobject' + 'gtk4' + 'gtk4-layer-shell' +) +makedepends=( + 'git' + 'python-build' + 'python-installer' + 'python-hatchling' +) +provides=('moonset') +conflicts=('moonset') +source=("git+${url}.git") +sha256sums=('SKIP') + +pkgver() { + cd "$srcdir/moonset" + git describe --long --tags | sed 's/^v//;s/-/.r/;s/-/./' +} + +build() { + cd "$srcdir/moonset" + rm -rf dist/ + python -m build --wheel --no-isolation +} + +package() { + cd "$srcdir/moonset" + python -m installer --destdir="$pkgdir" dist/*.whl + + # Example config + install -Dm644 config/moonset.toml "$pkgdir/etc/moonset/moonset.toml.example" +} diff --git a/src/moonset/panel.py b/src/moonset/panel.py index e6df15c..ea7cd63 100644 --- a/src/moonset/panel.py +++ b/src/moonset/panel.py @@ -107,6 +107,12 @@ class WallpaperWindow(Gtk.ApplicationWindow): background.set_vexpand(True) self.set_child(background) + self.connect("map", self._on_map) + + def _on_map(self, widget: Gtk.Widget) -> None: + """Trigger fade-in once the window is visible.""" + GLib.idle_add(lambda: self.add_css_class("visible") or GLib.SOURCE_REMOVE) + class PanelWindow(Gtk.ApplicationWindow): """Fullscreen power menu window for the primary monitor.""" @@ -242,10 +248,14 @@ class PanelWindow(Gtk.ApplicationWindow): self.add_controller(controller) def _on_map(self, widget: Gtk.Widget) -> None: - """Grab focus on the first action button once the window is visible.""" - # Delay focus grab — layer shell keyboard interactivity may not - # be ready at map time + """Trigger fade-in and grab focus once the window is visible.""" + GLib.idle_add(self._fade_in) + + def _fade_in(self) -> bool: + """Add visible class to trigger CSS opacity transition, then grab focus.""" + self.add_css_class("visible") GLib.idle_add(self._grab_initial_focus) + return GLib.SOURCE_REMOVE def _grab_initial_focus(self) -> bool: """Set focus on the first action button.""" diff --git a/src/moonset/style.css b/src/moonset/style.css index fd9283b..4a5dc95 100644 --- a/src/moonset/style.css +++ b/src/moonset/style.css @@ -6,11 +6,23 @@ window.panel { background-color: @theme_bg_color; background-size: cover; background-position: center; + opacity: 0; + transition: opacity 350ms ease-in; +} + +window.panel.visible { + opacity: 1; } /* Wallpaper-only window for secondary monitors */ window.wallpaper { background-color: @theme_bg_color; + opacity: 0; + transition: opacity 350ms ease-in; +} + +window.wallpaper.visible { + opacity: 1; } /* Round avatar image */