bspwm/external.sh

54 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
wid=$1
class=$2
instance=$3
consequences=$4
title=$(xtitle "$wid")
role="$(xprop -id "$wid" WM_WINDOW_ROLE | awk -F '"' '{print $2}')"
if [ $class = "Thunderbird" ] && [ $role = "messageWindow" ] || [ $role = "Msgcompose" ] ; then
echo "state=floating"
echo "rectangle=1080x868+0+800"
exit
fi
if [ $class = "Surf" ] ; then
echo "state=floating"
echo "follow=on"
echo "rectangle=1080x868+0+700"
exit
fi
# notify-send "$title" "$1 | class: '$2' | instance: '$3' | $4 | role: '$role'"
#place floating windows
#adapted from https://github.com/baskerville/bspwm/issues/263
floats=$(bspc query -N -n .floating -d .focused | wc -l)
xdotool windowmove --sync $wid $(( 50 + 50 * floats )) 300
case "$role" in
messageWindow)
echo "state=floating"
;;
WM_FORCE_FLOATING)
echo "state=floating"
;;
WM_FORCE_TILED)
echo "state=tiled"
;;
WM_FORCE_FULLSCREEN)
echo "state=fullscreen"
;;
esac
# case $state in
# floating)
# if [ -z "$desktop" ] || [ "$desktop" = "$(bspc query -D -d --names)" ] && [ -z "$rectangle" ]; then
# rule="${rule}$(centerfloat) center=false "
# fi
# ;;
# esac