• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

img/H03-May-2022-

libshlist/H05-Nov-2017-989533

test/H25-Nov-2017-140115

.gitignoreH A D25-Nov-2017149 2015

.gitmodulesH A D25-Nov-201789 43

CONTRIBUTING.mdH A D25-Nov-20172.2 KiB5843

LICENSEH A D25-Nov-20171.1 KiB2116

MakefileH A D03-May-2022963 3934

README.mdH A D25-Nov-20174.5 KiB198144

monsH A D03-May-202214.8 KiB444358

README.md

1Mons
2===================
3[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://github.com/Ventto/mons/blob/master/LICENSE)
4[![Language (XRandR)](https://img.shields.io/badge/powered_by-XRandR-brightgreen.svg)](https://www.x.org/archive/X11R7.5/doc/man/man1/xrandr.1.html)
5[![Vote for mons](https://img.shields.io/badge/AUR-Vote_for-yellow.svg)](https://aur.archlinux.org/packages/mons/)
6
7
8
9*"Mons is a Shell script to quickly manage 2-monitors display using xrandr."*
10
11## Perks
12
13* [x] **No requirement**: POSIX-compliant (minimal: *xorg-xrandr*)
14* [x] **Useful**: Perfectly fit for laptops, quick and daily use
15* [x] **Well known**: Laptop mode, projector mode, duplicate, mirror and extend
16* [x] **More**:  Select one or two monitors over several others
17* [x] **Extra**: Cycle through every mode with only one shortcut
18* [x] **Auto**: Deamon mode to automatically reset display
19
20# Installation
21
22* Package (AUR)
23
24```
25$ pacaur -S mons
26```
27
28* Manual
29
30```
31$ git clone --recursive https://github.com/Ventto/mons.git
32$ cd mons
33$ sudo make install
34```
35> Note: `--recursive` is needed for git submodule
36
37# Usage
38
39```
40Without argument, it prints connected monitors list with their names and ids.
41Options are exclusive and can be used in conjunction with extra options.
42
43Information:
44  -h    Prints this help and exits.
45  -v    Prints version and exits.
46
47Two monitors:
48  -o    Primary monitor only.
49  -s    Second monitor only.
50  -d    Duplicates the primary monitor.
51  -m    Mirrors the primary monitor.
52  -e <side>
53         Extends the primary monitor to the selected side
54         [ top | left | right | bottom ].
55  -n <side>
56         This mode selects the previous ones, one after another. The argument
57         sets the side for the extend mode.
58
59More monitors:
60  -O <mon>
61        Only enables the monitor with a specified id.
62  -S <mon1>,<mon2>:<pos>
63        Only enables two monitors with specified ids. The specified position
64        places the second monitor on the right (R) or at the top (T).
65
66Extra (in-conjunction options):
67  --dpi <dpi>
68        Set the DPI, a strictly positive value within the range [0 ; 27432].
69  --primary <mon_name>
70        Select a connected monitor as the primary output. Run the script
71        without argument to print monitors information, the names are in the
72        second column between ids and status. The primary monitor is marked
73        by an asterisk.
74
75Daemon mode:
76  -a    Performs an automatic display if it detects only one monitor.
77```
78
79# Examples
80
81## Two monitors
82
83Displays monitor list:
84
85```
86$ mons
870: LVDS-1   (enabled)
885: VGA-1
89```
90
91You have an enabled one, you want to extends the second one on the right:
92
93```
94$ mons -e right
95```
96
97You want to only display the second one:
98
99```
100$ mons -s
101```
102
103Go through every 2-monitors mode according the following sequence:
104
1051. Primary monitor only
1061. Second monitor only
1071. Extend mode whose the side is set with `-n <side>`
1081. Mirror
1091. Duplicate
110
111This mode is useful if you want to switch to every mode with only one shortcut.
112
113![alt 2-monitors modes](img/raw-body.png)
114
115```
116# Now in 'Second monitor mode'
117$ mons -n right # -> 'Extend mode'
118# Now in 'Extend mode'
119$ mons -n right # -> 'Mirror mode'
120```
121
122## Three monitors (selection mode)
123
124
125Displays monitor list:
126
127```
128$ mons
129Monitors: 3
130Mode: Selection
1310: LVDS-1   (enabled)
1321: DP-1     (enabled)
1335: VGA-1
134```
135
136You may need to display only the third one:
137
138```
139$ mons -O 5
140```
141
142You may need to display the first and the third one on the right:
143
144```
145$ mons -S 0,5:R
146```
147
148Like above but you want to inverse the placement:
149
150```
151$ mons -S 5,0:R
152```
153
154## DPI value
155
156You might want to switch mode and set the DPI value.
157Use the `--dpi <dpi>` option in conjunction with all others options.
158
159```
160$ mons [OPTIONS] --dpi <dpi>
161```
162
163## Primary monitor
164
165You might choose one of your monitors as the main one.
166You can use the `--primary <mon_name>` option alone or in conjunction with all
167others options.
168`<mon_name>` refers to the monitor name that appears in the list of connected
169monitors (ex: `LVDS-1` or `VGA-1`):
170
171```
172$ mons
1730:* LVDS-1   (enabled)
1745:  VGA-1
175```
176
177The '*' character means that the monitor is the primary one:
178
179```
180$ mons --primary VGA-1
1810:  LVDS-1   (enabled)
1825:* VGA-1
183
184```
185
186## Daemon mode
187
188Especially for laptops, after unplugging the additional monitors, it might be
189convenient to reset automatically the display for the remaining one.
190
191Run *mons* in background as follow:
192
193```
194$ nohup mons -a > /dev/null 2>&1 &  (all shells)
195$ mons -a &!                        (zsh)
196$ mons -a &; disown                 (bash)
197```
198