You are not logged in.
Desired end result: Print the current time into the focused window by way of a keyboard shortcut.
Chosen tool for task: xdotool
Problem: xdotool output missing after pressing keyboard shortcut.
This works:
xdotool type $(date +"%H:%M")
This works:
#!/bin/sh
xdotool type $(date +"%H:%M")
touch /tmp/IT_WORKS
$ /usr/bin/timestamp
$ 11:28
$ file /tmp/IT_WORKS
/tmp/IT_WORKS: empty
This also works:
ALT+F2
/usr/bin/timestamp
12:04 <- The current time is printed directly to the focused window and /tmp/IT_WORKS is created.
However, when calling /usr/bin/timestamp from a keyboard shortcut xdotool output is missing while /tmp/IT_WORKS is again created.
Suggestions?
Offline
I think it has something to do with timing (activewindow doesn't have a chance to be set?). Try:
sleep .1s && xdotool type $(date +"%H:%M")
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
Sure enough a 1 second sleep did it. Thanks!
Offline