#!/bin/sh

coded_by='

In the name of Allah, the most Gracious, the most Merciful.

 ▓▓▓▓▓▓▓▓▓▓
░▓ Author ▓ Abdullah <https://abdullah.today>
░▓▓▓▓▓▓▓▓▓▓
░░░░░░░░░░

░█▀▄░█▀▀░█▀█░█░█░█▄█░░░█▀▄░█░█░█░░░█▀▀░█▀▀
░█▀▄░▀▀█░█▀▀░█▄█░█░█░░░█▀▄░█░█░█░░░█▀▀░▀▀█
░▀▀░░▀▀▀░▀░░░▀░▀░▀░▀░░░▀░▀░▀▀▀░▀▀▀░▀▀▀░▀▀▀
'


wid=$1
class=$2
instance=$3
title=$(xdotool getwindowname $wid)

# if there are more than 4 tiled windows on desktop, open new ones as floating

# tiled_windows=$(bspc query -N -d focused -n '.!hidden.!floating.!fullscreen.window' | wc -l)

# if [ $tiled_windows -gt 3 ]; then
#     echo "state = floating"
# fi

case $class in
  [Rr]edshift-*|[Tt]int2|[Pp]inentry-*|[Mm]u[Pp][Dd][Ff]|[Tt]hunar|[Ff]im|[Gg]picview|[Nn]itrogen|[Aa]randr|[Gg]alculator|[Ff]ont-manager|[Oo]blogout|[Pp]eek|[Ss]kype|[Xx]fce4-appfinder|[Xx]fce4-about|[Gg]pick|[Gg]mrun|[Xx][Cc]alc|[Pp]avucontrol|[Vv]lc|[Ee]o[mg]|[Ff]eh|[Rr]istretto|[Ss]xiv|[Pp]qiv|[Aa]tril|[Ee]vince|scratchpad|fzfmenu|[Gg]itk|[Gg]it-gui|[Ll]eafpad|scrcpy|[Mm]Player|motion_recorder|MEGAsync|jetbrains-idea-ce)
    echo "state = floating"
    echo "center = on"
    ;;
[Mm]pv|gl)
    echo "state = floating"
    #echo "sticky = on"
    echo "focus = on"
    echo "manage = on"
    echo "rectangle = 890x451+0+628"
    ;;
VirtualboxVM)
    echo "manage = off"
    ;;
  Google-chrome)
    echo "desktop = ^2"
    echo "private = on"
    echo "follow = on"
    ;;
  Opera)
    echo "desktop = ^3"
    ;;
  Gimp)
   echo "desktop = ^5"
   ;;
 Anydesk)
   echo "desktop = ^4"
   echo "follow = on"
   ;;
 [Tt]elegram*)
   echo "desktop = ^5"
   echo "follow = on"
   echo "focus = on"
   echo "state = floating"
   echo "rectangle = 1136x674+418+212"
   ;;
 Docky)
   echo "layer = above"
   echo "manage = on"
   echo "border = off"
   echo "focus = off"
   echo "locked = on"
   ;;
 [Ss]talonetray)
   echo "layer = above"
   echo "manage = off"
   echo "focus = off"
   echo "locked = on"
   ;;
 URxvt*)
    echo "border = off"
    ;;
esac

case $title in
  scratchpad|'Terminator Preferences'|'Picture in picture'|'Messenger call')
    echo "state = floating"
    ;;
esac

# vim:ft=sh
