mpv not giving back the focus to caja after exiting

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Post Reply
alecail
Level 1
Level 1
Posts: 3
Joined: Mon Sep 18, 2023 12:59 pm

mpv not giving back the focus to caja after exiting

Post by alecail »

I have this use case where I go through a lot of security cam videos for a quick review; they are all in the same directory, and - using the keyboard only - I used to just Enter to start viewing, left / right to view the video, then q to exit and down to the next video.
Now, using this combination of caja / mpv / mate, the focus to caja is lost after exiting mpv; it forces me to give the focus back to caja somehow, using alt +tab or the mouse.

Is there a transparent way to just have the window manager give back the focus to caja when mpv exits ?

As you can see, after mpv exits, the situation is not so great from the point of view of the X Server.

while true; do sleep 1; xdotool getwindowfocus; done;
56632662
[...]
56632662
[...]
90177538 << -- mpv
[...]
90177538
XGetInputFocus returned the focused window of 1. This is likely a bug in the X server.
X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 20 (X_GetProperty)
Resource id in failed request: 0x1
Serial number of failed request: 20
Current serial number in output stream: 20
alecail
Level 1
Level 1
Posts: 3
Joined: Mon Sep 18, 2023 12:59 pm

Re: mpv not giving back the focus to caja after exiting

Post by alecail »

Calling this

#!/bin/zsh
id=`xdotool getactivewindow`
mpv $*
xdotool windowactivate $id

instead of mpv fixed this problem.
Post Reply

Return to “MATE”