
wagnerdm@seas.upenn.edu [2012.05.14 2219 -0400]:
Quoting Leo Alekseyev
: On Sun, May 13, 2012 at 8:45 AM, Norbert Zeh
wrote: myWorkspaces = ["1:terminals", "2:emacs", "3:web", "4", "5", "6", "7","8","9","0"] ++ map (\x -> show x ++ "SCR") ([1..9]++[0]) .....
zeroSub 0 = 10 zeroSub x = x
jumpToMain = gets windowset >>= \W.StackSet { W.current = W.Screen { W.workspace = w } } -> withNthWorkspace W.greedyView (-1+(zeroSub $ read [head(W.tag w)])) jumpToScratch = gets windowset >>= \W.StackSet { W.current = W.Screen { W.workspace = w } } -> withNthWorkspace W.greedyView (9+(zeroSub $ read [head(W.tag w)]))
The math here looks all wrong, and I'm surprised that it worked at all before.
The math looks fine to me, and in fact your suggestion:
What you want, I think, is the following:
jumpToMain = gets (W.tag . W.workspace . W.current . windowset) >>= W.greedyView . toMain where toMain ws = [head ws]
jumpToScratch = gets (W.tag . W.workspace . W.current . windowset) >>= W.greedyView . toScratch where toScratch ws | length ws == 1 = ws ++ "SCR" | otherwise = ws
is the one that looks dodgy to me. Notice that his main workspace names are things like "3:web", but the SCR-version is just "3SCR"! In fact, I would humbly suggest that this paragraph:
Oops. I overlooked that the primary workspaces were not just numbered. My bad. I still don't get the math in the original code snippet. zeroSub has an effect only when its argument is 0. So, for any starting workspace except "0" or "0SCR", say its number is x, the above code goes to workspace x-1 or x+9. It should, however, go to workspace x-10 or x+10 and that conditionally on whether the main/scratch workspace is already visible. What is it I don't understand here? Cheers, Norbert