xdotool messes up keyboard input2019 Community Moderator ElectionGetting direct input from keyboard, ignoring XFiltering the keyboard inputCompile the Ubuntu “Raring” Kernel with the Intel Compilerlinux udev rule to load gadget module for client driverConnect a keyboard / IR controller to a command line program running in a screenType some text with xdotool independently of the keyboard layoutRapidFire input with xdotool and xbindkeysHow to combine conditions with xdotool?Xdotool action without focusingxdotool getmouselocation and getwindowgeometry Y location inconsistency

For airliners, what prevents wing strikes on landing in bad weather?

Word describing multiple paths to the same abstract outcome

Visiting the UK as unmarried couple

Golf game boilerplate

How can I raise concerns with a new DM about XP splitting?

What to do when my ideas aren't chosen, when I strongly disagree with the chosen solution?

Why is delta-v is the most useful quantity for planning space travel?

Did US corporations pay demonstrators in the German demonstrations against article 13?

How to check participants in at events?

Hostile work environment after whistle-blowing on coworker and our boss. What do I do?

What (else) happened July 1st 1858 in London?

Indicating multiple different modes of speech (fantasy language or telepathy)

Teaching indefinite integrals that require special-casing

Why are on-board computers allowed to change controls without notifying the pilots?

How do ultrasonic sensors differentiate between transmitted and received signals?

Can I create an upright 7-foot × 5-foot wall with the Minor Illusion spell?

Are taller landing gear bad for aircraft, particulary large airliners?

What is the opposite of 'gravitas'?

Simple recursive Sudoku solver

Lifted its hind leg on or lifted its hind leg towards?

Does "Dominei" mean something?

What do you call the infoboxes with text and sometimes images on the side of a page we find in textbooks?

Pronouncing Homer as in modern Greek

Can I rely on these GitHub repository files?



xdotool messes up keyboard input



2019 Community Moderator ElectionGetting direct input from keyboard, ignoring XFiltering the keyboard inputCompile the Ubuntu “Raring” Kernel with the Intel Compilerlinux udev rule to load gadget module for client driverConnect a keyboard / IR controller to a command line program running in a screenType some text with xdotool independently of the keyboard layoutRapidFire input with xdotool and xbindkeysHow to combine conditions with xdotool?Xdotool action without focusingxdotool getmouselocation and getwindowgeometry Y location inconsistency










3















I'm trying to create some scripts using xev and xdotool to allow me to record and re-play macros in linux. I've got the recording working with xev, and the replaying mostly works but appears to leave my X session in a weird state. I've got a macro file like this:



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


and I'm trying to use it with cat macro.txt | xargs xdotool. This types out my text in the terminal, but after it finishes, most of my keys don't work anymore; they either print out control characters, or they just don't do anything. I've had to restart my computer a couple times to get it re-set. Any idea how I can avoid this or what is going on? Or even what a good linux macro tool might be?










share|improve this question






















  • Does the sample you posted always cause that weird state, or only sometimes? Run xev from a terminal and, when the keys don't work, type one of the keys in the xev window and copy-paste the paragraph that begins with “KeyPress event”. Try pressing and releasing modifiers, in case the problem was a stuck modifier.

    – Gilles
    Mar 13 '17 at 23:39











  • I don't really want to try it again since I'll probably have to restart my computer, but it does seem like a stuck modifier, since it behaved differently each time I did it. The first time it just printed out a control character no matter what key I pressed; the second time it didn't print anything. Why would modifiers get stuck? This smells like a race condition, which would be weird.

    – jstaab
    Mar 14 '17 at 15:42















3















I'm trying to create some scripts using xev and xdotool to allow me to record and re-play macros in linux. I've got the recording working with xev, and the replaying mostly works but appears to leave my X session in a weird state. I've got a macro file like this:



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


and I'm trying to use it with cat macro.txt | xargs xdotool. This types out my text in the terminal, but after it finishes, most of my keys don't work anymore; they either print out control characters, or they just don't do anything. I've had to restart my computer a couple times to get it re-set. Any idea how I can avoid this or what is going on? Or even what a good linux macro tool might be?










