xserver / X11


list display resolutions and positioning
xrandr | grep ' connected '
get total desktop size
expr "$(xdpyinfo | grep dimensions)" ':' '[^0-9]*\([^ ]*\)'
turn off display by id (e.g. HDMI-1)
xrandr --output [id] --off
turn on display by id with default settings
xrandr --output [id] --auto
turn on display cloning another display
xrandr --output [id] --auto --same-as [other]
turn on display by id in a position relative to another display (xinerama)
xrandr --output [id] --auto --above [other]
xrandr --output [id] --auto --below [other]
xrandr --output [id] --auto --left-of [other]
xrandr --output [id] --auto --right-of [other]
manual positioning
xrandr --output [id] --auto --pos[x]x[y]
example: positioning 3 monitors manually in one call
xrandr --output DP-2 --auto --pos 0x0 --output HDMI-1 --pos 1920x0 --output eDP-1 --auto --pos 960x1080
set desktop background
xsetroot -solid "#333333"
set background image
feh --bg-center [image]
select random image per display from folder
feh --randomize --bg-fill [firectory]


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 window
xdotool windowmove [window_id] [x] [y]
get keysym
send keyboard event
xdotool key odoubleacute
xdotool type 'őű'
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

input devices

list input devices
xinput list
disable device by id
xinput --disable [id]
enable device by id
xinput --enable [id]
auto hide mouse
sudo apt-get install unclutter
unclutter -idle 0.4 -root

power management

disable screensaver
xset s off
disable display power management (screen sleep)
xset -dpms
ensable display power management (screen sleep)
xset +dpms