smplayer-dev / smplayer

Free Media Player for Windows, Linux and Mac OS with YouTube support.
https://smplayer.info
GNU General Public License v2.0
646 stars 92 forks source link

Keyboard bindings don't work unless SMPlayer has just been alt-tabbed to recently #341

Open smplayer-dev opened 2 years ago

smplayer-dev commented 2 years ago

Discussed in https://github.com/smplayer-dev/smplayer/discussions/340

Originally posted by **thrik** January 9, 2022 I don't know why this happens, but SMPlayer doesn't recognize keyboard commands (like Play/Pause) unless I just alt-tab to it. It is reproducible. I have just been clicking in the meantime but I'm not a fan. I'm on EndeavourOS using KDE. Please help, it's really annoying :(
smplayer-dev commented 2 years ago

I've just tested on KDE Neon, I'm afraid I can't reproduce this problem.

dv1 commented 2 years ago

Also happens to me on Kubuntu 21.10 x86-64. Tested with current master (f111ba2b30a30c8aa40f48379353dcdcf6be6640). When playback starts, the window flashes, as if it was closed and reopened again. None of the shortcuts work then (left, right etc). Alt-tabbing makes it work again until I pause, at which point the window flashes again, and the shortcuts no longer work.

smplayer-dev commented 2 years ago

Is the option Video -> Stay on top set to "While playing"? If that's the case try to turn it off and see if it makes any difference.

dv1 commented 2 years ago

Ah, indeed, that caused it, thanks!

gslin commented 2 years ago

Cool it works now. Is it some kind of race conditions?

smplayer-dev commented 2 years ago

I think SMPlayer loses the focus when it changes to stay on top, but I couldn't find a way to fix it. This problem seems to happen only on KDE.

gslin commented 2 years ago

Thanks, but my environment is XFCE 4.16 (xubuntu) and no kde libraries installed, so it seems not limited to KDE only...

smplayer-dev commented 2 years ago

The only solution I found so far is turning off the option to stay on top.

enervated commented 2 years ago

I'm running SMPlayer 22.2.0 rev 10060 64-bit on Windows 10 21H1 and have a similar issue, but with audio files only. I can't get Play/Pause to work at all with audio files (it works fine with video files).

I did get it to work temporarily, one time, by clearing out all the bindings for "play_or_pause" and then assigning only "Media Play" and "Space". Then I restarted SMPlayer and could not get it to work anymore, even repeating the same steps.

Media Play doesn't work, and Space doesn't work, and neither work on their own, either.

Disabling always-on-top makes no difference, not surprisingly. Sorry, I'm not sure if this is at all the same issue.

play_or_pause

gqqnbig commented 2 years ago

I have the same issue on Windows 10.

I'm listening a lot of audio files. This is how I can reproduce the bug.

  1. Close all instances of SMPlayer.
  2. Double click 1.mp3 in Explorer. SMPlayer starts and plays the audio. Use space key to pause the audio. It works.
  3. Do not minimize SMPlayer. Double click 2.mp3 in Explorer.
  4. SMPlayer goes to background because Explorer gets focus. But SMPlayer switches to play 2.mp3.
  5. Use mouse to click the SMPlayer icon on taskbar and bring it to foregound.
  6. Press the space key, the audio does not pause.
  7. Press alt-tab. Explorer gains the focus.
  8. Press alt-tab. SMPlayer gains the focus.
  9. Press the space key. The keybinding works again.
menachemshapiro commented 1 year ago

I just ran into this issue. Changing the settings so that the video never stays on top solved it. I'm running: SMPlayer v. 21.10.0 (revision 10000) mpv version 0.34.1 Lubuntu 22.04.2 LTS