#!/bin/bash

# 颜色定义, 同alacritty主题
color_background='#475569'
color_foreground='#d8dee9'
color_altbackground='#39404f'
color_altforeground='#768bb2'
color_accent='#81a1c1'
color_black='#3b4252'
color_red='#bf616a'
color_green='#a3be8c'
color_yellow='#ebcb8b'
color_blue='#81a1c1'
color_magenta='#b48ead'
color_cyan='#88c0d0'
color_white='#e5e9f0'
color_altblack='#4c566a'
color_altred='#bf616a'
color_altgreen='#a3be8c'
color_altyellow='#ebcb8b'
color_altblue='#81a1c1'
color_altmagenta='#b48ead'
color_altcyan='#8fbcbb'
color_altwhite='#eceff4'



## 修复java程序打开空白的问题
export _JAVA_AWT_WM_NONREPARENTING=1
# 或者安装wmname后执行下面这句
#wmname LG3D

# 设置显示器分辨率
xrandr --output HDMI-2 --mode 1920x1080 --rate 60 --right-of HDMI-1 --mode 1920x1080 --rate 60


# 干掉已经运行的进程
killall -9 sxhkd picom nm-applet dunst xsettingsd polybar

# 2个显示器, 左显示器配置4个工作区, 右显示器只配置1个工作区
bspc monitor HDMI-1 -d I II III IV
bspc monitor HDMI-2 -d I

# bspwm 基础配置
bspc config border_width 2
bspc config window_gap 8
bspc config split_ratio 0.52

bspc config focused_border_color "$color_blue"
bspc config normal_border_color "$color_background"
bspc config active_border_color "$color_background"
bspc config presel_feedback_color "$color_background"


# 删除已有的规则
bspc rule -r *:*

# 终端默认设为浮动
bspc rule -a Alacritty state=floating focus=on
bspc rule -a Xfce4-terminal state=floating focus=on

# 一些软件, 也设为浮动
for app_c in  Thunar Code Sublime_text Google-chrome Inkscape Gnome-boxes \
  dingtalk_run Crossover TelegramDesktop
do
  bspc rule -a "$app_c" state=floating focus=on
done

bspc rule -a *:* state=floating focus=on



# 设置壁纸
feh --bg-fill ~/.local/share/debian.png

# 修复鼠标状态
xsetroot -cursor_name left_ptr

# 设置系统主题
xsettingsd &

# 认证agent
if [[ ! "$(pidof xfce-polkit)" ]]; then
  xfce-polkit &
fi

# 启动配套的服务
polybar main -r &
sxhkd &
nm-applet &
dunst &


## 一些已经用systemd启动的服务
# pipewire, mpd, blueman


picom -b --experimental-backends
