summaryrefslogtreecommitdiff
path: root/src/lua
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2024-01-05 10:38:35 +1100
committerjacqueline <me@jacqueline.id.au>2024-01-05 10:38:35 +1100
commit34cae4e6e4bb00b3453bcdab084368a949c908a4 (patch)
tree024caadd70ea35ab2c73cc782f3a37c93a90702f /src/lua
parent938ba62f57ed2c002bae4aec236eeaeb200e4cba (diff)
downloadtangara-fw-34cae4e6e4bb00b3453bcdab084368a949c908a4.tar.gz
add an alerts module for lua, and implement a volume indicator with it
Diffstat (limited to 'src/lua')
-rw-r--r--src/lua/stubs/alerts.lua13
-rw-r--r--src/lua/stubs/volume.lua14
2 files changed, 27 insertions, 0 deletions
diff --git a/src/lua/stubs/alerts.lua b/src/lua/stubs/alerts.lua
new file mode 100644
index 00000000..9b541d84
--- /dev/null
+++ b/src/lua/stubs/alerts.lua
@@ -0,0 +1,13 @@
+--- Module for interacting with playback volume. The Bluetooth and wired outputs store their current volume separately; this API only allows interacting with the volume of the currently used output device.
+-- @module alerts
+
+local alerts = {}
+
+--- Returns the current volume as a percentage of the current volume limit.
+-- @tparam function constructor Called to create the UI for the alert. A new default root object and group will be set before calling this function.i Alerts are non-interactable; the group created for the constructor will not be granted focus.
+function alerts.show(constructor) end
+
+--- Dismisses any visible alerts, removing them from the screen.
+function alerts.hide() end
+
+return alerts
diff --git a/src/lua/stubs/volume.lua b/src/lua/stubs/volume.lua
new file mode 100644
index 00000000..15499630
--- /dev/null
+++ b/src/lua/stubs/volume.lua
@@ -0,0 +1,14 @@
+--- Module for interacting with playback volume. The Bluetooth and wired outputs store their current volume separately; this API only allows interacting with the volume of the currently used output device.
+-- @module volume
+
+local volume = {}
+
+--- Returns the current volume as a percentage of the current volume limit.
+-- @treturn types.Property an integer property
+function volume.current_pct() end
+
+--- Returns the current volume in terms of dB from line level.
+-- @treturn types.Property an integer property
+function volume.current_db() end
+
+return volume