Skip to content

Commit

Permalink
play/pause top result track when it's clicked
Browse files Browse the repository at this point in the history
  • Loading branch information
vixalien committed Oct 26, 2023
1 parent e6ec4de commit 036b30a
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/components/search/topresultcard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,19 @@ export class TopResultCard extends Adw.Bin {
break;
case "song":
case "video":
this.dynamic_image.state = DynamicActionState.LOADING;
this.activate_action(
"queue.play-song",
GLib.Variant.new_string(
this.result.videoId,
),
);
if (
get_player().now_playing?.object.track.videoId == this.result.videoId
) {
get_player().play_pause();
} else {
this.dynamic_image.state = DynamicActionState.LOADING;
this.activate_action(
"queue.play-song",
GLib.Variant.new_string(
this.result.videoId,
),
);
}
break;
case "playlist":
uri = `playlist:${this.result.browseId}`;
Expand Down

0 comments on commit 036b30a

Please sign in to comment.