share|improve this question






















  • Does the sample you posted always cause that weird state, or only sometimes? Run xev from a terminal and, when the keys don't work, type one of the keys in the xev window and copy-paste the paragraph that begins with “KeyPress event”. Try pressing and releasing modifiers, in case the problem was a stuck modifier.

    – Gilles
    Mar 13 '17 at 23:39











  • I don't really want to try it again since I'll probably have to restart my computer, but it does seem like a stuck modifier, since it behaved differently each time I did it. The first time it just printed out a control character no matter what key I pressed; the second time it didn't print anything. Why would modifiers get stuck? This smells like a race condition, which would be weird.

    – jstaab
    Mar 14 '17 at 15:42













3












3








3


1






I'm trying to create some scripts using xev and xdotool to allow me to record and re-play macros in linux. I've got the recording working with xev, and the replaying mostly works but appears to leave my X session in a weird state. I've got a macro file like this:



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


and I'm trying to use it with cat macro.txt | xargs xdotool. This types out my text in the terminal, but after it finishes, most of my keys don't work anymore; they either print out control characters, or they just don't do anything. I've had to restart my computer a couple times to get it re-set. Any idea how I can avoid this or what is going on? Or even what a good linux macro tool might be?










share|improve this question














I'm trying to create some scripts using xev and xdotool to allow me to record and re-play macros in linux. I've got the recording working with xev, and the replaying mostly works but appears to leave my X session in a weird state. I've got a macro file like this:



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


and I'm trying to use it with cat macro.txt | xargs xdotool. This types out my text in the terminal, but after it finishes, most of my keys don't work anymore; they either print out control characters, or they just don't do anything. I've had to restart my computer a couple times to get it re-set. Any idea how I can avoid this or what is going on? Or even what a good linux macro tool might be?







linux keyboard xdotool






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 13 '17 at 19:01









jstaabjstaab

1233




1233












  • Does the sample you posted always cause that weird state, or only sometimes? Run xev from a terminal and, when the keys don't work, type one of the keys in the xev window and copy-paste the paragraph that begins with “KeyPress event”. Try pressing and releasing modifiers, in case the problem was a stuck modifier.

    – Gilles
    Mar 13 '17 at 23:39











  • I don't really want to try it again since I'll probably have to restart my computer, but it does seem like a stuck modifier, since it behaved differently each time I did it. The first time it just printed out a control character no matter what key I pressed; the second time it didn't print anything. Why would modifiers get stuck? This smells like a race condition, which would be weird.

    – jstaab
    Mar 14 '17 at 15:42

















  • Does the sample you posted always cause that weird state, or only sometimes? Run xev from a terminal and, when the keys don't work, type one of the keys in the xev window and copy-paste the paragraph that begins with “KeyPress event”. Try pressing and releasing modifiers, in case the problem was a stuck modifier.

    – Gilles
    Mar 13 '17 at 23:39











  • I don't really want to try it again since I'll probably have to restart my computer, but it does seem like a stuck modifier, since it behaved differently each time I did it. The first time it just printed out a control character no matter what key I pressed; the second time it didn't print anything. Why would modifiers get stuck? This smells like a race condition, which would be weird.

    – jstaab
    Mar 14 '17 at 15:42
















Does the sample you posted always cause that weird state, or only sometimes? Run xev from a terminal and, when the keys don't work, type one of the keys in the xev window and copy-paste the paragraph that begins with “KeyPress event”. Try pressing and releasing modifiers, in case the problem was a stuck modifier.

– Gilles
Mar 13 '17 at 23:39





Does the sample you posted always cause that weird state, or only sometimes? Run xev from a terminal and, when the keys don't work, type one of the keys in the xev window and copy-paste the paragraph that begins with “KeyPress event”. Try pressing and releasing modifiers, in case the problem was a stuck modifier.

– Gilles
Mar 13 '17 at 23:39













I don't really want to try it again since I'll probably have to restart my computer, but it does seem like a stuck modifier, since it behaved differently each time I did it. The first time it just printed out a control character no matter what key I pressed; the second time it didn't print anything. Why would modifiers get stuck? This smells like a race condition, which would be weird.

– jstaab
Mar 14 '17 at 15:42





I don't really want to try it again since I'll probably have to restart my computer, but it does seem like a stuck modifier, since it behaved differently each time I did it. The first time it just printed out a control character no matter what key I pressed; the second time it didn't print anything. Why would modifiers get stuck? This smells like a race condition, which would be weird.

