diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-02-18 18:53:53 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-02-18 18:53:53 +0900 |
| commit | 7d87605d77f1b0f6b2b77b9adeb91bfd3c2192cc (patch) | |
| tree | dbc97ef4c4a57ef9a8dd87bd26e547e0066b1e90 /ar | |
| parent | dc4ec862ea8cc11d9e131066517f4c7ff6e3ad11 (diff) | |
created scripts/xscreensaver.lua
Diffstat (limited to 'ar')
| -rw-r--r-- | ar/.config/mpv/scripts/xscreensaver.lua | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/ar/.config/mpv/scripts/xscreensaver.lua b/ar/.config/mpv/scripts/xscreensaver.lua new file mode 100644 index 0000000..a54b944 --- /dev/null +++ b/ar/.config/mpv/scripts/xscreensaver.lua @@ -0,0 +1,24 @@ +-- this script periodically deactivates xscreensaver +-- when video playback is active + +local function heartbeat() + if + mp.get_property_native("pause") + or mp.get_property_native("idle") + or not mp.get_property_native("vo-configured") + then + return + end + + mp.command_native_async({ + name = "subprocess", + args = { "xscreensaver-command", "-deactivate" }, + capture_stdout = true, + }, function() end) +end + +mp.add_periodic_timer(60, heartbeat) + +for _, prop in ipairs({ "pause", "idle", "vo-configured" }) do + mp.observe_property(prop, nil, heartbeat) +end |
