Re: [hackers] Re: [dwm][PATCH] Sort screens by horizontal origin

From: Stein Gunnar Bakkeby <>
Date: Wed, 23 Oct 2019 09:56:05 +0200

Hi Sebastian,

I was thinking that if the primary screen, as returned by X, always end up
as monitor 0, and you have, say, three additional screens (one on the left,
two on the right), then you'd probably end up with a layout like:


after your sorting the (previous) primary screen, i.e. monitor 0, is moved
all the way to the left hence everything that was on your primary monitor
is also moved to the newly attached monitor.


What I was thinking is that the original position of monitor 0 could be
recorded before the sorting, then shift / rotate the sorted list so that
the primary screen remains where it were originally, e.g.

[0][1][2][3] --> shift once

If you have two monitors then you'd need to shift twice, etc.

That way connecting a new monitor may appear more seamless with
applications running on the primary monitors remaining where they were.
Granted there may very well be some gotchas that I haven't thought of when
it comes to detaching and attaching monitors. Just an idea.



On Wed, Oct 23, 2019 at 9:06 AM Sebastian Sareyko <> wrote:

> On Mon, Oct 21 2019, Stein Gunnar Bakkeby wrote:
> > With this patch the monitors are numbered left to right. So unless I have
> > misunderstood something if you are running only your laptop and you have
> > some applications open, and you connect a screen, then whatever was on
> the
> > laptop is now moved to the (new) left hand screen. Is that right?
> This depends on where you position the new screen (e.g. via xrandr). If
> it is placed to the right of your laptop screen no clients will be
> moved. If you put the new screen to the left however, clients will be
> disappear on the laptop screen and appear on the new screen.
> > I was thinking that once the monitors are sorted one could also loop
> > through the monitors starting from 0 to find the index of the primary
> > monitor (can be assumed to be monitor 0 in the original list), then shift
> > the list so that primary is 0 again.
> Maybe I'm misunderstanding what you're saying, but this would just
> confuse the ordering if the primary screen is not placed on the top left
> of all screens.
> --
> Sebastian Sareyko
Received on Wed Oct 23 2019 - 09:56:05 CEST

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2019 - 16:12:26 CEST