summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-02-28 16:13:59 -0800
committerKeith Packard <keithp@keithp.com>2013-02-28 16:13:59 -0800
commita6c8969ab1ab47f72f0f00bd32f100c1661ffdef (patch)
tree3e96b8e741aca045b9c008e3d7957a1d40e2aeb1
parentd45135b4d283ce19545ef4696be4b91747ce03f8 (diff)
Add --auto switch, a shortcut for --config "xrandr --auto"
Makes it slightly easier to use. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--x-on-resize.c10
-rw-r--r--x-on-resize.man4
2 files changed, 11 insertions, 3 deletions
diff --git a/x-on-resize.c b/x-on-resize.c
index 12f9558..a6cdd10 100644
--- a/x-on-resize.c
+++ b/x-on-resize.c
@@ -111,9 +111,9 @@ main (int argc, char **argv)
int major, minor;
XEvent ev;
XRRNotifyEvent *nev;
- char *config = NULL;
- char *resize = NULL;
- char *display = NULL;
+ const char *config = NULL;
+ const char *resize = NULL;
+ const char *display = NULL;
int c, o;
int start = 0;
XRRScreenResources *resources;
@@ -122,6 +122,7 @@ main (int argc, char **argv)
{ "config", 1, NULL, 'c' },
{ "resize", 1, NULL, 'r' },
{ "start", 0, NULL, 's' },
+ { "auto", 0, NULL, 'a' },
{ "display", 1, NULL, 'd' },
{ "help", 0, NULL, 'h' },
{ 0, 0, NULL, 0 }
@@ -138,6 +139,9 @@ main (int argc, char **argv)
case 'd':
display = optarg;
break;
+ case 'a':
+ config = "xrandr --auto";
+ break;
case 's':
start = 1;
break;
diff --git a/x-on-resize.man b/x-on-resize.man
index d045928..18a06d4 100644
--- a/x-on-resize.man
+++ b/x-on-resize.man
@@ -49,6 +49,10 @@ available outputs has changed. If not provided, x-on-resize prints
This option selects the external script to run when the size
of the root window has changed. If not provided, x-on-resize prints
"resize" on stdout.
+.IP "\-a, \-\-auto"
+This is the same as \-\-config "xrandr --auto", which sets
+the system to a reasonable configuration each time the connected set
+of outputs changes.
.IP "\-s, \-\-start"
This directs x-on-resize to run any defined scripts at startup time in
addition to when the specified conditions occur.