Skip to content

Conversation

@brainwater
Copy link

This is best used with the ForEach action, which calls If on each window. If you consider a 3 row and 4 column grid on the screen, then the following keybind will raise and focus the window in upper left square of that grid (more specifically, the window that would be raised and focused if you were to click on the center of the upper left most square).

      <action name="ForEach">
        <query>
          <containsxpoint>1/8</containsxpoint>
          <containsypoint>1/6</containsypoint>
        </query>
        <then>
          <action name="Focus"/>
          <action name="Raise"/>
          <action name="Stop"/>
        </then>
      </action>

From my rc.xml file.

…windows front to back (if true) or back to front (if false) or do the original behavior if not present.
@brainwater
Copy link
Author

I realized that this has unexpected behavior when multiple windows are at the specified point, since the client_list is not in front to back order. To fix this, I added a stacking_order tag that allows the user to specify the foreach either go in front to back (if true) or back to front (if false) order. I'm not completely satisfied with using this 3-state boolean (true, false, not present) for this purpose and am open to suggestions. It would not be completely obvious to a user that having stacking_order false and having stacking_order not be there would cause 2 different results, so at a minimum it would have to be clearly documented.

An example configuration for this which would take the topmost window in the upper lefthand corner of the screen and raise and focus it is:

    <keybind key="W-C-q">
      <action name="ForEach">
        <stacking_order>true</stacking_order>
        <query>
          <containsxpoint>1/8</containsxpoint>
          <containsypoint>1/6</containsypoint>
        </query>
        <then>
          <action name="Focus"/>
          <action name="Raise"/>
          <action name="Stop"/>
        </then>
      </action>
    </keybind>

@danakj
Copy link
Owner

danakj commented Oct 9, 2015

What if we just walked for each in stacking order always? The order we do it now is kinda arbitrary.

@brainwater
Copy link
Author

I have created a new branch ifpoint-revised that contains the fixes for the issues raised in this pr. New pull request is #22

@brainwater brainwater closed this Jan 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants