Paste timestamp hotkey?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I would like to press a selected hotkey to paste a timestamp in the YYYYMMDDHHmmSS format 20180509145153 immediately, like AutoHotKey allows on Windows.







share|improve this question















  • 1




    What is your operating environment? Linux, NetBSD, Solaris? And GUI (which?) or text console?
    – Jeff Schaller
    May 9 at 14:14














up vote
1
down vote

favorite












I would like to press a selected hotkey to paste a timestamp in the YYYYMMDDHHmmSS format 20180509145153 immediately, like AutoHotKey allows on Windows.







share|improve this question















  • 1




    What is your operating environment? Linux, NetBSD, Solaris? And GUI (which?) or text console?
    – Jeff Schaller
    May 9 at 14:14












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I would like to press a selected hotkey to paste a timestamp in the YYYYMMDDHHmmSS format 20180509145153 immediately, like AutoHotKey allows on Windows.







share|improve this question











I would like to press a selected hotkey to paste a timestamp in the YYYYMMDDHHmmSS format 20180509145153 immediately, like AutoHotKey allows on Windows.









share|improve this question










share|improve this question




share|improve this question









asked May 9 at 13:53









neverMind9

22110




22110







  • 1




    What is your operating environment? Linux, NetBSD, Solaris? And GUI (which?) or text console?
    – Jeff Schaller
    May 9 at 14:14












  • 1




    What is your operating environment? Linux, NetBSD, Solaris? And GUI (which?) or text console?
    – Jeff Schaller
    May 9 at 14:14







1




1




What is your operating environment? Linux, NetBSD, Solaris? And GUI (which?) or text console?
– Jeff Schaller
May 9 at 14:14




What is your operating environment? Linux, NetBSD, Solaris? And GUI (which?) or text console?
– Jeff Schaller
May 9 at 14:14










1 Answer
1






active

oldest

votes

















up vote
0
down vote













You could do it at different levels depending on where you want it to happen. For instance, you could configure your shell or prefered text editor to do that, but that would only affect them.



Or you could configure screen/tmux or your terminal emulator to do it and it would affect commands running in that terminal emulator when the terminal emulator is the active window.



Under X11, you could use xbindkey to handle a specific key or key combination and have it simulate a series of keypress and keyrelease events (using xte or xdotool for instance). Which would work for any application connecting to the same X server and is active.



For instance, add to your ~/.xbindkeyrc:



"sleep 0.1; xdotool type --clearmodifiers $(date +%Y%m%d%H%M%S)"
control+space


For that timestamp to be sent as a series of key press upon Ctrl+Space. (I find that if I don't add the sleep 0.1, I'm sometimes missing the start of the timestamp).



Another option would be to store the timestamp as the PRIMARY X11 selection and simulate a middle mouse button click, which for many application causes the content of the PRIMARY selection to be inserted at the current mouse pointer position. In ~/.xbindkeyrc:



"date +%Y%m%d%H%M%S | tr -d 'n' | xclip; sleep 0.1; exec xdotool click --clearmodifiers 2"
control+space





