Skip to content

Commit

Permalink
feat: add shortcut for play/pause when player open
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Jul 27, 2024
1 parent 89629d3 commit f6e72df
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/renderer/src/modules/feed-column/corner-player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import dayjs from "dayjs"
import { AnimatePresence, m } from "framer-motion"
import { useEffect, useState } from "react"
import Marquee from "react-fast-marquee"
import { useHotkeys } from "react-hotkeys-hook"

const handleClickPlay = () => {
Player.togglePlayAndPause()
Expand Down Expand Up @@ -55,6 +56,11 @@ const CornerPlayerImpl = () => {
const entry = useEntry(playerValue.entryId)
const feed = useFeedById(entry?.feedId)

useHotkeys("space", handleClickPlay, {
preventDefault: true,
scopes: ["home"],
})

const navigateToEntry = useNavigateEntry()

if (!entry || !feed) return null
Expand Down

0 comments on commit f6e72df

Please sign in to comment.