Index

xserver / X11

displays

list display resolutions and positioning
xrandr | grep ' connected '
get total desktop size
expr "$(xdpyinfo | grep dimensions)" ':' '[^0-9]*\([^ ]*\)'

documentation

general documentation for x
man X
http://manpages.ubuntu.com/manpages/disco/en/man7/X.7.html
plug / unplug monitors, set display resolution
man xrandr
http://manpages.ubuntu.com/manpages/disco/en/man1/xrandr.1.html

windows

list windows [id] [desktop] [machine] [title]
wmctrl -l
list windows with geometry [id] [desktop] [x] [y] [w] [h] [machine] [title]
wmctrl -l -G
list windows with pid [id] [pid] [desktop] [machine] [title]
wmctrl -l -G
get sizes of window borders (left, right, top, bottom)
xprop _NET_FRAME_EXTENTS -id [id] | grep "NET_FRAME_EXTENTS"
get id of active window as hex
xprop -root | sed -r -n '/ACTIVE_WINDOW\(/{s|[^#]*# ?||;p}'
print all properties for window
xprop -id [id]
get maximization info
xprop -id [id] _NET_WM_STATE
information on windows x,y,w,h
xwininfo
xwininfo -id [id]
xwininfo -id [id] -all

xdotool (simulate keyboard and mouse, window move and resize)

get active window id as int
xdotool getactivewindow
move indow
xdotool windowmove [window_id] [x] [y]
get keysym
xev
send keyboard event
xdotool key odoubleacute
xdotool type 'őű'
documentation
man xdotool
http://manpages.ubuntu.com/manpages/disco/man1/xdotool.1.html

wmctrl (resize windows, add or remove desktops)

specify window id as hex
wmctl -r [id]
specify window id as int
wmctl -i -r [id]
focus first window with title containing [query] and give it focus
wmctrl -a [query]
place window with id [id] above all other windows on the same desktop
wmctrl -r [id] -b add,above
place window with id [id] below all other windows on the same desktop
wmctrl -r [id] -b add,below
maximize active window
wmctrl -r :ACTIVE: -b add,maximized_vert,maximized_horz
toggle fullscreen active window
wmctrl -r :ACTIVE: -b toggle,fullscreen
remove fullscreen active window
wmctrl -r :ACTIVE: -b remove,fullscreen
move and resize active window
wmctrl -r :ACTIVE: -e [gravity],[x],[y],[width],[height]
change title of active window
wmctrl -r :ACTIVE: -T [title]
set the number of desktops to [n]
wmctrl -n [n]
go to desktop [n]
wmctrl -s [n]
move active window to desktop [n]
wmctrl -r :ACTIVE: -t [n]
documentation
man wmctrl
http://manpages.ubuntu.com/manpages/disco/en/man1/wmctrl.1.html

system clipboard

install xclip
sudo apt-get install xclip
piping content to the mouse selection clipboard
cat file | xclip
selecting the system clipboard instead of mouse selection clipboard
echo -n "1234" | xclip -selection clipboard
print contents of system clipboard
xclip -o -selection clipboard
documentation
man xclip
http://manpages.org/xclip