Skip to content

Instantly share code, notes, and snippets.

@MantasVaitkunas
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MantasVaitkunas/8839628 to your computer and use it in GitHub Desktop.
Save MantasVaitkunas/8839628 to your computer and use it in GitHub Desktop.
dbus-send --system --print-reply \
--dest="org.freedesktop.UPower" \
/org/freedesktop/UPower \
org.freedesktop.UPower.Suspend
#!/bin/bash
# Author: Andrew Martin
# Credit: http://ubuntuforums.org/showthread.php?t=1309247
echo "Enter the primary display from the following:" # prompt for the display
xrandr --prop | grep "[^dis]connected" | cut --delimiter=" " -f1 # query connected monitors
read choice # read the users's choice of monitor
xrandr --output $choice --primary # set the primary monitor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment