Ask experts a question (this post has many texts, please be patient)
Source: Internet
Author: User
For more information, see Linux general technology-Linux technology and application. There was a problem that could not be solved, so I took the liberty to ask the man. I hope to help me see if it can be implemented when I have time.
[To achieve results]
I usually learn English by watching English sound movies. Most of these films are in the rmvb format formed by adding compressed Chinese subtitles to the source film in the online subtitle group (this type of resources is relatively easy to find, most people need subtitles, but I usually don't want to see these Chinese subtitles to avoid interfering with the cultivation of English Listening. So I hope to have a "baffle" (a window) when watching a movie, we block the subtitles and can still use shortcuts to control the playing of the movie, at the same time, the "baffle" window itself can also use a keyboard shortcut to switch between display and hide-this allows you to change the subtitle "display" or "hide"-to facilitate the necessary subtitle reference.
[My implementation method]
In KDE, a shortcut key (F12 by default) is used to switch its explicit analog terminal program, yakuake, which can act as the "baffle" window above. By default, when it is hidden, the focus is in another window. Press the F12 key. The yakuake window is displayed and the focus is automatically transferred to the yakuake window. Then press the F12 key, yakuake is hidden and the focus is sent out.
If you use a normal GUI player to play a movie, the focus of the player's GUI window may be stolen when you switch to yakuake to hide it. This causes the shortcut key to control the playback of the movie to fail, however, if the KDE completely prohibits focus theft, the explicit/hidden switchover of yakuake will be affected because the switch mode of its window explicit/hidden shortcut keys also uses focus theft.
Later, I called the command-mode Mplayer ON THE yakuake terminal to play the movie. In this way, the Mplayer will use two windows to play the movie. One is the yakuake window to display information about the video progress, such as the playback progress, open a window to display the video. In this case, when the yakuake window is displayed and the focus is on it, the subtitles are blocked, at the same time, the shortcut key is effective for controlling the playback of movies-because the yakuake window is also used by Mplayer, that is, Mplayer still has a focus. When the yakuake window is hidden, it sends the focus to another window used to play the video, because this video window is also used by Mplayer, The Mplayer shortcut key is still valid for the video to be played.
In this way, the description in [to achieve results] is basically implemented.
[Improvements to implementation methods and problems encountered]
After all, the shortcut keys provided by Mplayer are limited. For example, it does not have the reread function, and this function is very helpful for language learning. So I want to improve it in this way, start emms mode of Emacs in yakuake. emms is a multimedia extension of Emacs. In fact, it creates a front-end of a media player in Emacs, for specific playback, you need to use other players, such as the Mplayer I use. emms can extend its command set by writing the elisp function, then, by writing some elisp functions related to the reread control to emms, emms can call Mplayer to implement the reread function. However, this improvement is imperfect, because when yakuake is displayed and focuses on it, Emacs-emms in the yakuake window shares the focus so that its reread control function is effective, however, when yakuake is hidden, because yakuake has sent the focus to the Mplayer video playback window, the Emacs-emms cannot control the playback because of the loss of focus. Of course, the Mplayer shortcut key is still valid, however, the replay function cannot be used.
My problem is how to enable Emacs-emms to control video playback regardless of whether the yakuake window is hidden-that is, the replay function does not expire because of yakuake's hiding. I think it is necessary to change the focus of yakuake: when a yakuake in the displayed status is called to hide by a shortcut key, the focus is not automatically sent out. Continue to focus until you use the mouse to operate in another window (of course, call yakuake from the hidden status when the status is displayed, it must be able to automatically obtain the focus, this cannot be changed ). However, I did not find the relevant settings in the settings of yakuake. It seems that I can only find a way to set the settings of X-window or window manager, however, I have no idea about the settings of X-window and window manager.
Hope you guys can take the time to help me see if this problem can be found in X-window. set it in Xfault or in the configuration file of window manager. If KDE is not configured properly, replace it with the configuration flexible FVWM window manager. you can set it in fvwmrc.
In fact, I want to give a brief explanation of this question, it is to set a specific program window to steal the focus of others through the shortcut key, but once it gets the focus, it cannot be stolen by others and it does not take the initiative to send out (even if the program itself is under certain circumstances by default) to actively send the focus, we also need to block it ), of course, you can always move the focus with the mouse.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.