m1gin

#xdotool #xvkbd #linux #ubuntu #automation

Get info about a window by clicking on it:

  • xwininfo  -tree

Inspect an app:

  • gsettings set org.gtk.Settings.Debug enable-inspector-keybinding true;   GTK_DEBUG=interactive geany



xdotool

Send key to a background (unfocused) window:

  • win=$(xdotool search --onlyvisible --class mpv | head -1); xdotool key --clearmodifiers --window $win Ctrl+q
  • xdotool search --class vlc key space

Some applications (like scite) looks like needs to be activated to accept keys

  • xdotool windowactivate --sync $(xdotool search --name Scite | tail -1) type "text abc" && xdotool key KP_Enter Return

click mouse repeatedly by interval:

  • xdotool click --repeat 33 --delay 11000 1

minimize window by process id:

  • xdotool windowminimize `xdotool search --pid $pid | tail -1` 

minimize active window:

  • xdotool getactivewindow windowminimize

minimize window by part of its title:

  • xdotool windowminimize $(xdotool search --name Geany | tail -1) 

activate window and type text:

  • xdotool windowactivate --sync $(xdotool search --name Geany | tail -1) type "text abc" && xdotool key KP_Enter Return

paste from clipboard to another app:

  • xdotool windowactivate --sync  $(xdotool search --name Scite | tail -1); xdotool key ctrl+v 

get window id by clicking on it:

  • xdotool selectwindow

auto move cursor down and press hotkey:

  • while true; do sleep 5; xdotool key Down; sleep 0.5; xdotool key ctrl+o;  done;


Control Mouse Using Terminal
$ xdotool mousemove 0 0 click 1
$ xdotool mousemove 100 30
$ xdotool click 1
$ xdotool type "hello"


xvkbd - virtual keyboard for X window system

Send text to specific app. (No needed to be focused)

  • xvkbd -window scite -no-repeat -text  "Hello world"
  • xvkbd -window scite -no-repeat -text "hello world \Ch\C world\t\t earth\Aa\A"

Switch to scite window, type "hello world" then press Ctrl+H to open Find-Replace, type world, press tab 2 times then press Alt+A to replace all.


Reference: http://t-sato.in.coocan.jp/xvkbd/


Similar Tools: xmacro , xremote

Add to: