#! /bin/sh

export PANEL_FIFO="/tmp/djsissom-panel-fifo"
export XDG_CURRENT_DESKTOP="KDE"
#export QT_QPA_PLATFORMTHEME="qt5ct"
export SAL_USE_VCLPLUGIN="kde4"
export XDG_MENU_PREFIX=plasma- systemctl --user import-environment XDG_MENU_PREFIX dbus-update-activation-environment XDG_MENU_PREFIX



sxhkd &								# start hotkey daemon



bspc config border_width				2
bspc config window_gap					12
bspc config split_ratio					0.6
#bspc config borderless_monocle			true
#bspc config gapless_monocle				true
bspc config history_aware_focus			true
#bspc config pointer_follows_monitor		true
#bspc config auto_cancel					true
bspc config remove_disabled_monitors	false
bspc config remove_unplugged_monitors	false
#bspc config persistent_monitors			true
bspc config merge_overlapping_monitors	true
bspc config presel_feedback_color		\#FFFFFF

bspc config ignore_ewmh_focus			true
bspc config click_to_focus				true
bspc config pointer_modifier			mod1

bspc config normal_border_color '#000000'
bspc config active_border_color '#000000'
bspc config focused_border_color '#00FFEE'


# hack to fix monitor order
#bspc monitor -s left


bspc rule -a Gimp state=floating
bspc rule -a Gimp-2.8 state=floating
bspc rule -a *:gwenview state=floating layer=above
bspc rule -a *:gv state=floating
bspc rule -a *:feh state=floating
bspc rule -a *:Plugin-container state=floating
bspc rule -a *:Conky sticky=on manage=off lower=on
bspc rule -a *:Screenkey manage=off
bspc rule -a *:Steam border=off state=floating
bspc rule -a *:Stellaris border=off state=fullscreen
#bspc rule -a vlc:vlc state=floating layer=above

bspc config external_rules_command "$HOME/.config/bspwm/external_rules"


i=1
#for monitor in DVI-D-0 DVI-I-1 DP-1; do
#for monitor in $(bspc query -M); do
for monitor in $(bspc query -M --names); do
	bspc monitor $monitor \
			-d $i/Desktop-2 $i/Desktop-1 $i/Desktop-0 $i/Desktop+1 $i/Desktop+2
			#-n "$i" \
		let i++
done
#NMON=$i
unset i


for i in {1..6}; do
	bspc desktop --focus next;
	bspc monitor --focus next;
done

bspc monitor --focus DP-2

#bspc monitor -r Desktop2

#bspc monitor DVI-D-0 -d I II III
#bspc monitor DVI-I-0 -d IV V VI
#bspc monitor DP-1    -d VII VIII IX


#!/bin/sh
#
#i=1
#for monitor in $(bspc query -M); do
#bspc monitor $monitor \
#        -n "$i" \
#        -d $i/{i,ii,iii,iv,v,vi,vii,viii,ix,x}
#    let i++
#done
#NMON=$i
#unset i
#
#bspc config top_padding 14 
#
## Visual options
#bspc config split_ratio         0.50
#bspc config border_width        1
#bspc config window_gap          4
#bspc config borderless_monocle  true
#bspc config gapless_monocle     true
#bspc config focus_follows_pointer true
#bspc config auto_alternate true
#bspc config auto_cancel true
#bspc config normal_border_color "#504339"
#bspc config active_border_color "#504339"
#bspc config focused_border_color "#817267"
#bspc config presel_border_color "#9a875f"
#bspc config urgent_border_color "#504339"
#bspc config normal_frame_opacity 0.0
#bspc config focused_frame_opacity 0.1
#
#
## Rules
#bspc rule -a Skype pseudo_tiled=on
#bspc rule -a Spotify pseudo_tiled=on
#bspc rule -a Thunar pseudo_tiled=on
#bspc rule -a Skype pseudo_tiled=on
#bspc rule -a File-roller pseudo_tiled=on
#bspc rule -a Transmission-gtk pseudo_tiled=on
#bspc rule -a Conky sticky=on manage=off lower=on
#bspc rule -a astime sticky=on
#bspc rule -a feh floating=on manage=off
#

[ -e "$PANEL_FIFO" ] && bspc subscribe report > "$PANEL_FIFO" &
pgrep -x panel > /dev/null || bspwm-panel &