xdotool이 키보드 입력을 엉망으로 만듭니다.

xdotool이 키보드 입력을 엉망으로 만듭니다.

Linux에서 매크로를 기록하고 재생할 수 있는 xev 및 xdotool을 사용하여 몇 가지 스크립트를 만들려고 합니다. xev를 사용하여 녹음했는데 재생은 대부분 작동하지만 X 세션이 이상한 상태에 있는 것 같습니다. 다음과 같은 매크로 파일이 있습니다.

keydown e
keyup e
keydown c
keydown h
keyup c
keydown o
keyup h
keyup o
keydown space
keyup space
keydown apostrophe
keyup apostrophe
keydown h
keydown i
keyup h
keyup i
keydown apostrophe
keyup apostrophe

이것을 와 결합하려고 합니다 cat macro.txt | xargs xdotool. 그러면 터미널에 텍스트가 입력되지만 일단 완료되면 대부분의 키 입력이 더 이상 제어 문자를 인쇄하지 않거나 아무 작업도 수행하지 않습니다. 재설정하려면 컴퓨터를 몇 번 다시 시작해야 했습니다. 이것을 피하는 방법이나 무슨 일이 일어나고 있는지 아십니까? 아니면 좋은 Linux 매크로 도구가 무엇일까요?

답변1

Linux Mint의 키보드 단축키를 사용하여 나만의 맞춤 매크로를 만들고 맞춤 단축키를 추가했습니다. 나는 --clearmodifiers다음과 같이 사용하여 작동하게 만들었습니다 .

xdotool key --clearmodifiers Up

도움이 되는지 확인해 보세요.

또한 설명서에는 다음과 같이 나와 있습니다.

CLEARMODIFIERS --clearmodifiers 플래그가 있는 모든 명령은 명령 중에 활성 입력 수정자를 지우고 나중에 복원하려고 시도합니다.

   For example, if you were to run this command:
    xdotool key a

   The result would be 'a' or 'A' depending on whether or not you were holding the shift key on your keyboard. Often it is undesirable to have any modifiers active, so you can tell xdotool to clear any active modifiers.

   The order of operations if you hold shift while running 'xdotool key --clearmodifiers a' is this:

   1. Query for all active modifiers (finds shift, in this case)
   2. Try to clear shift by sending 'key up' for the shift key
   3. Runs normal 'xdotool key a'
   4. Restore shift key by sending 'key down' for shift

   The --clearmodifiers flag can currently clear of the following:

   ·   any key in your active keymap that has a modifier associated with it.  (See xmodmap(1)'s 'xmodmap -pm' output)

   ·   mouse buttons (1, 2, 3, 4, and 5)

   ·   caps lock

관련 정보