aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorben <ben@nagy.contact>2025-01-02 13:13:11 -0800
committerben <ben@nagy.contact>2025-01-02 13:13:11 -0800
commit17afdd47194da24b581075f01d678342c4b56f14 (patch)
treebea0b4dd51fd68d164715e7c72f8fc7109e5fe68
parent16fb12c35ea3a89d3f35c7725e04994e93a407a3 (diff)
a hello world
-rw-r--r--README.md9
-rw-r--r--lua/sleep.lua12
2 files changed, 16 insertions, 5 deletions
diff --git a/README.md b/README.md
index 9d1fdf6..ff43750 100644
--- a/README.md
+++ b/README.md
@@ -34,3 +34,12 @@ Key Codes (gestures):
```
$: adb push sleep.lua /storage/emulated/0/Android/media/is.xyz.mpv/scripts/
```
+
+
+## ignore
+<!--
+We need to retrieve user input. MPV OSD can output content, but not retrieve input.
+We could use [termux-dialog](https://wiki.termux.com/wiki/Termux-dialog), but that's bloated.
+
+Alternatively, we can write a small app that sleep.lua executes to retrieve user input through a simple dialogue
+-->
diff --git a/lua/sleep.lua b/lua/sleep.lua
index bba30f2..462e6e1 100644
--- a/lua/sleep.lua
+++ b/lua/sleep.lua
@@ -1,11 +1,13 @@
-local function set_brightness()
- mp.set_property_number("brightness", -50)
- mp.commandv("seek", "20", "relative")
+-- this is executed when the user invokes it through gesturing
+local function foo()
+ mp.osd_message("Hello World!", 2)
end
+-- this is called immediately upon opening a file
local function init()
- mp.set_property_bool("pause", true)
+ mp.msg.info("Sleep timer script initialized")
+ mp.osd_message("Sleep timer script initialized!", 3)
end
-mp.add_key_binding(nil, "test", set_brightness)
+mp.add_key_binding(nil, "sleep", foo)
init()