Aspect Ratio Conditional

Hi there! I'm trying to figure out how to do a conditional behavior based on aspect ratio. I have a keyboard shortcut that does certain window snapping stuff and I'd like it to do slightly different things when I'm on an ultrawide monitor vs a 16:9, and I switch back and forth quite often.

I did see an "if" action, but within the conditions editor, I don't see a way to write any kind of code to do math, and I don't see an aspect ratio variable. I was going to try something like "if focused_screen_width / focused_screen_height == blabla", but it doesn't seem like you can write code in the code box - it gets overwritten by what the GUI is doing.

You are right, the editor doesn't allow for if conditions or the like.
Instead of this, you'd need to use some Java Script. To make this easier I just added a new action/condition "If Java Script Returns True", which can be used like this. This action is available starting with BTT 4.348 alpha.

async function someJavaScriptFunction() {

	let focused_screen_width = await get_number_variable("focused_screen_width");
	let focused_screen_height = await get_number_variable("focused_screen_height");

    console.log('aspect ratio', focused_screen_width / focused_screen_height);

	if(focused_screen_width / focused_screen_height > 1.5 ) {
		return true
	} else {
		return false
	}
		
		
}

What speed on the turnaround! Thank you. I tried it and it works well.

Now that I'm in the Alpha channel for updates, what's the easiest way to know when I can switch back to the stable release (i.e. when will this get merged into a stable release?)