gnu screen: reordering windows like browser drag+drop tab reordering

I have 20 windows open in my screen session, and I would like to reorder the right-most window 20 to say, just between positions 9 and 10 like this:

1 2 3 4 5 6 7 8 9      10 11 12 13 14 15 16 17 18 19 20
                                                   ...V
                                        ............
                      ...................
                    ...
                    V
1 2 3 4 5 6 7 8 9  20  10 11 12 13 14 15 16 17 18 19

How can I do that in a single or few command/s?


I don't know how to reorder the window number using mouse. But in git version, window number can increase or decrease relative amount.

number [[+|-]n]

And in the windowlist, you can swap the window number using ,(previous) or .(next).

In your example, the following procedure would satisfy your wishes.

  1. select the window you want to move(select 20)
  2. switch into windowlist(windowlist)
  3. type , key 10 times
  4. (exit windowlist)

The best I know of, is to re-number all your windows, like this:

C-a :number X

where C = ctrl, and X is the number your want for this window. In your case, this means that you need to move 20 -> 10, and 10 -> 20. Use a more complicated approach if you prefer.

From the man page:

  number [n]

   Change  the  current  windows  number. If the given number n is already
   used by another window, both windows  exchange  their  numbers.  If  no
   argument  is specified, the current window number (and title) is shown.