[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
howtos:window_managers:dual_monitors [2016/01/04 07:57 (UTC)] arfonhowtos:window_managers:dual_monitors [2016/01/12 03:31 (UTC)] – [Cool Switching Scripts] arfon
Line 56: Line 56:
  
  
 +====== Cool Switching Scripts ======
 +Here's a script I wrote to toggle between extended dual monitors and a single monitor-
 +<code>
 +#!/bin/bash
 +vPRIMARYMONITOR="DVI-I-0" # <--- CHANGE THIS.  Find using "xrandr -q"
 +vLOC="--right" # <--- Change this if you want the second monitor in another position. CHOICES: --above  --below  --left  --right
 +vEXT=$(xrandr -q | grep " connected" | grep -v $vPRIMARYMONITOR | awk '{print $1}' | head -n 1 )
 +vOnOff=$(xrandr -q | grep $vEXT | sed 's/primary//g' | awk '{print $3}'| sed 's/[0-9]*x[0-9]*+[0-9]*+[0-9]*/ON/g' )
 +[ "$vOnOff" != "ON" ] && vOnOff="OFF"
 +if [ "$vOnOff" = "OFF" ]; then
 +        /usr/bin/xrandr --output $vEXT --auto $vLOC $vPRIMARYMONITOR
 +        else
 +        /usr/bin/xrandr --output $vEXT --off
 +        fi
 +
 +</code>
 +
 +Script to toggle a mirrored monitor-
 +<code>
 +#!/bin/bash
 +vPRIMARYMONITOR="DVI-I-0" # <--- CHANGE THIS.  Find using "xrandr -q"
 +vEXT=$(xrandr -q | grep " connected" | grep -v $vPRIMARYMONITOR | awk '{print $1}' | head -n 1 )
 +vOnOff=$(xrandr -q | grep $vEXT | sed 's/primary//g' | awk '{print $3}'| sed 's/[0-9]*x[0-9]*+[0-9]*+[0-9]*/ON/g' )
 +[ "$vOnOff" != "ON" ] && vOnOff="OFF"
 +if [ "$vOnOff" = "OFF" ]; then
 + /usr/bin/xrandr --output $vEXT --auto
 + else
 + /usr/bin/xrandr --output $vEXT --off
 + fi
 +</code>
  
  
 howtos:window_managers:dual_monitors ()