3 94fd26e6 2014-05-29 xhr Small bash script that uses `xrandr` to configure internal/external displays. I use it here with Arch Linux and i3 whenever I connect one or more external displays.
5 94fd26e6 2014-05-29 xhr I use the toggle option with the `XF86Display` key (Fn + F7) on my Thinkpad:
8 1efd7a9d 2014-05-30 xhr bindsym XF86Display exec "~/Documents/bin/dtoggle -t"
11 1efd7a9d 2014-05-30 xhr ## Usage Scenarios
13 e0985cf2 2014-05-29 xhr ### Connected to a projector
15 1efd7a9d 2014-05-30 xhr You connect your laptop to a projector and you do not have (the time to cerate) a profile. Just use the -t option to switch between all displays options on all connected displays.
21 e0985cf2 2014-05-29 xhr ### Switch between the laptop display and a docking station with connected displays
23 1efd7a9d 2014-05-30 xhr Add a profile named *foo* and use -p foo once you dock in or out.
26 1efd7a9d 2014-05-30 xhr dtoggle -p foo -e
29 1efd7a9d 2014-05-30 xhr ## Config File
31 e0985cf2 2014-05-29 xhr dtoggle can read the to be used profile from a config file in `$HOME/.dtoggle.conf`. If the config file is not present you have to specify the profile using the -p option. The file looks as follows:
34 94fd26e6 2014-05-29 xhr # Set your desired profile here
38 1efd7a9d 2014-05-30 xhr ## Command Line Options
41 e0985cf2 2014-05-29 xhr dtoggle [-ceix] [-hmntv] [-lr] -p profile
43 be6d11c1 2013-07-01 schmidt.m Display Options:
44 be6d11c1 2013-07-01 schmidt.m -c Clone screen on all displays
45 be6d11c1 2013-07-01 schmidt.m -e Enable external display(s) and disable internal
46 be6d11c1 2013-07-01 schmidt.m -i Enable only the internal display
47 be6d11c1 2013-07-01 schmidt.m -x Extend screen to all displays [default]
49 be6d11c1 2013-07-01 schmidt.m General Options:
50 ea40b928 2014-05-29 xhr -h Show this help
51 be6d11c1 2013-07-01 schmidt.m -m Show all available modes
52 be6d11c1 2013-07-01 schmidt.m -n Dry run. Do not run xrand. Implies -v
53 ea40b928 2014-05-29 xhr -t Toggle different options"
54 be6d11c1 2013-07-01 schmidt.m -v Be more verbose
56 be6d11c1 2013-07-01 schmidt.m Position:
57 be6d11c1 2013-07-01 schmidt.m -l Display n is left of display (n+1)
58 be6d11c1 2013-07-01 schmidt.m -r Display n is right of display (n+1) [default]
60 be6d11c1 2013-07-01 schmidt.m Profile:
61 be6d11c1 2013-07-01 schmidt.m -p profile Enable the specified profile
64 1efd7a9d 2014-05-30 xhr ## Add a new Profile
66 e0985cf2 2014-05-29 xhr 1. Clone the repository and copy dtoggle to a location in your `$PATH`
67 1efd7a9d 2014-05-30 xhr 2. Open the file in a text editor, look for the `choose_profile()` function and change the profiles to your needs or add new ones. I included my profiles for home, work and projector. In order to get the names of the displays, connect them and run `dtoggle -m`. Look for the strings that say "connected". Add the name of your internal display to `INTERN` and all names of your external displays to `EXTERN[0]` up to `EXTERN[n]`. Note: The order of the entries is important, i.e. entry number n is either left of right (depending on the option) of number (n+1)!
70 9c5da152 2013-07-01 xhr function choose_profile()
73 9c5da152 2013-07-01 xhr case "$PROFILE" in
74 9c5da152 2013-07-01 xhr # Home profile: Internal on, external extended
76 9c5da152 2013-07-01 xhr INTERN="LVDS1"
77 9c5da152 2013-07-01 xhr EXTERN[0]="HDMI1"
80 9c5da152 2013-07-01 xhr # -----------------------------------------------------------------------
81 9c5da152 2013-07-01 xhr # Add your own profiles here.
82 9c5da152 2013-07-01 xhr # -----------------------------------------------------------------------
84 9c5da152 2013-07-01 xhr # INTERN="LVDS1"
85 9c5da152 2013-07-01 xhr # EXTERN[0]="VGA1"
87 9c5da152 2013-07-01 xhr # EXTERN[n]="VGAn"
89 9c5da152 2013-07-01 xhr # -----------------------------------------------------------------------
92 e0985cf2 2014-05-29 xhr 3. Check the command line options with `dtoggle -h` and enjoy.
96 9c5da152 2013-07-01 xhr None. Nevertheless, I you find something annoying, send me an email.
104 ef80324a 2013-07-01 xhr Matthias Schmidt (xhr giessen.ccc.de)