switching to the workspace where a window just went?

Every year or so i get too ambitious and try to extract yet more functionality from this awesome piece of software. With the past help of this mailing list in my xmonad.hs i have set up a hotkey to send a window to the next empty workspace: myKeys = [ -- .... , ("M-<F1>", shiftTo Next EmptyWS) ] Now, I would like to have a different key combination (eg, M-<F2>) to - send the current window to the next empty workspace AND THEN - automatically take me to it (meaning, display the workspace to which that window was just sent on the physical display that currently has focus). Is there a way to combine this sequence of actions? Or am I stuck with sending the window to the next empty workspace and then fishing around for it? :) happy 2012 ~l

On Wed, 28 Dec 2011 17:25:33 -0800 (PST)
Lara Michaels
myKeys =
[ -- .... , ("M-<F1>", shiftTo Next EmptyWS) ]
Now, I would like to have a different key combination (eg, M-<F2>) to
- send the current window to the next empty workspace AND THEN
- automatically take me to it (meaning, display the workspace to which that window was just sent on the physical display that currently has focus).
I'm almost blue-skying here. I have no idea if this would work, but it
at least type checks and might be a starting point:
, ("C-<F1>", shiftTo Next EmptyWS >> moveTo Next EmptyWS)

On Wed, Dec 28, 2011 at 21:36, Mike Meyer
On Wed, 28 Dec 2011 17:25:33 -0800 (PST) Lara Michaels
wrote: - send the current window to the next empty workspace AND THEN - automatically take me to it (meaning, display the workspace to which
I'm almost blue-skying here. I have no idea if this would work, but it at least type checks and might be a starting point:
, ("C-<F1>", shiftTo Next EmptyWS >> moveTo Next EmptyWS)
It typechecks, but won't do what you want as the workspace will no longer be empty. Looking at the source to cycleWS, looks like what you want is something like
,("C-<F1>", doTo Next EmptyWS getSortByIndex $ \ws -> windows (shift ws)
windows (greedyView ws))
-- brandon s allbery allbery.b@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms

Brandon, thank you so much for this. (It had landed in my spam folder so I only found it now.)
After adding that to my xmonad.hs I get these errors:
xmonad.hs:68:17: Not in scope: `doTo'
xmonad.hs:68:35: Not in scope: `getSortByIndex'
xmonad.hs:68:67: Not in scope: `shift'
Please check the file for errors.
I checked the header of xmonad.hs and I am importing the file you mentioned:
import Control.OldException
import Control.Monad
import XMonad
import XMonad.Hooks.EwmhDesktops
import qualified XMonad.StackSet as W
import XMonad.Actions.CycleRecentWS
import XMonad.Config.Gnome
import XMonad.Hooks.DynamicLog
import qualified XMonad.StackSet as W
import XMonad.Util.EZConfig
import XMonad.Actions.CycleWS
import XMonad.ManageHook
import XMonad.Hooks.ManageHelpers
import XMonad.Layout.ShowWName
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run(spawnPipe)
import System.IO
so I wonder why this is happening?
thank you for any help!
~l
________________________________
From: Brandon Allbery
,("C-<F1>", doTo Next EmptyWS getSortByIndex $ \ws -> windows (shift ws) >> windows (greedyView ws)) -- brandon s allbery allbery.b@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms
_______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad

Hi Lara, doTo is in XMonad.Actions.CycleWS in XMonadContrib 0.10 but not in XMonadContrib 0.9.* getSortByIndex needs an import XMonad.Util.WorkspaceCompare and finally I suspect shift might be XMonad.StackSet.shift, which with your imports can be referred to as W.shift Hope this helps. -- Adam * On Monday, January 02 2012, Lara Michaels wrote:
Brandon, thank you so much for this. (It had landed in my spam folder so I only found it now.)
After adding that to my xmonad.hs I get these errors: xmonad.hs:68:17: Not in scope: `doTo'
xmonad.hs:68:35: Not in scope: `getSortByIndex'
xmonad.hs:68:67: Not in scope: `shift'
Please check the file for errors.
I checked the header of xmonad.hs and I am importing the file you mentioned:
import Control.OldException import Control.Monad
import XMonad import XMonad.Hooks.EwmhDesktops import qualified XMonad.StackSet as W import XMonad.Actions.CycleRecentWS import XMonad.Config.Gnome import XMonad.Hooks.DynamicLog import qualified XMonad.StackSet as W import XMonad.Util.EZConfig import XMonad.Actions.CycleWS import XMonad.ManageHook import XMonad.Hooks.ManageHelpers import XMonad.Layout.ShowWName import XMonad.Hooks.ManageDocks import XMonad.Util.Run(spawnPipe) import System.IO
so I wonder why this is happening?
thank you for any help! ~l
________________________________ From: Brandon Allbery
To: Mike Meyer Cc: xmonad@haskell.org Sent: Thursday, December 29, 2011 2:57 AM Subject: Re: [xmonad] switching to the workspace where a window just went? Looking at the source to cycleWS, looks like what you want is something like
,("C-<F1>", doTo Next EmptyWS getSortByIndex $ \ws -> windows (shift ws) >> windows (greedyView ws)) -- brandon s allbery allbery.b@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms
_______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad
_______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad

Adam, thank you so much for the detailed help. Following instructions I sorted everything out except for doTo. Is there a way to achieve the same effect without doTo/installing the newer xmonad-contrib? I am on Ubuntu 10.04 LTS and trying to force the install of a more recent xmonad is proving beyond my abilities (all sorts of impossible to meet dependencies pop up). bye! ~l
________________________________
From: Adam Vogt
Brandon, thank you so much for this. (It had landed in my spam folder so I only found it now.)
After adding that to my xmonad.hs I get these errors: xmonad.hs:68:17: Not in scope: `doTo'
xmonad.hs:68:35: Not in scope: `getSortByIndex'
xmonad.hs:68:67: Not in scope: `shift'
Please check the file for errors.
I checked the header of xmonad.hs and I am importing the file you mentioned:
import Control.OldException import Control.Monad
import XMonad import XMonad.Hooks.EwmhDesktops import qualified XMonad.StackSet as W import XMonad.Actions.CycleRecentWS import XMonad.Config.Gnome import XMonad.Hooks.DynamicLog import qualified XMonad.StackSet as W import XMonad.Util.EZConfig import XMonad.Actions.CycleWS import XMonad.ManageHook import XMonad.Hooks.ManageHelpers import XMonad.Layout.ShowWName import XMonad.Hooks.ManageDocks import XMonad.Util.Run(spawnPipe) import System.IO
so I wonder why this is happening?
thank you for any help! ~l
________________________________ From: Brandon Allbery
To: Mike Meyer Cc: xmonad@haskell.org Sent: Thursday, December 29, 2011 2:57 AM Subject: Re: [xmonad] switching to the workspace where a window just went? Looking at the source to cycleWS, looks like what you want is something like
,("C-<F1>", doTo Next EmptyWS getSortByIndex $ \ws -> windows (shift ws) >> windows (greedyView ws)) -- brandon s allbery allbery.b@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms
_______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad
_______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad
_______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad

Mike -
, ("C-<F1>", shiftTo Next EmptyWS >> moveTo Next EmptyWS)
Thank you for this. :) I tried it out and what it does is - it send the current window to the next empty workspace (e.g. display '5'); and it then - displays on the current screen the next empty workspace *coming after* the (previously empty) workspace that window just went to. An example: I have workspaces 1,2,3. All are empty except for workspace 1, where I have two windows. I press C-<F1> and (A) the window gets sent to workspace 2 and (B) workspace 3 is displayed. I guess it might have something to do with the order in which EmptyWS is being evaluated? (I am afraid I know nothing about Haskell.) By the time "moveTo Next EmptyWS" is executed, the workspace to which the window just got sent is no longer part of EmptyWS? Does anyone know if it is possible to move to the workspace where the window just got sent to? thanks and have a great 2012! ~l

Lara Michaels [2011.12.30 0803 -0800]:
Mike -
, ("C-<F1>", shiftTo Next EmptyWS >> moveTo Next EmptyWS)
Thank you for this. :) I tried it out and what it does is
- it send the current window to the next empty workspace (e.g. display '5'); and it then - displays on the current screen the next empty workspace *coming after* the (previously empty) workspace that window just went to.
An example: I have workspaces 1,2,3. All are empty except for workspace 1, where I have two windows. I press C-<F1> and (A) the window gets sent to workspace 2 and (B) workspace 3 is displayed.
I guess it might have something to do with the order in which EmptyWS is being evaluated? (I am afraid I know nothing about Haskell.) By the time "moveTo Next EmptyWS" is executed, the workspace to which the window just got sent is no longer part of EmptyWS?
Does anyone know if it is possible to move to the workspace where the window just got sent to?
Brandon Allberry already provided the answer. N.
participants (5)
-
Adam Vogt
-
Brandon Allbery
-
Lara Michaels
-
Mike Meyer
-
Norbert Zeh