From f4d331af566db3e8eaa33f45178c41e5836f1278 Mon Sep 17 00:00:00 2001 From: yutent Date: Thu, 17 Aug 2023 06:51:26 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96bspwm=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- home/config/bspwm/bspwmrc | 40 +++++++++++++++++++++++++--------- home/config/bspwm/subscribe.sh | 10 +++++++++ 2 files changed, 40 insertions(+), 10 deletions(-) create mode 100755 home/config/bspwm/subscribe.sh diff --git a/home/config/bspwm/bspwmrc b/home/config/bspwm/bspwmrc index aa43d22..44f6223 100755 --- a/home/config/bspwm/bspwmrc +++ b/home/config/bspwm/bspwmrc @@ -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 # 每次启动时, 删除该文件 -rm ~/.cxoffice/wechat/.eval +if [ -f ~/.cxoffice/wechat/.eval ]; then + rm ~/.cxoffice/wechat/.eval +fi + +# 订阅事件` +(sleep 3; ~/.config/bspwm/subscribe.sh) & diff --git a/home/config/bspwm/subscribe.sh b/home/config/bspwm/subscribe.sh new file mode 100755 index 0000000..2ab19a1 --- /dev/null +++ b/home/config/bspwm/subscribe.sh @@ -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