xserver / X11


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


general documentation for x
man X
plug / unplug monitors, set display resolution
man xrandr


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 -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]
man xdotool

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]
man wmctrl

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
man xclip