Skip to content

Instantly share code, notes, and snippets.

@mapix
Created January 28, 2013 02:10
Show Gist options
  • Save mapix/4652350 to your computer and use it in GitHub Desktop.
Save mapix/4652350 to your computer and use it in GitHub Desktop.
xinitrc for multi-monitor display in i3-wm
#!/bin/sh
#
# ~/.xinitrc
# Executed by startx (run your window manager from here)
# Set up screens and set background
if [ `xrandr | grep -c ' connected '` -eq 2 ]; then # dual-monitor
if [ `xrandr | grep VGA-1 | grep -c ' connected '` -eq 1 ]; then
xrandr --output LVDS-1 --auto --primary --output VGA-1 --auto --right-of LVDS-1
fi
if [ `xrandr | grep DVI-1 | grep -c ' connected '` -eq 1 ]; then
xrandr --output LVDS-1 --auto --primary --output DVI-1 --auto --right-of LVDS-1
fi
feh --bg-tile ~/Wallpapers/tile8.jpg
# xsetroot -solid \#cccccc
else
xrandr --output LVDS-1 --auto --primary --output VGA-1 --off --output DVI-1 --off
feh --bg-center ~/Wallpapers/paperart5.jpg
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment