mirror of https://github.com/einverne/dotfiles.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
558 B
25 lines
558 B
#!/bin/sh |
|
|
|
# https://github.com/koekeishiya/yabai/issues/225 |
|
|
|
case "${1}" in |
|
next) |
|
step=1 |
|
;; |
|
prev) |
|
step=-1 |
|
;; |
|
*) |
|
echo >&2 "ERROR: must provide an argument 'next' or 'prev'!" |
|
exit 1 |
|
;; |
|
esac |
|
|
|
jq -nr \ |
|
--argjson displays "$(yabai -m query --displays)" \ |
|
--argjson focused "$(yabai -m query --displays --display)" \ |
|
--argjson step "$step" \ |
|
'$displays |
|
| sort_by(.frame.x) |
|
| .[index($focused) + if (index($focused) + $step) < 0 then 0 else $step end].index // $focused.index' \ |
|
| xargs yabai -m display --focus
|
|
|