summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2024-04-09 14:15:03 +1000
committerjacqueline <me@jacqueline.id.au>2024-04-09 14:15:03 +1000
commit2e59325c22605873bba62c078c196d99c1664590 (patch)
tree91cc1bf8835cb4ff4287df53a791fa621ad6664a /lua
parenta6f8468ad50c55d5cf4699038fd49470c5d857f4 (diff)
downloadtangara-fw-2e59325c22605873bba62c078c196d99c1664590.tar.gz
Go to the start of the current track before the previous track when hitting back
Diffstat (limited to 'lua')
-rw-r--r--lua/playing.lua14
1 files changed, 8 insertions, 6 deletions
diff --git a/lua/playing.lua b/lua/playing.lua
index 3368f590..a88cd961 100644
--- a/lua/playing.lua
+++ b/lua/playing.lua
@@ -151,9 +151,15 @@ return screen:new {
local prev_btn = controls:Button {}
- prev_btn:onClicked(queue.previous)
+ prev_btn:onClicked(function()
+ if playback.position:get() > 1 or queue.position:get() == 1 then
+ playback.position:set(0)
+ else
+ queue.previous()
+ end
+ end)
local prev_img = prev_btn:Image { src = img.prev }
- theme.set_style(prev_img, icon_disabled_class)
+ theme.set_style(prev_img, icon_enabled_class)
local play_pause_btn = controls:Button {}
play_pause_btn:onClicked(function()
@@ -217,10 +223,6 @@ return screen:new {
theme.set_style(
next_img, pos < queue.size:get() and icon_enabled_class or icon_disabled_class
)
-
- theme.set_style(
- prev_img, pos > 1 and icon_enabled_class or icon_disabled_class
- )
end),
queue.random:bind(function(shuffling)
theme.set_style(shuffle_img, shuffling and icon_enabled_class or icon_disabled_class)