– jstaab
Mar 14 '17 at 15:42










1 Answer
1






active

oldest

votes


















0














I made my own custom macro using Linux Mint's Keyboard Shortcuts and adding a custom shortcut. I managed to get it to work by using --clearmodifiers, like so:



xdotool key --clearmodifiers Up



See if that helps.



Also, here's what the manual says on it:




CLEARMODIFIERS
Any command taking the --clearmodifiers flag will attempt to clear any active input modifiers during the command and restore them
afterwards.



 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






share|improve this answer








New contributor




Andrew is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f351223%2fxdotool-messes-up-keyboard-input%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    I made my own custom macro using Linux Mint's Keyboard Shortcuts and adding a custom shortcut. I managed to get it to work by using --clearmodifiers, like so:



    xdotool key --clearmodifiers Up



    See if that helps.



    Also, here's what the manual says on it:




    CLEARMODIFIERS
    Any command taking the --clearmodifiers flag will attempt to clear any active input modifiers during the command and restore them
    afterwards.



     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






    share|improve this answer








    New contributor




    Andrew is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.
























      0














      I made my own custom macro using Linux Mint's Keyboard Shortcuts and adding a custom shortcut. I managed to get it to work by using --clearmodifiers, like so:



      xdotool key --clearmodifiers Up



      See if that helps.



      Also, here's what the manual says on it:




      CLEARMODIFIERS
      Any command taking the --clearmodifiers flag will attempt to clear any active input modifiers during the command and restore them
      afterwards.



       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






      share|improve this answer








      New contributor




      Andrew is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















        0












        0








        0







        I made my own custom macro using Linux Mint's Keyboard Shortcuts and adding a custom shortcut. I managed to get it to work by using --clearmodifiers, like so:



        xdotool key --clearmodifiers Up



        See if that helps.



        Also, here's what the manual says on it:




        CLEARMODIFIERS
        Any command taking the --clearmodifiers flag will attempt to clear any active input modifiers during the command and restore them
        afterwards.



         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






        share|improve this answer








        New contributor




        Andrew is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.










        I made my own custom macro using Linux Mint's Keyboard Shortcuts and adding a custom shortcut. I managed to get it to work by using --clearmodifiers, like so:



        xdotool key --clearmodifiers Up



        See if that helps.



        Also, here's what the manual says on it:




        CLEARMODIFIERS
        Any command taking the --clearmodifiers flag will attempt to clear any active input modifiers during the command and restore them
        afterwards.



         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







        share|improve this answer








        New contributor




        Andrew is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        share|improve this answer



        share|improve this answer






        New contributor




        Andrew is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        answered 2 days ago









        AndrewAndrew

        1012




        1012




        New contributor




        Andrew is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.





        New contributor





        Andrew is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






        Andrew is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f351223%2fxdotool-messes-up-keyboard-input%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            -keyboard, linux, xdotool

            Popular posts from this blog

            Frič See also Navigation menuinternal link

            Identify plant with long narrow paired leaves and reddish stems Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?What is this plant with long sharp leaves? Is it a weed?What is this 3ft high, stalky plant, with mid sized narrow leaves?What is this young shrub with opposite ovate, crenate leaves and reddish stems?What is this plant with large broad serrated leaves?Identify this upright branching weed with long leaves and reddish stemsPlease help me identify this bulbous plant with long, broad leaves and white flowersWhat is this small annual with narrow gray/green leaves and rust colored daisy-type flowers?What is this chilli plant?Does anyone know what type of chilli plant this is?Help identify this plant

            fontconfig warning: “/etc/fonts/fonts.conf”, line 100: unknown “element blank” The 2019 Stack Overflow Developer Survey Results Are In“tar: unrecognized option --warning” during 'apt-get install'How to fix Fontconfig errorHow do I figure out which font file is chosen for a system generic font alias?Why are some apt-get-installed fonts being ignored by fc-list, xfontsel, etc?Reload settings in /etc/fonts/conf.dTaking 30 seconds longer to boot after upgrade from jessie to stretchHow to match multiple font names with a single <match> element?Adding a custom font to fontconfigRemoving fonts from fontconfig <match> resultsBroken fonts after upgrading Firefox ESR to latest Firefox