Add -M CLI argument to display cloned monitors
Works the same as -m but doesn't purge cloned monitors
This commit is contained in:
parent
cc36350849
commit
2edd8275ff
@ -35,6 +35,7 @@ _polybar() {
|
||||
-r --reload
|
||||
-d --dump=
|
||||
-m --list-monitors
|
||||
-M --list-all-monitors
|
||||
-w --print-wmname
|
||||
-s --stdout
|
||||
-p --png='
|
||||
|
@ -10,6 +10,7 @@ _polybar() {
|
||||
local R='-r --reload'
|
||||
local D='-d --dump'
|
||||
local M='-m --list-monitors'
|
||||
local MM='-M --list-all-monitors'
|
||||
local W='-w --print-wmname'
|
||||
local S='-s --stdout'
|
||||
|
||||
@ -21,7 +22,8 @@ _polybar() {
|
||||
"($C)"{-c,--config=}'[Path to the configuration file]:configuration file:_files' \
|
||||
"($R)"{-r,--reload}'[Reload when the configuration has been modified]' \
|
||||
"($D $R $M $W $S)"{-d,--dump=}'[Print parameter value in bar section and exit]:parameter name' \
|
||||
"($M $D $R $W $S)"{-m,--list-monitors}'[Print list of available monitors and exit]' \
|
||||
"($MM $M $D $R $W $S)"{-m,--list-monitors}'[Print list of available monitors and exit (Removes cloned monitors)]' \
|
||||
"($MM $M $D $R $W $S)"{-M,--list-all-monitors}'[Print list of all available monitors (Including cloned monitors) and exit]' \
|
||||
"($W $R $D $M $S)"{-w,--print-wmname}'[Print the generated WM_NAME and exit]' \
|
||||
"($S)"{-s,--stdout}'[Output data to stdout instead of drawing the X window]' \
|
||||
'::bar name:_polybar_list_names'
|
||||
|
@ -44,6 +44,13 @@ OPTIONS
|
||||
.. option:: -m, --list-monitors
|
||||
|
||||
Print list of available monitors and exit
|
||||
|
||||
If some monitors are cloned, this will remove all but one of them
|
||||
.. option:: -M, --list-all-monitors
|
||||
|
||||
Print list of available monitors and exit
|
||||
|
||||
This will also include all cloned monitors.
|
||||
.. option:: -w, --print-wmname
|
||||
|
||||
Print the generated *WM_NAME* and exit
|
||||
|
@ -21,7 +21,8 @@ int main(int argc, char** argv) {
|
||||
command_line::option{"-c", "--config", "Path to the configuration file", "FILE"},
|
||||
command_line::option{"-r", "--reload", "Reload when the configuration has been modified"},
|
||||
command_line::option{"-d", "--dump", "Print value of PARAM in bar section and exit", "PARAM"},
|
||||
command_line::option{"-m", "--list-monitors", "Print list of available monitors and exit"},
|
||||
command_line::option{"-m", "--list-monitors", "Print list of available monitors and exit (Removes cloned monitors)"},
|
||||
command_line::option{"-M", "--list-all-monitors", "Print list of all available monitors (Including cloned monitors) and exit"},
|
||||
command_line::option{"-w", "--print-wmname", "Print the generated WM_NAME and exit"},
|
||||
command_line::option{"-s", "--stdout", "Output data to stdout instead of drawing it to the X window"},
|
||||
command_line::option{"-p", "--png", "Save png snapshot to FILE after running for 3 seconds", "FILE"},
|
||||
@ -76,8 +77,10 @@ int main(int argc, char** argv) {
|
||||
//==================================================
|
||||
// List available XRandR entries
|
||||
//==================================================
|
||||
if (cli->has("list-monitors")) {
|
||||
for (auto&& mon : randr_util::get_monitors(conn, conn.root(), true)) {
|
||||
if (cli->has("list-monitors") || cli->has("list-all-monitors")) {
|
||||
bool purge_clones = !cli->has("list-all-monitors");
|
||||
auto monitors = randr_util::get_monitors(conn, conn.root(), true, purge_clones);
|
||||
for (auto&& mon : monitors) {
|
||||
if (WITH_XRANDR_MONITORS && mon->output == XCB_NONE) {
|
||||
printf("%s: %ix%i+%i+%i (XRandR monitor%s)\n", mon->name.c_str(), mon->w, mon->h, mon->x, mon->y,
|
||||
mon->primary ? ", primary" : "");
|
||||
|
Loading…
Reference in New Issue
Block a user