LINUX.ORG.RU

История изменений

Исправление Zubok, (текущая версия) :

Замечу, что у меня это на некоторых приложениях не проходит. По той же вот причине, о которой я упомянул. Об этом упоминается также в документации xdotool. Но попробуйте.

(if (is (window_class) "Flashplayer") 
    (spawn_sync (str "/usr/bin/xdotool sleep 1 key --window "
		     (str (hex (window_xid))) " ctrl+f")))
SENDEVENT NOTES
       If you are trying to send key input to a specific window, and it does
       not appear to be working, then it's likely your application is ignoring
       the events xdotool is generating. This is fairly common.

       Sending keystrokes to a specific window uses a different API than
       simply typing to the active window. If you specify 'xdotool type
       --window 12345 hello' xdotool will generate key events and send them
       directly to window 12345.  However, X11 servers will set a special flag
       on all events generated in this way (see XEvent.xany.send_event in
       X11's manual). Many programs observe this flag and reject these events.

       It is important to note that for key and mouse events, we only use
       XSendEvent when a specific window is targeted. Otherwise, we use XTEST.

       Some programs can be configured to accept events even if they are
       generated by xdotool. Seek the documentation of your application for
       help.

Поэтому первое правило активирует окно и посылает активному окну комбинацию (используется XTEST, который всегда работает, но только для окна, имеющего фокус в данный момент), а второе правило - конкретному окну (используется XSendEvent, работает уже не всегда).

Исходная версия Zubok, :

Замечу, что у меня это на некоторых приложениях не проходит. По той же вот причине, о которой я упомянул. Об этом упоминается также в документации xdotool. Но попробуйте.

(if (is (window_class) "Flashplayer") 
    (spawn_sync (str "/usr/bin/xdotool sleep 1 key --window "
		     (str (hex (window_xid))) " ctrl+f")))
SENDEVENT NOTES
       If you are trying to send key input to a specific window, and it does
       not appear to be working, then it's likely your application is ignoring
       the events xdotool is generating. This is fairly common.

       Sending keystrokes to a specific window uses a different API than
       simply typing to the active window. If you specify 'xdotool type
       --window 12345 hello' xdotool will generate key events and send them
       directly to window 12345.  However, X11 servers will set a special flag
       on all events generated in this way (see XEvent.xany.send_event in
       X11's manual). Many programs observe this flag and reject these events.

       It is important to note that for key and mouse events, we only use
       XSendEvent when a specific window is targeted. Otherwise, we use XTEST.

       Some programs can be configured to accept events even if they are
       generated by xdotool. Seek the documentation of your application for
       help.