Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
neeasade committed Aug 20, 2018
1 parent 2fb62bf commit 09c4006
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 29 deletions.
2 changes: 1 addition & 1 deletion bin/bin/epager
Expand Up @@ -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"
50 changes: 22 additions & 28 deletions wm/.wm/scripts/interact/move.sh
Expand Up @@ -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
}

Expand Down

0 comments on commit 09c4006

Please sign in to comment.