Quantcast

Cycle through all visible windows

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Cycle through all visible windows

alexsu04

 

Hi all,

 

I’ve been trying to get XMonad set up for dual monitor, but have been struggling with finding a way to cycle focus through every window (not workspace) visible on either screen. The behavior would be similar to XMonad.Actions.WindowNavigation (the experimental module), but the cycling wouldn’t be bound to any direction, just cycle through all visible windows in the normal Alt-Tab sequence (left to right, top to bottom).

 

I’ve found some code in a previous thread that supposedly manipulates the StackSet, but it didn’t work for me:

 

> -- top of config
> import qualified XMonad.StackSet as W
 
> -- somewhere at top level
> onAllWS f = windows $ \[hidden email]{ W.current = c, W.visible = vs } ->
>    let screenNext x = W.current . f $ ws { W.current = x }
>        c':vs' = map screenNext (c:vs)
>    in ws{ W.current = c', W.visible = vs' }
 
...
 
>  -- in keybindings: there are much more W.swap* W.focus* and W.shift* functions to use.
>  ,((modm, xK_f), onAllWS W.focusDown)
>  ,((modm, xK_d), onAllWS W.focusUp)
>  ,((modm, xK_g), onAllWS W.swapMaster)
 

 

Unfortunately, I’m still too terrible at Haskell to fix whatever is wrong with the above code, and haven’t found any other modules that have the functionality I want. Any help would be appreciated!

 

Thanks!

 

Alex


_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cycle through all visible windows

Linus Arver
On Thu, Feb 23, 2017 at 09:19:18AM -0600, [hidden email] wrote:

>
> Hi all,
>
> I’ve been trying to get XMonad set up for dual monitor, but have been struggling with finding a way to cycle focus through every window (not workspace) visible on either screen. The behavior would be similar to XMonad.Actions.WindowNavigation (the experimental module), but the cycling wouldn’t be bound to any direction, just cycle through all visible windows in the normal Alt-Tab sequence (left to right, top to bottom).
>
> I’ve found some code in a previous thread that supposedly manipulates the StackSet, but it didn’t work for me:
>
> > -- top of config
> > import qualified XMonad.StackSet as W
>
> > -- somewhere at top level
> > onAllWS f = windows $ \[hidden email]{ W.current = c, W.visible = vs } ->
> >    let screenNext x = W.current . f $ ws { W.current = x }
> >        c':vs' = map screenNext (c:vs)
> >    in ws{ W.current = c', W.visible = vs' }
>
> ...
>
> >  -- in keybindings: there are much more W.swap* W.focus* and W.shift* functions to use.
> >  ,((modm, xK_f), onAllWS W.focusDown)
> >  ,((modm, xK_d), onAllWS W.focusUp)
> >  ,((modm, xK_g), onAllWS W.swapMaster)
>
>
> Unfortunately, I’m still too terrible at Haskell to fix whatever is wrong with the above code, and haven’t found any other modules that have the functionality I want. Any help would be appreciated!

Have you looked at XMonad.Actions.CycleWS? I use it to cycle through all
workspaces with windows in them. My config is customized beyond the
standard XMonad config so you'd have to adapt it to your needs:
https://github.com/listx/syscfg/blob/master/xmonad/xmonad.hs#L150

Another alternative might be XMonad.Actions.GridSelect as it gives you a
popup of all open windows (not workspaces).

Best,
Linus

>
> Thanks!
>
> Alex

> _______________________________________________
> xmonad mailing list
> [hidden email]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad

_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cycle through all visible windows

alexsu04
Thanks for the response!

Cycling through workspaces and then cycling focus isn't exactly what I was looking for, neither is GridSelect. Ideally, the behavior would be just be to move the currently focused window to the next window on any visible screen and cycle through (changing workspaces as necessary), whereas right now Alt-Tab is limited to cycling focus through windows on the focused workspace. There wouldn't be any screen swapping, just basically being able to Alt-Tab across the two physical screens that I have.

