Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execute an action when ForEach failed to find a match #12

Open
tnymlr opened this issue Nov 11, 2018 · 0 comments
Open

Execute an action when ForEach failed to find a match #12

tnymlr opened this issue Nov 11, 2018 · 0 comments

Comments

@tnymlr
Copy link

tnymlr commented Nov 11, 2018

Whenever ForEach runs it allows to execute else branch for a query but it does it for each client that failed to match the query.

Please, add an option to execute certain action when none of the clients were able to match a query.
It would effectively allow people to achieve "focus or run" functionality with configuration that looks something like that:

<keybind key="A-W-f">
	<action name="ForEach">
		<query target="default">
			<class>RangerFm</class>
			<desktop>current</desktop>
		</query>
		<then>
			<action name="Focus"/>
			<action name="Raise"/>
			<action name="Unshade"/>
			<action name="Stop"/>
		</then>
		<none>
			<action name="Execute">
				<command>gtk-launch ranger</command>
			</action>
		</none>
	</action>
</keybind>
tnymlr pushed a commit to tnymlr/openbox that referenced this issue Nov 11, 2018
Added a new XML node into ForEach action configuration - `none`.

Extracted application of `if` action into separate function which
returns result that indicates of a client matches the query.

`ForEach` tracks the execution of `do_run_if` and exectues actions
mentioned in `none` node if none of the `if` were able to find a match
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

No branches or pull requests

1 participant