improve licensing
[distro-setup] / i3-pull
1 #!/bin/bash
2
3 # sometimes I want to pull in and sometimes I want to swap.
4
5 set -e; . /usr/local/lib/bash-bear; set +e
6
7 mark=$1
8 h=$(i3-msg -t get_tree | jq -r ".. | select(.focused? == true) | .rect.height")
9
10 cur_workspace=$(i3-msg -t get_workspaces | jq -r '.[] | select(.focused? == true) | .name')
11
12
13 # 1080 = half the 4k height
14 #if [[ $cur_workspace == 1 && $h ]] && (( h <= 1080 )); then
15 if [[ $cur_workspace == 1 && $h ]]; then
16 i3-msg "swap container with mark $mark; [con_mark=\"$mark\"] focus"
17 else
18 i3-msg '[con_mark="'$mark'"] move workspace current'
19 fi