Created
March 19, 2020 19:12
-
-
Save nagy135/ee6759b913da1987937df056074bddd1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
wid=$1 | |
class=$2 | |
instance=$3 | |
monitor=$4 | |
desktop=$5 | |
node=$6 | |
if [[ "$class" == "mpv" ]]; then | |
desktop=$(($(bspc query -D -d --names) - 1)) | |
target=$(wmctrl -l -G -x | grep mpv | awk -v desktop=$desktop '$2 == desktop {print $1 " " $5*$6}' | sort -k2 -n -r | awk '{print $1}' | sed 1q) | |
if [[ $target != '' ]]; then | |
width=$(wmctrl -l -G | grep $target | awk '{print $5}') | |
height=$(wmctrl -l -G | grep $target | awk '{print $6}') | |
if [[ $width -gt $height ]]; then | |
bspc node $target -p east | |
else | |
bspc node $target -p south | |
fi | |
bspc node -f $target | |
echo "state=tiled" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment