Permalink
Browse files

more

  • Loading branch information...
neeasade committed Aug 20, 2018
1 parent 2fb62bf commit 09c40063508a944f84d158558e917a6318932155
Showing with 23 additions and 29 deletions.
  1. +1 −1 bin/bin/epager
  2. +22 −28 wm/.wm/scripts/interact/move.sh
View
@@ -9,5 +9,5 @@ target="$(mktemp)"
) > "$target"
mode="${1:-text-mode}"
elisp "(neeasade/find-or-open \"${target}\") (${mode})"
elisp "(ns/find-or-open \"${target}\") (${mode})"
rm "$target"
@@ -20,38 +20,32 @@ floating_move() {
}
tiled_move() {
if bspc node -f $dir.local; then
bspc node -s $node
bspc node -f $node
else
case $dir in
west) dim=height;;
east) dim=height;;
north) dim=width;;
south) dim=width;;
esac
(bspc node -n "$dir".!automatic || bspc node -s "$dir") && exit
# compare height or width to parent
self_measure="$(bspc query -T -n "$node" | jq .rectangle.$dim)"
parent_measure="$(bspc query -T -n "${node}#@parent" | jq .rectangle.$dim)"
parent_measure="${parent_measure:-$self_measure}"
case $dir in
west) dim=height;;
east) dim=height;;
north) dim=width;;
south) dim=width;;
esac
if [ "$parent_measure" -gt "$self_measure" ]; then
parent="$(bspc query -N -n "${node}#@parent")"
bspc node $parent -p $dir
bspc node $parent -i
# compare height or width to parent
self_measure="$(bspc query -T -n "$node" | jq .rectangle.$dim)"
parent_measure="$(bspc query -T -n "${node}#@parent" | jq .rectangle.$dim)"
parent_measure="${parent_measure:-$self_measure}"
# the .leaf.!window query didn't work
receptacle_id="$(bspc query -T -n "${node}#@parent#@parent" | jq '.. | .?, .root?, .firstChild?, .secondChild? | select (.client == null and .firstChild == null and .secondChild == null) | .id' | grep -v null | head -n 1)"
if [ "$parent_measure" -gt "$self_measure" ]; then
parent="$(bspc query -N -n "${node}#@parent")"
bspc node $parent -p $dir
bspc node $parent -i
bspc node $node -n $receptacle_id
else
parent="$(bspc query -N -n "${node}#@parent")"
if [ ! -z "$parent" ]; then
node="$parent"
tiled_move
fi
fi
# the .leaf.!window query didn't work
receptacle_id="$(bspc query -T -n "${node}#@parent#@parent" | jq '.. | .?, .root?, .firstChild?, .secondChild? | select (.client == null and .firstChild == null and .secondChild == null) | .id' | grep -v null | head -n 1)"
bspc node $node -n $receptacle_id
else
node="$(bspc query -N -n "${node}#@parent")"
[ ! -z "$node" ] && tiled_mode
fi
}

0 comments on commit 09c4006

Please sign in to comment.