codehenry / xmonad

Automatically exported from code.google.com/p/xmonad
0 stars 0 forks source link

Suggested improvement to CycleRecentWS for multiple screens #546

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
XMonad.Action.CycleRecentWS defines a function to cycle through workspaces 
according to how recently they were shown.  The code specifically puts the 
current workspace at the end (although it is technically the most recent), 
which is a good idea.

With multiple screens, the visible workspace on the other screen is then 
considered to be the most recent visible workspace, so it switches there first. 
 I reckon it should not do this, and instead that workspace should be demoted 
to the end of the list, just like the current one.

Here is my suggested change to cycleRecentWS.  I can't be really confident that 
I fixed it the right way, but it does seem to work for me.

cycleRecentWS = cycleWindowSets options
 where options w = map (view `flip` w) (recentTags w)
       nscreens w = length (screens w)
       recentTags w = map tag $ drop (nscreens w) (workspaces w) ++ reverse (take (nscreens w) (workspaces w))

Original issue reported on code.google.com by ch...@cmears.id.au on 30 May 2013 at 2:25

GoogleCodeExporter commented 8 years ago
I actually already have something similar to this in my xmonad.hs, defined like 
this:

cycleRecentWS' = cycleWindowSets options
 where options w = map (W.view `flip` w) (recentTags w)
       recentTags w = map W.tag $ W.hidden w ++ [W.workspace (W.current w)]

Mine actually *excludes* the visible but non-focused workspaces from the cycle. 
 I guess my worry is that there are quite a few different ways to do this sort 
of thing, and if we change cycleRecentWS it will be what some people want but 
not others.  However, I would be OK with including some variants like the ones 
above, with names like  cycleRecentHiddenWS and so on.

Original comment by byor...@gmail.com on 31 May 2013 at 1:09

GoogleCodeExporter commented 8 years ago
What happens if you swap the workspaces (with greedyView), e.g.
[1*][2] -> [2*][1]

Will the new cycleRecentWS switch back to [1*][2], or ignore workspace 1 
because it is shown on another screen?

Personally I like to think of my monitors as independent. That means that the 
functionality of CycleRecentWS (and also ToggleWS from X.A.CycleWS) should not 
change because of workspaces on other screens, so in my example it should 
switch back to [1*][2]. I would love to see this implemented in xmonad.

Original comment by hanswc...@gmail.com on 31 May 2013 at 4:48

GoogleCodeExporter commented 8 years ago
With my version, it will ignore workspace 1 because it is shown on another 
screen.  And this is exactly the way *I* want it.  I have a different 
keybinding to swap the two visible workspaces.  But wanting it to switch back 
is entirely reasonable, too.

This is my point -- there are lots of reasonable choices that could be made, 
and no one choice is best for everyone.  So I think that changing the 
definition of cycleRecentWS will not really accomplish anything.  But I'd 
certainly be OK with sticking in a couple alternate versions, with some clear 
documentation explaining what the different versions do.  If someone wanted to 
code up a patch I would review and apply it, or I will probably get around to 
this eventually if no one else does.

Original comment by byor...@gmail.com on 31 May 2013 at 11:08

GoogleCodeExporter commented 8 years ago
Thanks for the answer. My question should have been directed at the original 
poster since I tested out your modification already, sorry for not making it 
clearer.
(I don't know much Haskell so I don't know how to adapt OP's code to my 
xmonad.hs.)

I agree with your point and, as said, would be happy to see some alternative 
versions.

Original comment by hanswc...@gmail.com on 2 Jun 2013 at 5:29

GoogleCodeExporter commented 8 years ago
My version acts like the existing version with regard to the other screen; it 
won't ever swap the workspaces like greedyView, it just moves the focus to the 
other screen.  

I agree that people will want different behaviour, and it might be best to have 
a couple of versions.  (In fact, I think I like byorgey's version better than 
mine.)

Original comment by ch...@cmears.id.au on 3 Jun 2013 at 1:15