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

Can someone explain how this makes sense electrically?

Drawing a topological "handle" with Tikz

Why did the HMS Bounty go back to a time when whales are already rare?

What is this type of notehead called?

Varistor? Purpose and principle

Journal losing indexing services

When quoting, must I also copy hyphens used to divide words that continue on the next line?

What's the difference between 違法 and 不法?

How do you respond to a colleague from another team when they're wrongly expecting that you'll help them?

Engineer refusing to file/disclose patents

Why do IPv6 unique local addresses have to have a /48 prefix?

Open a doc from terminal, but not by its name

Reply 'no position' while the job posting is still there

A Permanent Norse Presence in America

Freedom of speech and where it applies

How much character growth crosses the line into breaking the character

Is a model fitted to data or is data fitted to a model?

Can I use my Chinese passport to enter China after I acquired another citizenship?

Difference between -| and |- in TikZ

Greco-Roman egalitarianism

Will the technology I first learn determine the direction of my future career?

Divine apple island

How to color a curve

How will losing mobility of one hand affect my career as a programmer?



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 yesterday









        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







            Popular posts from this blog

            getting Checkpoint VPN SSL Network Extender working in the command lineHow to connect to CheckPoint VPN on Ubuntu 18.04LTS?Will the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayVPN SSL Network Extender in FirefoxLinux Checkpoint SNX tool configuration issuesCheck Point - Connect under Linux - snx + OTPSNX VPN Ububuntu 18.XXUsing Checkpoint VPN SSL Network Extender CLI with certificateVPN with network manager (nm-applet) is not workingWill the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayImport VPN config files to NetworkManager from command lineTrouble connecting to VPN using network-manager, while command line worksStart a VPN connection with PPTP protocol on command linestarting a docker service daemon breaks the vpn networkCan't connect to vpn with Network-managerVPN SSL Network Extender in FirefoxUsing Checkpoint VPN SSL Network Extender CLI with certificate

            Cannot Extend partition with GParted The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election ResultsCan't increase partition size with GParted?GParted doesn't recognize the unallocated space after my current partitionWhat is the best way to add unallocated space located before to Ubuntu 12.04 partition with GParted live?I can't figure out how to extend my Arch home partition into free spaceGparted Linux Mint 18.1 issueTrying to extend but swap partition is showing as Unknown in Gparted, shows proper from fdiskRearrange partitions in gparted to extend a partitionUnable to extend partition even though unallocated space is next to it using GPartedAllocate free space to root partitiongparted: how to merge unallocated space with a partition

            Marilyn Monroe Ny fiainany manokana | Jereo koa | Meny fitetezanafanitarana azy.