优化bspwm配置

master
yutent 2023-08-17 06:51:26 +00:00 committed by GitHub
parent e686d925d3
commit f4d331af56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 10 deletions

View File

@ -1,6 +1,7 @@
#!/bin/bash
# 颜色定义, 同alacritty主题
color_border='#57606f'
color_background='#475569'
color_foreground='#d8dee9'
color_altbackground='#39404f'
@ -40,7 +41,7 @@ killall -9 sxhkd xsettingsd
# 2个显示器, 左显示器配置4个工作区, 右显示器只配置1个工作区
bspc monitor HDMI-1 -d I II III IV
bspc monitor HDMI-2 -d I
bspc monitor HDMI-2 -d V VI
# bspwm 基础配置
bspc config border_width 2
@ -48,9 +49,15 @@ 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 config normal_border_color "$color_border"
bspc config active_border_color "$color_border"
bspc config presel_feedback_color "$color_border"
# 将这2个桌面的布局设为monocle
bspc desktop II -l monocle
bspc desktop V -l monocle
# 工作区跟随鼠标切换
bspc config focus_follows_pointer false
@ -63,8 +70,12 @@ bspc config gapless_monocle true
# 工作区只有一个窗口时, 将工作区切为monocle布局
bspc config single_monocle true
# kill掉所有的订阅进程
all_sub_pid=$(pgrep -f 'bspc subscribe')
if [ "$all_sub_pid" ]; then
kill -9 $all_sub_pid
fi
# 删除已有的规则
bspc rule -r *:*
@ -98,6 +109,12 @@ xsetroot -cursor_name left_ptr
# 设置系统主题
xsettingsd &
if [[ ! "$(pidof picom)" ]]; then
picom -b --experimental-backends
fi
# 一些配套服务
if [[ ! "$(pidof xfce-polkit)" ]]; then
xfce-polkit &
fi
@ -111,7 +128,8 @@ if [[ ! "$(pidof dunst)" ]]; then
fi
if [[ ! "$(pidof plank)" ]]; then
plank &
# 延时5秒再执行
(sleep 5; plank) &
fi
@ -133,9 +151,11 @@ sxhkd &
# pipewire, mpd, blueman
if [[ ! "$(pidof picom)" ]]; then
picom -b --experimental-backends
fi
# 每次启动时, 删除该文件
if [ -f ~/.cxoffice/wechat/.eval ]; then
rm ~/.cxoffice/wechat/.eval
fi
# 订阅事件`
(sleep 3; ~/.config/bspwm/subscribe.sh) &

10
home/config/bspwm/subscribe.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
bspc subscribe pointer_action | while read -a msg ; do
ev="${msg[5]}" # begin | end
nid="${msg[3]}" # begin | end
#echo ${msg[1]},${msg[3]},${msg[4]},${msg[5]}
if [ $ev == "end" ]; then
bspc node $nid -f
fi
done