Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cycling through workspaces in multi monitor setup in XMonad

I'm currently using alt + ctrl + left and alt + ctrl + right to cycle between workspaces:

...

    , ((altModMask .|. controlMask, xK_Left),
      prevWS)
    , ((altModMask .|. controlMask, xK_Right),
      nextWS)

This works fine for single monitor setup. However it is a bit confusing when using a dual monitor setup. This is because the workspace to be shown will change screen if currently visible on another screen. For instance if I have ws 1 on screen 0 and ws 2 on screen 1 and have the focus on screen 0:

1:term (2:web) 3:txt

When I now do a nextWS, ws 2, that was currently on screen 1 will be drawn to screen 0, while screen 1 will show ws 1.

(1:term) 2:web 3:txt

What I would like is a behaviour where prexWS and nextWS will jump over the workspace that is currently shown on the other monitor and only select a workspace that is currently not shown.

Are there such commands already or is there some xmonad.hs example that implements this?

like image 385
Konrad Eisele Avatar asked Sep 01 '25 10:09

Konrad Eisele


1 Answers

Use XMonad.Actions.DynamicWorkspaceOrder from the xmonad-contrib:

import qualified XMonad.Actions.DynamicWorkspaceOrder as DO

...

    , ((altModMask .|. controlMask, xK_Left),
      DO.moveTo Prev HiddenNonEmptyWS)
    , ((altModMask .|. controlMask, xK_Right),
      DO.moveTo Next HiddenNonEmptyWS)
like image 115
deshtop Avatar answered Sep 07 '25 07:09

deshtop