diff options
author | Hans de Goede <hdegoede@redhat.com> | 2014-04-07 11:23:48 +0200 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2014-04-07 15:16:51 +0200 |
commit | 1b23094a8606bf383ec6c7803a9cd300b1bb96a7 (patch) | |
tree | ee8cd47d3292b9e5fecf91848470c9c513963950 | |
parent | 44915d6953076849b69a017f6fc8234b0f254362 (diff) |
startx: Pass vtX as long as the user did not specify one
Adding vtX to $defaultserverargs means that it will only be added when
the user specifies no server arguments.
This means that doing ie: "startx -- -depth 16" will cause the server to start
on a different vt then just "startx", which does not meat the principle of
least surprise.
Instead always pass the vtX argument, except when the user has specified its
own vtX argument. Note that vtX still only gets added for the default server,
since for ie Xnest or Xephyr it makes no sense.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: James Cloos <cloos@jhcloos.com>
-rw-r--r-- | startx.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -59,6 +59,7 @@ defaultserverargs="" defaultdisplay=":0" clientargs="" serverargs="" +vtarg="" #ifdef __APPLE__ @@ -194,7 +195,7 @@ if [ x"$server" = x ]; then tty=$(tty) if expr match "$tty" '^/dev/tty[0-9]\+$' > /dev/null; then tty_num=$(echo "$tty" | grep -oE '[0-9]+$') - defaultserverargs=${defaultserverargs}" vt"${tty_num} + vtarg="vt$tty_num" fi #endif @@ -213,6 +214,17 @@ if [ x"$serverargs" = x ]; then serverargs=$defaultserverargs fi +XCOMM if no vt is specified add vtarg (which may be empty) +have_vtarg="no" +for i in $serverargs; do + if expr match "$i" '^vt[0-9]\+$' > /dev/null; then + have_vtarg="yes" + fi +done +if [ "$have_vtarg" = "no" ]; then + serverargs="$serverargs $vtarg" +fi + XCOMM if no display, use default if [ x"$display" = x ]; then display=$defaultdisplay |