Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpotifyControls: Setting to restart playing song if playtime >3s #3103

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/plugins/spotifyControls/PlayerComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import "./spotifyStyles.css";

import { Settings } from "@api/Settings";
import { Flex } from "@components/Flex";
import { ImageIcon, LinkIcon, OpenExternalIcon } from "@components/Icons";
import { debounce } from "@shared/debounce";
Expand Down Expand Up @@ -130,7 +131,9 @@ function Controls() {
>
<Shuffle />
</Button>
<Button onClick={() => SpotifyStore.prev()}>
<Button onClick={() => {
Settings.plugins.SpotifyControls.previousButtonRestartsTrack && SpotifyStore.position > 3000 ? SpotifyStore.seek(0) : SpotifyStore.prev();
}}>
<SkipPrev />
</Button>
<Button onClick={() => SpotifyStore.setPlaying(!isPlaying)}>
Expand Down
5 changes: 5 additions & 0 deletions src/plugins/spotifyControls/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ export default definePlugin({
type: OptionType.BOOLEAN,
description: "Open Spotify URIs instead of Spotify URLs. Will only work if you have Spotify installed and might not work on all platforms",
default: false
},
previousButtonRestartsTrack: {
type: OptionType.BOOLEAN,
description: "Restart currently playing track when pressing the previous button if playtime is >3s",
default: true
}
},
patches: [
Expand Down
Loading