On Thu, Feb 23, 2017 at 1:49 PM, Linus Arver <[hidden email]> wrote:
On Thu, Feb 23, 2017 at 09:19:18AM -0600, [hidden email] wrote:
>
> Hi all,
>
> I’ve been trying to get XMonad set up for dual monitor, but have been struggling with finding a way to cycle focus through every window (not workspace) visible on either screen. The behavior would be similar to XMonad.Actions.WindowNavigation (the experimental module), but the cycling wouldn’t be bound to any direction, just cycle through all visible windows in the normal Alt-Tab sequence (left to right, top to bottom).
>
> I’ve found some code in a previous thread that supposedly manipulates the StackSet, but it didn’t work for me:
>
> > -- top of config
> > import qualified XMonad.StackSet as W
>
> > -- somewhere at top level
> > onAllWS f = windows $ \[hidden email]{ W.current = c, W.visible = vs } ->
> >    let screenNext x = W.current . f $ ws { W.current = x }
> >        c':vs' = map screenNext (c:vs)
> >    in ws{ W.current = c', W.visible = vs' }
>
> ...
>
> >  -- in keybindings: there are much more W.swap* W.focus* and W.shift* functions to use.
> >  ,((modm, xK_f), onAllWS W.focusDown)
> >  ,((modm, xK_d), onAllWS W.focusUp)
> >  ,((modm, xK_g), onAllWS W.swapMaster)
>
>
> Unfortunately, I’m still too terrible at Haskell to fix whatever is wrong with the above code, and haven’t found any other modules that have the functionality I want. Any help would be appreciated!

Have you looked at XMonad.Actions.CycleWS? I use it to cycle through all
workspaces with windows in them. My config is customized beyond the
standard XMonad config so you'd have to adapt it to your needs:
https://github.com/listx/syscfg/blob/master/xmonad/xmonad.hs#L150

Another alternative might be XMonad.Actions.GridSelect as it gives you a
popup of all open windows (not workspaces).

Best,
Linus

>
> Thanks!
>
> Alex

> _______________________________________________
> xmonad mailing list
> [hidden email]
> http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad



_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cycle through all visible windows

Peter Jones
Alex Su <[hidden email]> writes:
> Thanks for the response!
>
> Cycling through workspaces and then cycling focus isn't exactly what I was
> looking for, neither is GridSelect. Ideally, the behavior would be just be
> to move the currently focused window to the next window on any visible
> screen and cycle through (changing workspaces as necessary), whereas right
> now Alt-Tab is limited to cycling focus through windows on the focused
> workspace. There wouldn't be any screen swapping, just basically being able
> to Alt-Tab across the two physical screens that I have.


I think you want to bind Alt-Tab to `windowGo` from
XMonad.Actions.Navigation2D:

  https://hackage.haskell.org/package/xmonad-contrib-0.13/docs/XMonad-Actions-Navigation2D.html

--
Peter Jones, Founder, Devalot.com
Defending the honor of good code

_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cycle through all visible windows

Alex Su
Correct me if I am wrong, but it looks to me like the windowGo function accepts also a directional input.

I think I've tried that module, but whenever I have the case that I have a window to the left, then windows stacked on top of each other, then another window on the next screen over, just binding Alt-Tab to windowGo L for instance skips certain windows in the cycle, in this case the window on the first screen that is stacked under another.

On Thu, Feb 23, 2017 at 2:23 PM, Peter Jones <[hidden email]> wrote:
Alex Su <[hidden email]> writes:
> Thanks for the response!
>
> Cycling through workspaces and then cycling focus isn't exactly what I was
> looking for, neither is GridSelect. Ideally, the behavior would be just be
> to move the currently focused window to the next window on any visible
> screen and cycle through (changing workspaces as necessary), whereas right
> now Alt-Tab is limited to cycling focus through windows on the focused
> workspace. There wouldn't be any screen swapping, just basically being able
> to Alt-Tab across the two physical screens that I have.


I think you want to bind Alt-Tab to `windowGo` from
XMonad.Actions.Navigation2D:

  https://hackage.haskell.org/package/xmonad-contrib-0.13/docs/XMonad-Actions-Navigation2D.html

--
Peter Jones, Founder, Devalot.com
Defending the honor of good code

_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad


_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cycle through all visible windows

Peter Jones
Alex Su <[hidden email]> writes:
> Correct me if I am wrong, but it looks to me like the windowGo function
> accepts also a directional input.
>
> I think I've tried that module, but whenever I have the case that I have a
> window to the left, then windows stacked on top of each other, then another
> window on the next screen over, just binding Alt-Tab to windowGo L for
> instance skips certain windows in the cycle, in this case the window on the
> first screen that is stacked under another.

Correct.  `windowGo` won't help you if you have windows stacked on top
of one another.  Assuming you are talking about floating layers, you'd
have to use something like `switchLayer` first before `windowGo`.

Another thing to consider as an alternative is:

  https://hackage.haskell.org/package/xmonad-contrib-0.13/docs/XMonad-Prompt-Window.html

--
Peter Jones, Founder, Devalot.com
Defending the honor of good code

