diff options
| author | ailurux <ailurux@noreply.codeberg.org> | 2024-12-18 23:14:21 +0000 |
|---|---|---|
| committer | ailurux <ailurux@noreply.codeberg.org> | 2024-12-18 23:14:21 +0000 |
| commit | 0343f34f7bda4fddf5775f80ccd024aea57beaf5 (patch) | |
| tree | 0609d9cbef24e630e0a293caa2a261d7385c612d | |
| parent | b3e1e88ba25da15bfbfd948be788241adaef7e48 (diff) | |
| parent | 13c5b7b8470bb9c8f8d86f89fd49284b46508467 (diff) | |
| download | tangara-fw-0343f34f7bda4fddf5775f80ccd024aea57beaf5.tar.gz | |
Merge pull request 'Add long-right-press as a shortcut to the now playing screen' (#122) from jqln/now-playing-shortcut into main
Reviewed-on: https://codeberg.org/cool-tech-zone/tangara-fw/pulls/122
| -rw-r--r-- | lua/main.lua | 12 | ||||
| -rw-r--r-- | luals-stubs/controls.lua | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/lua/main.lua b/lua/main.lua index d9e1808f..46201fd4 100644 --- a/lua/main.lua +++ b/lua/main.lua @@ -70,6 +70,18 @@ local function init_ui() end end end), + controls.scheme:bind(function() + -- Set up a shortcut for jumping straight to the 'now playing' screen. + -- Implemented as a binding so that the shortcut is still applied even if + -- the control scheme is changed at runtime. + local hooks = controls.hooks() + local input_method = hooks.wheel or hooks.dpad + if input_method and input_method.right then + input_method.right.long_press = function() + require("playing"):push_if_not_shown() + end + end + end), sd_card.mounted:bind(function(mounted) backstack.reset(main_menu:new()) end), diff --git a/luals-stubs/controls.lua b/luals-stubs/controls.lua index 7034dc55..db5ea9f2 100644 --- a/luals-stubs/controls.lua +++ b/luals-stubs/controls.lua @@ -7,6 +7,7 @@ --- @field scheme Property The currently configured control scheme --- @field scroll_sensitivity Property How much rotational motion is required on the touchwheel per scroll tick. --- @field lock_switch Property The current state of the device's lock switch. +--- @field hooks funtion Returns a table containing the inputs and actions associated with the current control scheme. local controls = {} return controls |
