Discussion:
[xmonad] How to have separate layout sets per screen in XMonad?
Tal Walter
2015-12-02 08:11:01 UTC
Permalink
Hi all!
Is it possible to define 2 separate layout sets one per monitor in use?
(not one per workspace)

The use case is basically to have layouts with a master area on the left
side for my right monitor, and the same layouts only 'reflected
horizontally' (using Layout.Reflect) on my left monitor (i.e. master area
on the right), so that, overall, the master areas are always in the center
of the total estate of the 2 monitors.
A solution that has separate layout sets per screen should be more than
enough for this.

I have a vague memory of finding such a module way back when, but I've went
through the entirety of xmonad-contrib recently (looked at xmonad-extras as
well) and didn't find a solution for this.

There are separate layouts per workspace, and having separate workspaces
per screen, but I want to switch between the 2 monitors on the fly and have
consistent layouts as described above. So this solution won't work.

In case I'm not missing any module in contrib, could someone please point
me in a good starting direction as to how to implement such a thing?

Any help is greatly appreciated!
Brandon Allbery
2015-12-02 13:44:33 UTC
Permalink
Post by Tal Walter
In case I'm not missing any module in contrib, could someone please point
me in a good starting direction as to how to implement such a thing?
This could be done with a layout modifier similar to onWorkspace, but
you'll need to look in the StackSet for the workspace tag being laid out
and determine what ScreenID it is currently on: that information is not
passed to the LayoutHook. (xmonad-contrib in git has PerScreen but that
triggers by screen width, not screen ID.)
--
brandon s allbery kf8nh sine nomine associates
***@gmail.com ***@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
Tal Walter
2015-12-03 09:25:36 UTC
Permalink
Thanks Brandon!
Using the PerScreen module, I simply switched the condition from being on
the screen width, to being on the screen x coordinate (which obviously
differs between the left and right screens).

However each time a new layout is returned (i.e. each time I switch
screens) the index of the current selected layout from the layouts in the
set is being reset.
That is to be expected because there is no way of knowing apriori that the
2 layouts will have an equal amount of items, but in my case the 2 layout
sets are symmetrical, therefore I would like to stay consistent with
current selected layout index in the layout set. I tried looking around the
Workspace ADT and the runLayout func but can't find a way to get to such an
index.

Is it feasible in a simple manner?
I attached the code that I currently use.

Any help is yet again, greatly appreciated!
Thanks!
Post by Brandon Allbery
Post by Tal Walter
In case I'm not missing any module in contrib, could someone please point
me in a good starting direction as to how to implement such a thing?
This could be done with a layout modifier similar to onWorkspace, but
you'll need to look in the StackSet for the workspace tag being laid out
and determine what ScreenID it is currently on: that information is not
passed to the LayoutHook. (xmonad-contrib in git has PerScreen but that
triggers by screen width, not screen ID.)
--
brandon s allbery kf8nh sine nomine associates
unix, openafs, kerberos, infrastructure, xmonad
http://sinenomine.net
Brandon Allbery
2015-12-04 04:13:00 UTC
Permalink
Post by Tal Walter
Is it feasible in a simple manner?
I attached the code that I currently use.
There is no such index. The layout is a function, it doesn't keep an index.
This is also why there is no PreviousLayout message matching NextLayout.
--
brandon s allbery kf8nh sine nomine associates
***@gmail.com ***@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
Tal Walter
2015-12-04 08:21:18 UTC
Permalink
I see.
Thanks anyway! The partial solution is great as well!
Post by Brandon Allbery
Post by Tal Walter
Is it feasible in a simple manner?
I attached the code that I currently use.
There is no such index. The layout is a function, it doesn't keep an
index. This is also why there is no PreviousLayout message matching
NextLayout.
--
brandon s allbery kf8nh sine nomine associates
unix, openafs, kerberos, infrastructure, xmonad
http://sinenomine.net
Loading...