_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cycle through all visible windows

Alex Su
No the windows are in the same layer and not floating. They are tiled, but just split the screen in half top and bottom in the right half of the screen (I'm using the default Tall layout).

Xprompt would be okay, but I was hoping someone might know about how to come up with a StackSet hack similar to the code in my first post that would work, or be able to point out what was wrong with it.

I'm a little surprised that there's no module that supports this already...

Thanks for your help so far though!

On Thu, Feb 23, 2017 at 3:03 PM, Peter Jones <[hidden email]> wrote:
Alex Su <[hidden email]> writes:
> Correct me if I am wrong, but it looks to me like the windowGo function
> accepts also a directional input.
>
> I think I've tried that module, but whenever I have the case that I have a
> window to the left, then windows stacked on top of each other, then another
> window on the next screen over, just binding Alt-Tab to windowGo L for
> instance skips certain windows in the cycle, in this case the window on the
> first screen that is stacked under another.

Correct.  `windowGo` won't help you if you have windows stacked on top
of one another.  Assuming you are talking about floating layers, you'd
have to use something like `switchLayer` first before `windowGo`.

Another thing to consider as an alternative is:

  https://hackage.haskell.org/package/xmonad-contrib-0.13/docs/XMonad-Prompt-Window.html

--
Peter Jones, Founder, Devalot.com
Defending the honor of good code

_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad


_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cycle through all visible windows

Peter Jones
In reply to this post by alexsu04
<[hidden email]> writes:

> I’ve been trying to get XMonad set up for dual monitor, but have been
> struggling with finding a way to cycle focus through every window (not
> workspace) visible on either screen. The behavior would be similar to
> XMonad.Actions.WindowNavigation (the experimental module), but the
> cycling wouldn’t be bound to any direction, just cycle through all
> visible windows in the normal Alt-Tab sequence (left to right, top to
> bottom).
>
> I’ve found some code in a previous thread that supposedly manipulates
> the StackSet, but it didn’t work for me:
>
>> -- top of config
>> import qualified XMonad.StackSet as W
>
>> -- somewhere at top level
>> onAllWS f = windows $ \[hidden email]{ W.current = c, W.visible = vs } ->
>>    let screenNext x = W.current . f $ ws { W.current = x }
>>        c':vs' = map screenNext (c:vs)
>>    in ws{ W.current = c', W.visible = vs' }
>
> ...
>
>>  -- in keybindings: there are much more W.swap* W.focus* and W.shift* functions to use.
>>  ,((modm, xK_f), onAllWS W.focusDown)
>>  ,((modm, xK_d), onAllWS W.focusUp)
>>  ,((modm, xK_g), onAllWS W.swapMaster)

Okay, let's start again.

Why doesn't the code above work?  Does it fail to compile or just fail
to work the way you expect?  If it fails to compile, what error messages
are you getting from the compiler?


--
Peter Jones, Founder, Devalot.com
Defending the honor of good code

_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cycle through all visible windows

Alex Su
The code compiles fine, just doesn't do what I expect, so no error messages.

From what I can gather, the W.focus* functions take a StackSet and outputs another StackSet, which is then passed to the windows function to actually perform the action. My understanding is that onAllWS is supposed to modify the StackSet somehow to enable Alt-Tabbing across all windows on visible screens; beyond that my Haskell is a little too elementary to understand what is happening.

On Thu, Feb 23, 2017 at 3:34 PM, Peter Jones <[hidden email]> wrote:
<[hidden email]> writes:
> I’ve been trying to get XMonad set up for dual monitor, but have been
> struggling with finding a way to cycle focus through every window (not
> workspace) visible on either screen. The behavior would be similar to
> XMonad.Actions.WindowNavigation (the experimental module), but the
> cycling wouldn’t be bound to any direction, just cycle through all
> visible windows in the normal Alt-Tab sequence (left to right, top to
> bottom).
>
> I’ve found some code in a previous thread that supposedly manipulates
> the StackSet, but it didn’t work for me:
>
>> -- top of config
>> import qualified XMonad.StackSet as W
>
>> -- somewhere at top level
>> onAllWS f = windows $ \[hidden email]{ W.current = c, W.visible = vs } ->
>>    let screenNext x = W.current . f $ ws { W.current = x }
>>        c':vs' = map screenNext (c:vs)
>>    in ws{ W.current = c', W.visible = vs' }
>
> ...
>
>>  -- in keybindings: there are much more W.swap* W.focus* and W.shift* functions to use.
>>  ,((modm, xK_f), onAllWS W.focusDown)
>>  ,((modm, xK_d), onAllWS W.focusUp)
>>  ,((modm, xK_g), onAllWS W.swapMaster)

Okay, let's start again.

Why doesn't the code above work?  Does it fail to compile or just fail
to work the way you expect?  If it fails to compile, what error messages
are you getting from the compiler?


--
Peter Jones, Founder, Devalot.com
Defending the honor of good code

_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad


_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cycle through all visible windows

Brandon Allbery

On Thu, Feb 23, 2017 at 4:46 PM, Alex Su <[hidden email]> wrote:
My understanding is that onAllWS is supposed to modify the StackSet somehow to enable Alt-Tabbing across all windows on visible screens; beyond that my Haskell is a little too elementary to understand what is happening.

The code you show runs a single action across the workspaces on all screens. `onAllWS W.focusDown` would switch the focus on all visible workspaces, otherwise leaving you where you were. This is not the droid you're looking for....

--
brandon s allbery kf8nh                               sine nomine associates
[hidden email]                                  [hidden email]
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net

_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cycle through all visible windows

Alex Su
Any ideas about a more suitable droid?

On Thu, Feb 23, 2017 at 3:55 PM, Brandon Allbery <[hidden email]> wrote:

On Thu, Feb 23, 2017 at 4:46 PM, Alex Su <[hidden email]> wrote:
My understanding is that onAllWS is supposed to modify the StackSet somehow to enable Alt-Tabbing across all windows on visible screens; beyond that my Haskell is a little too elementary to understand what is happening.

The code you show runs a single action across the workspaces on all screens. `onAllWS W.focusDown` would switch the focus on all visible workspaces, otherwise leaving you where you were. This is not the droid you're looking for....

--
brandon s allbery kf8nh                               sine nomine associates
[hidden email]                                  [hidden email]
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net


_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cycle through all visible windows

Brandon Allbery
Not really; I know more about workspace cycling. Don't even use alt-tab... but I think focus cycling across workspaces like that will be difficult given how focused the core is on stacks (which are part of a single workspace).

On Thu, Feb 23, 2017 at 5:02 PM, Alex Su <[hidden email]> wrote:
Any ideas about a more suitable droid?

On Thu, Feb 23, 2017 at 3:55 PM, Brandon Allbery <[hidden email]> wrote:

On Thu, Feb 23, 2017 at 4:46 PM, Alex Su <[hidden email]> wrote:
My understanding is that onAllWS is supposed to modify the StackSet somehow to enable Alt-Tabbing across all windows on visible screens; beyond that my Haskell is a little too elementary to understand what is happening.

The code you show runs a single action across the workspaces on all screens. `onAllWS W.focusDown` would switch the focus on all visible workspaces, otherwise leaving you where you were. This is not the droid you're looking for....

--
brandon s allbery kf8nh                               sine nomine associates
[hidden email]                                  [hidden email]
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net




--
brandon s allbery kf8nh                               sine nomine associates
[hidden email]                                  [hidden email]
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net

_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Cycle through all visible windows

Alex Su
Hmm okay. I wonder how Windows.Actions.Navigate2D does it...maybe there's some way to copy their implementation and just get rid of the directional part; guess it's time for me to learn Haskell properly. Thanks!

On Thu, Feb 23, 2017 at 4:06 PM, Brandon Allbery <[hidden email]> wrote:
Not really; I know more about workspace cycling. Don't even use alt-tab... but I think focus cycling across workspaces like that will be difficult given how focused the core is on stacks (which are part of a single workspace).

On Thu, Feb 23, 2017 at 5:02 PM, Alex Su <[hidden email]> wrote:
Any ideas about a more suitable droid?

On Thu, Feb 23, 2017 at 3:55 PM, Brandon Allbery <[hidden email]> wrote:

On Thu, Feb 23, 2017 at 4:46 PM, Alex Su <[hidden email]> wrote:
My understanding is that onAllWS is supposed to modify the StackSet somehow to enable Alt-Tabbing across all windows on visible screens; beyond that my Haskell is a little too elementary to understand what is happening.

The code you show runs a single action across the workspaces on all screens. `onAllWS W.focusDown` would switch the focus on all visible workspaces, otherwise leaving you where you were. This is not the droid you're looking for....

--
brandon s allbery kf8nh                               sine nomine associates
[hidden email]                                  [hidden email]
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net




--
brandon s allbery kf8nh                               sine nomine associates
[hidden email]                                  [hidden email]
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net


_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Loading...