Skip to content

Instantly share code, notes, and snippets.

@monokrome
Created July 2, 2012 18:50
Show Gist options
  • Select an option

  • Save monokrome/3034871 to your computer and use it in GitHub Desktop.

Select an option

Save monokrome/3034871 to your computer and use it in GitHub Desktop.
My Macbook Air video configuration script for ArchLinux / DWM.
#!/bin/sh
# Configuration file for my roaming profile. Disables external monitors.
xrandr --output HDMI1 --off
#!/bin/sh
# Enables the monitor configuration at my office.
xrandr --output HDMI1 --auto
xrandr --output HDMI1 --pos 1441x0
#!/bin/bash
# Provides a simple wrapper to load configuration files by name.
#
# IE: `update-outputs office` would execute the `office.sh` script
# in ~/.config/monitors/
requested_configuration="$1"
configurations_directory="${HOME}/.config/monitors/"
configuration_filename="${configurations_directory}${requested_configuration}.sh"
fallback_filename="${configurations_directory}default.sh"
if [[ -f "${configuration_filename}" ]]; then
printf "Executing configuration: ${requested_configuration}\n"
exec "${configuration_filename}"
else
if [[ "${requested_configuration}" != "" ]]; then
printf "Configuration not found for: ${requested_configuration}\nReverting to default.\n"
fi
exec "${fallback_filename}"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment