diff options
-rw-r--r-- | README.md | 9 | ||||
-rw-r--r-- | lua/sleep.lua | 12 |
2 files changed, 16 insertions, 5 deletions
@@ -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() |