From 41268e1ece602047a0bdf9ec85d9de024943bb6b Mon Sep 17 00:00:00 2001 From: John Gebbie Date: Thu, 11 May 2023 11:16:22 +0100 Subject: [PATCH] minor usage formatting --- README.md | 7 +++---- dotool.go | 60 +++++++++++++++++++++++++++---------------------------- dotoolc | 7 +++---- dotoold | 7 +++---- 4 files changed, 38 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index 6cac656..1caf283 100644 --- a/README.md +++ b/README.md @@ -45,10 +45,9 @@ keep writing commands to the same instance or use the daemon and client, ## Keyboard Layouts -dotool will produce gobbledygook if your environment has assigned it a -different keyboard layout than it's simulating keycodes for. You can -match them up with the environment variables `DOTOOL_XKB_LAYOUT` and -`DOTOOL_XKB_VARIANT`. +dotool will type gobbledygook if your environment has assigned it a different +keyboard layout than it's simulating keycodes for. You can match them up +with the environment variables `DOTOOL_XKB_LAYOUT` and `DOTOOL_XKB_VARIANT`. echo type azerty | DOTOOL_XKB_LAYOUT=fr dotool diff --git a/dotool.go b/dotool.go index 53626cf..aa02747 100644 --- a/dotool.go +++ b/dotool.go @@ -21,21 +21,21 @@ func usage() { fmt.Println(`dotool reads commands from stdin and simulates keyboard and pointer events. The commands are: - key CHORD... - keydown CHORD... - keyup CHORD... - type TEXT - click left/middle/right - buttondown left/middle/right - buttonup left/middle/right - wheel AMOUNT (a positive AMOUNT is up, a negative is down) - hwheel AMOUNT (a positive AMOUNT is right, a negative is left) - mouseto X Y (where X and Y are percentages between 0.0 and 1.0) - mousemove X Y (where X and Y are the number of pixels to move) - keydelay MILLISECONDS (default: 2) - keyhold MILLISECONDS (default: 8) - typedelay MILLISECONDS (default: 2) - typehold MILLISECONDS (default: 8) + key CHORD... + keydown CHORD... + keyup CHORD... + type TEXT + click left/middle/right + buttondown left/middle/right + buttonup left/middle/right + wheel AMOUNT (a positive AMOUNT is up, a negative is down) + hwheel AMOUNT (a positive AMOUNT is right, a negative is left) + mouseto X Y (where X and Y are percentages between 0.0 and 1.0) + mousemove X Y (where X and Y are the number of pixels to move) + keydelay MILLISECONDS (default: 2) + keyhold MILLISECONDS (default: 8) + typedelay MILLISECONDS (default: 2) + typehold MILLISECONDS (default: 8) dotool is installed with a udev rule to allow users in group input to run @@ -43,8 +43,8 @@ it without root permissions. You can add yourself to group input by running: - sudo groupadd -f input - sudo usermod -a -G input $USER + sudo groupadd -f input + sudo usermod -a -G input $USER It's foolproof to reboot to make the rule effective. @@ -55,37 +55,35 @@ uppercase character keys also simulate shift. The modifiers are: super, ctrl, alt and shift. - echo key shift+1 x:exclam shift+k:2 | dotool + echo key shift+1 x:exclam shift+k:2 | dotool There is an initial delay registering the virtual devices, but you can keep writing commands to the same instance or use the daemon and client, dotoold and dotoolc. - { echo keydown A; sleep 3; echo key H shift+1; } | dotool + { echo keydown A; sleep 3; echo key H shift+1; } | dotool - dotoold & - echo type super | dotoolc - echo type speedy | dotoolc + dotoold & + echo type super | dotoolc + echo type speedy | dotoolc -dotool will produce gobbledygook if your environment has assigned it a -different keyboard layout than it's simulating keycodes for. You can -match them up with the environment variables DOTOOL_XKB_LAYOUT and -DOTOOL_XKB_VARIANT. +dotool will type gobbledygook if your environment has assigned it a different +keyboard layout than it's simulating keycodes for. You can match them up +with the environment variables DOTOOL_XKB_LAYOUT and DOTOOL_XKB_VARIANT. - echo type azerty | DOTOOL_XKB_LAYOUT=fr dotool + echo type azerty | DOTOOL_XKB_LAYOUT=fr dotool --list-keys - Print the possible Linux keys and exit. + Print the possible Linux keys and exit. --list-x-keys - Print the possible XKB keys and exit. + Print the possible XKB keys and exit. --version - Print the version and exit. -`) + Print the version and exit.`) } func fatal(a ...any) { diff --git a/dotoolc b/dotoolc index b5db6e8..e2f7bba 100755 --- a/dotoolc +++ b/dotoolc @@ -1,9 +1,8 @@ #!/bin/sh if [ $# != 0 ]; then - echo 'dotoolc writes its stdin to the pipe being read by dotoold. -dotoolc will exit immediately if the pipe is not being read. -The path of the pipe is $DOTOOL_PIPE else /tmp/dotool-pipe. -' >&2 + echo 'dotoolc writes its stdin to the pipe being read by dotoold. dotoolc will +exit immediately if the pipe is not being read. The path of the pipe +is $DOTOOL_PIPE else /tmp/dotool-pipe.' >&2 [ "$1" = -h ] || [ "$1" = --help ]; exit fi diff --git a/dotoold b/dotoold index 049d35e..d2d39a3 100755 --- a/dotoold +++ b/dotoold @@ -1,9 +1,8 @@ #!/bin/sh if [ $# != 0 ]; then - echo 'dotoold runs dotool reading from a pipe for dotoolc to write to. -dotoold will exit immediately if the pipe is already being read. -The path used for the pipe is $DOTOOL_PIPE else /tmp/dotool-pipe. -' >&2 + echo 'dotoold runs dotool reading from a pipe for dotoolc to write to. dotoold +will exit immediately if the pipe is already being read. The path used +for the pipe is $DOTOOL_PIPE else /tmp/dotool-pipe.' >&2 [ "$1" = -h ] || [ "$1" = --help ]; exit fi