
Leo Alekseyev [2012.05.18 0228 -0400]:
On Tue, May 15, 2012 at 5:32 PM, Leo Alekseyev
wrote: On Tue, May 15, 2012 at 4:22 PM,
wrote: Quoting Norbert Zeh
: for any starting workspace except "0" or "0SCR", say its number is x, the above code goes to workspace x-1 or x+9. ...
What is it I don't understand here?
The workspace at index 0 in the list of workspaces is "1:blah", at index 1 is "2:blah", etc.
Well, if anyone is curious, I've isolated the breakage to the floating scratchpad workspace. It appears that after the first time the scratchpad is spawned, its workspace (with the tag NSP) is inserted at index 0 in the workspace array. I'm assuming that it used to not be the case with older Xmonad versions...
Ah, that explains it. Here's a piece of code that makes the whole process independent of the actual ordering of the workspaces (something that my previous broken suggestion also tried to do). jumpToMain = do num <- gets (head . W.tag . W.workspace . W.current . windowset) ws <- asks (workspaces . config) let m = find (\w -> head w == num && w /= (num : "SCR")) ws windows (W.greedyView $ fromJust m) jumpToScratch = do num <- gets (head . W.tag . W.workspace . W.current . windowset) windows (W.greedyView $ num : "SCR") This should work whenever you have pairs of workspaces of the form "<x>SCR" and "<x><something else>" and these are the only workspaces that start with <x>. It will do nothing for workspaces that are not paired with a corresponding "<x>SCR". If you modify your config so you have an "<x>SCR" and no other workspace that starts with <x>, then the last line of jumpToMain will throw an error. In that situation, you should change this line to "maybe (return ()) (windows . W.greedyView) m". jumpToMain then quietly does nothing if it cannot find a workspace starting with <x> other than "<x>SCR". I hope I didn't once again overlook something, as I didn't have the time to actually set up my environment to test this. At least it compiled once I added it to my xmonad.hs. Cheers, Norbert