Paste timestamp hotkey?
Clash 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.
keyboard-shortcuts
add a comment |Â
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.
keyboard-shortcuts
1
What is your operating environment? Linux, NetBSD, Solaris? And GUI (which?) or text console?
â Jeff Schaller
May 9 at 14:14
add a comment |Â
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.
keyboard-shortcuts
I would like to press a selected hotkey to paste a timestamp in the YYYYMMDDHHmmSS format 20180509145153 immediately, like AutoHotKey allows on Windows.
keyboard-shortcuts
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
add a comment |Â
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
add a comment |Â
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
add a comment |Â
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
add a comment |Â
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
add a comment |Â
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
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
edited May 9 at 14:40
answered May 9 at 14:32
Stéphane Chazelas
279k53513845
279k53513845
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
What is your operating environment? Linux, NetBSD, Solaris? And GUI (which?) or text console?
â Jeff Schaller
May 9 at 14:14