Conversation
There was a problem hiding this comment.
Pull request overview
This pull request implements sleep prevention functionality for Linux desktop platforms during video playback. The implementation uses a dual-pronged approach combining systemd-inhibit and org.freedesktop.ScreenSaver D-Bus API to ensure reliable screen saver and sleep prevention across different Linux desktop environments.
Changes:
- Added
LinuxWindowUtilsclass that implementsAutoCloseableand provides screen saver prevention - Implemented dual inhibition mechanism using systemd-inhibit for system sleep and D-Bus ScreenSaver API for display management
- Added shutdown hook mechanism for cleanup of inhibition resources on JVM shutdown
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
app/shared/ui-foundation/src/desktopMain/kotlin/platform/window/LinuxWindowUtils.kt
Outdated
Show resolved
Hide resolved
app/shared/ui-foundation/src/desktopMain/kotlin/platform/window/LinuxWindowUtils.kt
Show resolved
Hide resolved
app/shared/ui-foundation/src/desktopMain/kotlin/platform/window/LinuxWindowUtils.kt
Outdated
Show resolved
Hide resolved
app/shared/ui-foundation/src/desktopMain/kotlin/platform/window/LinuxWindowUtils.kt
Outdated
Show resolved
Hide resolved
app/shared/ui-foundation/src/desktopMain/kotlin/platform/window/LinuxWindowUtils.kt
Outdated
Show resolved
Hide resolved
app/shared/ui-foundation/src/desktopMain/kotlin/platform/window/LinuxWindowUtils.kt
Outdated
Show resolved
Hide resolved
app/shared/ui-foundation/src/desktopMain/kotlin/platform/window/LinuxWindowUtils.kt
Outdated
Show resolved
Hide resolved
app/shared/ui-foundation/src/desktopMain/kotlin/platform/window/LinuxWindowUtils.kt
Outdated
Show resolved
Hide resolved
app/shared/ui-foundation/src/desktopMain/kotlin/platform/window/LinuxWindowUtils.kt
Show resolved
Hide resolved
app/shared/ui-foundation/src/desktopMain/kotlin/platform/window/LinuxWindowUtils.kt
Outdated
Show resolved
Hide resolved
db49533 to
77a478f
Compare
|
@WoLeo-Z 你有时间测试一下吗,我记得你用 Linux 来着 |
|
在我的环境下出现非预期行为,表现为 我的一些拙劣的 debug
似乎是 cookie 错误. 我不太了解这个 dbus 接口 GitHub 无法上传 https://t.me/openani_dev/63158 你可以使用 一些信息:我通过 $ cat 1.log | grep ScreenSaver
2026-01-19 20:56:57,499 [INFO ] LinuxWindowUtils: [ScreenSaver] Inhibited (systemd + dbus)link to #2764. I approved gh action workflow. Built successfully on my machine. Build with {
inputs.nixpkgs.url = "github:NixOS/nixpkgs/be5afa0fcb31f0a96bf9ecba05a516c66fcd8114";
outputs =
{ nixpkgs, ... }:
let
system = "x86_64-linux";
overlayAnimekoPR2773 = final: prev: {
animeko = prev.animeko.overrideAttrs (old: {
patches = (old.patches or [ ]) ++ [
(prev.fetchpatch {
url = "https://github.com/open-ani/animeko/pull/2773.patch";
sha256 = "sha256-02x5miYipOvMLzdEN8AeptAb5Zb7nJJhtKS8OqIkkxw=";
})
];
});
};
pkgs = import nixpkgs {
inherit system;
overlays = [ overlayAnimekoPR2773 ];
};
in
{
packages.${system}.animeko = pkgs.animeko;
};
}与此 PR 无关:顺便发现了一个无伤大雅的 dbus spam 噪声(图里的就是),间隔一秒轮询 busctl --user call :1.24 /org/freedesktop/portal/desktop org.freedesktop.impl.portal.Settings Read ss org.freedesktop.appearance color-scheme可能由第三方库 |
谢谢你的测试,一样复现了错误,我对此dbus接口也没有足够的了解导致了实现错误。 根据 freedesktop 文档
PR中使用了 想要在不引入其他库的情况下自行实现一个长连接dbus比较困难 , 对于一个防熄屏功能来说有点太复杂了, 我放弃实现 这在我的所有desktop设备都可以工作,坏处就是只支持systemd发行版了 |
|
WHO 改成 Animeko 吧,这样比较容易辨识 |
done |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 9 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


播放视频时阻止熄屏/休眠。linux下的休眠抑制情况比较复杂,
最后选择了systemd-inhibit和org.freedesktop.ScreenSaver.Inhibit并行的方案只使用了
systemd-inhibit, 这意味着只支持systemd发行版。