Help with conditional dispatch in Lua
I have switched my workspaces to slide up/down instead of left/right, because it seems more logical on a multi monitor system. This is of course purely cosmetic, but it gives me a mental map of the workspace layout.
Now I would like to have "SUPER + down" switch to the next workspace on current monitor if there are no windows below the current one. I have the dispatches for both actions:
hl.bind("SUPER + down", hl.dsp.focus({ direction = "down" }))
hl.bind("SUPER + CTRL + down", hl.dsp.focus({ workspace = "r+1" }))
But I would like to have them work like described above under the same "SUPER + down" bind. They would of course work similarly up, but suspect the logic will be very similar. I don't really know Lua, but I do program professionally so I think I could figure out that part with some help. But the thing I'm struggling with is how to detect the lowest window, I'm having a hard time understanding the wiki.
What I'm looking for are some pointers to how / if this can be done. I would prefer to do it in Lua, in the config file, but I'm open to other suggestions as well.
Edit: forgot code block formatting.