3 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 I use the toggle option with the `XF86Display` key (Fn + F7) on my Thinkpad:
8 bindsym XF86Display exec "~/Documents/bin/dtoggle -t"
13 ### Connected to a projector
15 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 ### Switch between the laptop display and a docking station with connected displays
23 Add a profile named *foo* and use -p foo once you dock in or out.
31 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 # Set your desired profile here
38 ## Command Line Options
41 dtoggle [-ceix] [-hmntv] [-lr] -p profile
44 -c Clone screen on all displays
45 -e Enable external display(s) and disable internal
46 -i Enable only the internal display
47 -x Extend screen to all displays [default]
51 -m Show all available modes
52 -n Dry run. Do not run xrand. Implies -v
53 -t Toggle different options"
57 -l Display n is left of display (n+1)
58 -r Display n is right of display (n+1) [default]
61 -p profile Enable the specified profile
66 1. Clone the repository and copy dtoggle to a location in your `$PATH`
67 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 function choose_profile()
74 # Home profile: Internal on, external extended
80 # -----------------------------------------------------------------------
81 # Add your own profiles here.
82 # -----------------------------------------------------------------------
89 # -----------------------------------------------------------------------
92 3. Check the command line options with `dtoggle -h` and enjoy.
96 None. Nevertheless, I you find something annoying, send me an email.
104 Matthias Schmidt (xhr giessen.ccc.de)