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).
This commit is contained in:
parent
004e3d2855
commit
934a92384c
@ -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')
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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 */
|
||||
|
||||
@ -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")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user