From 934a92384cd5a4f372466b954b35ae8262fc7a60 Mon Sep 17 00:00:00 2001 From: nevaforget Date: Fri, 27 Mar 2026 15:12:56 +0100 Subject: [PATCH] fix: lock action calls moonlock directly instead of loginctl loginctl lock-session requires a D-Bus listener that is difficult to set up reliably. Direct moonlock invocation is simpler and works immediately. Also removes CSS fade-in animation (low-fps on layer shell). --- pkg/PKGBUILD | 2 +- src/moonset/power.py | 4 ++-- src/moonset/style.css | 12 ------------ tests/test_power.py | 4 ++-- 4 files changed, 5 insertions(+), 17 deletions(-) diff --git a/pkg/PKGBUILD b/pkg/PKGBUILD index 9254af5..d44b3fe 100644 --- a/pkg/PKGBUILD +++ b/pkg/PKGBUILD @@ -4,7 +4,7 @@ # Maintainer: Dominik Kressler pkgname=moonset-git -pkgver=0.1.0.r6.g63bd7cf +pkgver=0.1.0.r7.g004e3d2 pkgrel=1 pkgdesc="A Wayland session power menu with GTK4 and Layer Shell" arch=('any') diff --git a/src/moonset/power.py b/src/moonset/power.py index 3df2367..7f30f09 100644 --- a/src/moonset/power.py +++ b/src/moonset/power.py @@ -8,8 +8,8 @@ POWER_TIMEOUT = 30 def lock() -> None: - """Lock the current session via loginctl.""" - subprocess.run(["loginctl", "lock-session"], check=True, timeout=POWER_TIMEOUT) + """Lock the current session by launching moonlock.""" + subprocess.run(["moonlock"], check=True, timeout=POWER_TIMEOUT) def logout() -> None: diff --git a/src/moonset/style.css b/src/moonset/style.css index 4a5dc95..fd9283b 100644 --- a/src/moonset/style.css +++ b/src/moonset/style.css @@ -6,23 +6,11 @@ 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 */ diff --git a/tests/test_power.py b/tests/test_power.py index 11e9f93..18db985 100644 --- a/tests/test_power.py +++ b/tests/test_power.py @@ -13,11 +13,11 @@ class TestLock: """Tests for the lock power action.""" @patch("moonset.power.subprocess.run") - def test_calls_loginctl_lock_session(self, mock_run) -> None: + def test_calls_moonlock(self, mock_run) -> None: lock() mock_run.assert_called_once_with( - ["loginctl", "lock-session"], check=True, timeout=POWER_TIMEOUT + ["moonlock"], check=True, timeout=POWER_TIMEOUT ) @patch("moonset.power.subprocess.run")