#! /bin/sh

killall picom
killall uim-xim
killall uim-toolbar-gtk-systray
killall eww
exec ~/.screenlayout/dual.sh &
pgrep -x sxhkd > /dev/null || sxhkd -m -1 &
setxkbmap -layout "us,ru" -option "grp:caps_toggle" &

bspc monitor eDP-1 -d Browsing I II III IV Coding Zettlr Messengers Admin
bspc monitor HDMI-1 -d V VI VII
bspc config border_width         3
bspc config window_gap           28
if [[ -e /tmp/grayscale ]] then
	picom --window-shader-fg=/home/greg/.config/picom/picom.conf.glsl &
  nitrogen --set-auto "/home/greg/Pictures/Wallpapers/desert_grayscale.jpg"
  bspc config focused_border_color \#747474
  bspc config presel_feedback_color \#747474
  bspc config marked_border_color \#747474
else
  picom &
  nitrogen --restore &
  bspc config focused_border_color \#027C9B
  bspc config presel_feedback_color \#027C9B
  bspc config marked_border_color \#027C9B
  bspc config automatic_scheme     alternate
fi

uim-xim &
uim-toolbar-gtk-systray &
xmousepasteblock &
xsel -fin </dev/null &
killall xbindkeys
xbindkeys &
bspc config split_ratio          0.5
bspc config borderless_monocle   true
bspc config gapless_monocle      true

#bspc config focus_follows_pointer       true

# Discord is an ass
bspc config ignore_ewmh_focus true

exec ~/.config/polybar/hack/launch.sh &
exec ~/.config/bspwm/polyhide.sh &

bspc rule -a zenity state=floating
bspc rule -a Gimp desktop='^8' state=floating follow=on
bspc rule -a Kupfer.py focus=on
bspc rule -a Screenkey manage=off
bspc rule -a nitrogen state=floating sticky=on

bspc rule -a TelegramDesktop desktop='^8' follow=off
bspc rule -a Element desktop='^8' follow=off
bspc rule -a WebCord desktop='^8' follow=off
bspc rule -a superProductivity desktop='^7' follow=off
bspc rule -a steam desktop='^9' follow=off

bspc rule -a matplotlib state=floating
bspc rule -a "kitty" rectangle=800x500+560+290
bspc rule -a "Extract" state=floating

bspc config pointer_modifier mod4

# exec ~/.config/bspwm/marked.sh &

if [ ! -e /tmp/startup_completed ]; then

    pactl set-sink-volume 0 0%
    telegram-desktop &
    # element-desktop &
    # webcord &
    nextcloud &
    superproductivity &
    sleep 0.25
    touch /tmp/startup_completed
fi
