Go to the start of the current track before the previous track when hitting back

custom
jacqueline 1 year ago
parent a6f8468ad5
commit 2e59325c22
  1. 14
      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)

Loading…
Cancel
Save