Blame


1 1efd7a9d 2014-05-30 xhr # dtoggle
2 be6d11c1 2013-07-01 schmidt.m
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.
4 be6d11c1 2013-07-01 schmidt.m
5 94fd26e6 2014-05-29 xhr I use the toggle option with the `XF86Display` key (Fn + F7) on my Thinkpad:
6 ab022475 2014-05-29 xhr
7 ab022475 2014-05-29 xhr ```
8 1efd7a9d 2014-05-30 xhr bindsym XF86Display exec "~/Documents/bin/dtoggle -t"
9 ab022475 2014-05-29 xhr ```
10 ab022475 2014-05-29 xhr
11 1efd7a9d 2014-05-30 xhr ## Usage Scenarios
12 e0985cf2 2014-05-29 xhr
13 e0985cf2 2014-05-29 xhr ### Connected to a projector
14 e0985cf2 2014-05-29 xhr
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.
16 e0985cf2 2014-05-29 xhr
17 1efd7a9d 2014-05-30 xhr ```
18 1efd7a9d 2014-05-30 xhr dtoggle -t
19 1efd7a9d 2014-05-30 xhr ```
20 1efd7a9d 2014-05-30 xhr
21 e0985cf2 2014-05-29 xhr ### Switch between the laptop display and a docking station with connected displays
22 e0985cf2 2014-05-29 xhr
23 1efd7a9d 2014-05-30 xhr Add a profile named *foo* and use -p foo once you dock in or out.
24 e0985cf2 2014-05-29 xhr
25 1efd7a9d 2014-05-30 xhr ```
26 1efd7a9d 2014-05-30 xhr dtoggle -p foo -e
27 1efd7a9d 2014-05-30 xhr ```
28 94fd26e6 2014-05-29 xhr
29 1efd7a9d 2014-05-30 xhr ## Config File
30 1efd7a9d 2014-05-30 xhr
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:
32 94fd26e6 2014-05-29 xhr
33 94fd26e6 2014-05-29 xhr ```
34 94fd26e6 2014-05-29 xhr # Set your desired profile here
35 94fd26e6 2014-05-29 xhr PROFILE=home
36 94fd26e6 2014-05-29 xhr ```
37 94fd26e6 2014-05-29 xhr
38 1efd7a9d 2014-05-30 xhr ## Command Line Options
39 be6d11c1 2013-07-01 schmidt.m
40 be6d11c1 2013-07-01 schmidt.m ```
41 e0985cf2 2014-05-29 xhr dtoggle [-ceix] [-hmntv] [-lr] -p profile
42 be6d11c1 2013-07-01 schmidt.m
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]
48 be6d11c1 2013-07-01 schmidt.m
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
55 be6d11c1 2013-07-01 schmidt.m
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]
59 be6d11c1 2013-07-01 schmidt.m
60 be6d11c1 2013-07-01 schmidt.m Profile:
61 be6d11c1 2013-07-01 schmidt.m -p profile Enable the specified profile
62 be6d11c1 2013-07-01 schmidt.m ```
63 9c5da152 2013-07-01 xhr
64 1efd7a9d 2014-05-30 xhr ## Add a new Profile
65 9c5da152 2013-07-01 xhr
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)!
68 36d11541 2013-07-01 xhr
69 9c5da152 2013-07-01 xhr ```bash
70 9c5da152 2013-07-01 xhr function choose_profile()
71 9c5da152 2013-07-01 xhr {
72 9c5da152 2013-07-01 xhr [...]
73 9c5da152 2013-07-01 xhr case "$PROFILE" in
74 9c5da152 2013-07-01 xhr # Home profile: Internal on, external extended
75 9c5da152 2013-07-01 xhr home)
76 9c5da152 2013-07-01 xhr INTERN="LVDS1"
77 9c5da152 2013-07-01 xhr EXTERN[0]="HDMI1"
78 9c5da152 2013-07-01 xhr ;;
79 9c5da152 2013-07-01 xhr [...]
80 9c5da152 2013-07-01 xhr # -----------------------------------------------------------------------
81 9c5da152 2013-07-01 xhr # Add your own profiles here.
82 9c5da152 2013-07-01 xhr # -----------------------------------------------------------------------
83 9c5da152 2013-07-01 xhr # name)
84 9c5da152 2013-07-01 xhr # INTERN="LVDS1"
85 9c5da152 2013-07-01 xhr # EXTERN[0]="VGA1"
86 9c5da152 2013-07-01 xhr # ...
87 9c5da152 2013-07-01 xhr # EXTERN[n]="VGAn"
88 9c5da152 2013-07-01 xhr # ;;
89 9c5da152 2013-07-01 xhr # -----------------------------------------------------------------------
90 9c5da152 2013-07-01 xhr ```
91 36d11541 2013-07-01 xhr
92 e0985cf2 2014-05-29 xhr 3. Check the command line options with `dtoggle -h` and enjoy.
93 9c5da152 2013-07-01 xhr
94 1efd7a9d 2014-05-30 xhr ## Bugs
95 9c5da152 2013-07-01 xhr
96 9c5da152 2013-07-01 xhr None. Nevertheless, I you find something annoying, send me an email.
97 9c5da152 2013-07-01 xhr
98 1efd7a9d 2014-05-30 xhr ## License
99 9c5da152 2013-07-01 xhr
100 9c5da152 2013-07-01 xhr GNU GPL.
101 9c5da152 2013-07-01 xhr
102 1efd7a9d 2014-05-30 xhr ## Author
103 9c5da152 2013-07-01 xhr
104 ef80324a 2013-07-01 xhr Matthias Schmidt (xhr giessen.ccc.de)