summaryrefslogtreecommitdiff
path: root/ar/.config/mpv/scripts
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-02-18 18:53:53 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-02-18 18:53:53 +0900
commit7d87605d77f1b0f6b2b77b9adeb91bfd3c2192cc (patch)
treedbc97ef4c4a57ef9a8dd87bd26e547e0066b1e90 /ar/.config/mpv/scripts
parentdc4ec862ea8cc11d9e131066517f4c7ff6e3ad11 (diff)
created scripts/xscreensaver.lua
Diffstat (limited to 'ar/.config/mpv/scripts')
-rw-r--r--ar/.config/mpv/scripts/xscreensaver.lua24
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