share|improve this answer























    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',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    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%2f442777%2fpaste-timestamp-hotkey%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    You could do it at different levels depending on where you want it to happen. For instance, you could configure your shell or prefered text editor to do that, but that would only affect them.



    Or you could configure screen/tmux or your terminal emulator to do it and it would affect commands running in that terminal emulator when the terminal emulator is the active window.



    Under X11, you could use xbindkey to handle a specific key or key combination and have it simulate a series of keypress and keyrelease events (using xte or xdotool for instance). Which would work for any application connecting to the same X server and is active.



    For instance, add to your ~/.xbindkeyrc:



    "sleep 0.1; xdotool type --clearmodifiers $(date +%Y%m%d%H%M%S)"
    control+space


    For that timestamp to be sent as a series of key press upon Ctrl+Space. (I find that if I don't add the sleep 0.1, I'm sometimes missing the start of the timestamp).



    Another option would be to store the timestamp as the PRIMARY X11 selection and simulate a middle mouse button click, which for many application causes the content of the PRIMARY selection to be inserted at the current mouse pointer position. In ~/.xbindkeyrc:



    "date +%Y%m%d%H%M%S | tr -d 'n' | xclip; sleep 0.1; exec xdotool click --clearmodifiers 2"
    control+space





    share|improve this answer



























      up vote
      0
      down vote













      You could do it at different levels depending on where you want it to happen. For instance, you could configure your shell or prefered text editor to do that, but that would only affect them.



      Or you could configure screen/tmux or your terminal emulator to do it and it would affect commands running in that terminal emulator when the terminal emulator is the active window.



      Under X11, you could use xbindkey to handle a specific key or key combination and have it simulate a series of keypress and keyrelease events (using xte or xdotool for instance). Which would work for any application connecting to the same X server and is active.



      For instance, add to your ~/.xbindkeyrc:



      "sleep 0.1; xdotool type --clearmodifiers $(date +%Y%m%d%H%M%S)"
      control+space


      For that timestamp to be sent as a series of key press upon Ctrl+Space. (I find that if I don't add the sleep 0.1, I'm sometimes missing the start of the timestamp).



      Another option would be to store the timestamp as the PRIMARY X11 selection and simulate a middle mouse button click, which for many application causes the content of the PRIMARY selection to be inserted at the current mouse pointer position. In ~/.xbindkeyrc:



      "date +%Y%m%d%H%M%S | tr -d 'n' | xclip; sleep 0.1; exec xdotool click --clearmodifiers 2"
      control+space





      share|improve this answer

























        up vote
        0
        down vote










        up vote
        0
        down vote









        You could do it at different levels depending on where you want it to happen. For instance, you could configure your shell or prefered text editor to do that, but that would only affect them.



        Or you could configure screen/tmux or your terminal emulator to do it and it would affect commands running in that terminal emulator when the terminal emulator is the active window.



        Under X11, you could use xbindkey to handle a specific key or key combination and have it simulate a series of keypress and keyrelease events (using xte or xdotool for instance). Which would work for any application connecting to the same X server and is active.



        For instance, add to your ~/.xbindkeyrc:



        "sleep 0.1; xdotool type --clearmodifiers $(date +%Y%m%d%H%M%S)"
        control+space


        For that timestamp to be sent as a series of key press upon Ctrl+Space. (I find that if I don't add the sleep 0.1, I'm sometimes missing the start of the timestamp).



        Another option would be to store the timestamp as the PRIMARY X11 selection and simulate a middle mouse button click, which for many application causes the content of the PRIMARY selection to be inserted at the current mouse pointer position. In ~/.xbindkeyrc:



        "date +%Y%m%d%H%M%S | tr -d 'n' | xclip; sleep 0.1; exec xdotool click --clearmodifiers 2"
        control+space





        share|improve this answer















        You could do it at different levels depending on where you want it to happen. For instance, you could configure your shell or prefered text editor to do that, but that would only affect them.



        Or you could configure screen/tmux or your terminal emulator to do it and it would affect commands running in that terminal emulator when the terminal emulator is the active window.



        Under X11, you could use xbindkey to handle a specific key or key combination and have it simulate a series of keypress and keyrelease events (using xte or xdotool for instance). Which would work for any application connecting to the same X server and is active.



        For instance, add to your ~/.xbindkeyrc:



        "sleep 0.1; xdotool type --clearmodifiers $(date +%Y%m%d%H%M%S)"
        control+space


        For that timestamp to be sent as a series of key press upon Ctrl+Space. (I find that if I don't add the sleep 0.1, I'm sometimes missing the start of the timestamp).



        Another option would be to store the timestamp as the PRIMARY X11 selection and simulate a middle mouse button click, which for many application causes the content of the PRIMARY selection to be inserted at the current mouse pointer position. In ~/.xbindkeyrc:



        "date +%Y%m%d%H%M%S | tr -d 'n' | xclip; sleep 0.1; exec xdotool click --clearmodifiers 2"
        control+space






        share|improve this answer















        share|improve this answer



        share|improve this answer








        edited May 9 at 14:40


























        answered May 9 at 14:32









        Stéphane Chazelas

        279k53513845




        279k53513845






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f442777%2fpaste-timestamp-hotkey%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay