Index

Table of contents

xserver / X11

displays

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-1 --auto --pos 0x0 --output HDMI-1 --pos 1920x0 --output eDP-1 --auto --pos 960x1080
set resolution
xrandr --output [id] --mode 1920x1080
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]

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 window
xdotool windowmove [window_id] [x] [y]
get keysym
xev
send keyboard event
xdotool key odoubleacute
xdotool type 'őű'
get mouse location
xdotool getmouselocation
move mouse relative to current location
xdotool mousemove_relative [x] [y]
click with the mouse
xdotool click 1
xdotool click --repeat 100 1
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

input devices

list input devices
xinput list
disable device by id
xinput --disable [id]
enable device by id
xinput --enable [id]
show details for a device
xinput list-props [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