From e4e04bc7cf820cb0663fdb1597dfe047f512da5b Mon Sep 17 00:00:00 2001 From: Valentin Boettcher Date: Thu, 31 Dec 2020 18:23:06 +0100 Subject: [PATCH] make bspwm config ready for the main desktop --- config.desktop.sh | 5 ++-- dots/bspwm/{bspwmrc => bspwmrc.template} | 7 ++++++ dots/bspwm/monitor_desktop.sh.template | 23 +++++++++++++++++++ dots/polybar/{config => config.template} | 21 ++++++++++++++--- .../polybar/{launch.sh => launch.sh.template} | 8 +++++++ 5 files changed, 59 insertions(+), 5 deletions(-) rename dots/bspwm/{bspwmrc => bspwmrc.template} (92%) create mode 100755 dots/bspwm/monitor_desktop.sh.template rename dots/polybar/{config => config.template} (85%) rename dots/polybar/{launch.sh => launch.sh.template} (55%) diff --git a/config.desktop.sh b/config.desktop.sh index 26813b8..edeeeb4 100644 --- a/config.desktop.sh +++ b/config.desktop.sh @@ -3,8 +3,9 @@ ETH_DEV="enp3s0" MAIN_NET=$ETH_DEV MAIN_FONT="Source Code Pro 8" -MAIN_MONITOR=DisplayPort-0 -MONITORS=(DVI-I-0 DisplayPort-2) +MONITORS=($(xrandr | rg -i "\sconnected" | rg -v eDP | cut -d" " -f1)) +MAIN_MONITOR=${MONITORS[2]} +SIDE_MONITORS=($(xrandr | rg -i "\sconnected" | rg -v eDP | cut -d" " -f1 | grep -v $MAIN_MONITOR)) RYGEL="true" BAR_POS="bottom" DPI=91 diff --git a/dots/bspwm/bspwmrc b/dots/bspwm/bspwmrc.template similarity index 92% rename from dots/bspwm/bspwmrc rename to dots/bspwm/bspwmrc.template index 4fbde92..4b976a5 100755 --- a/dots/bspwm/bspwmrc +++ b/dots/bspwm/bspwmrc.template @@ -33,5 +33,12 @@ bspc config remove_unplugged_monitors true # Scripts # ############################################################################### +{{ #laptop }} ~/.config/bspwm/monitor_laptop.sh +{{ /laptop }} + +{{ ^laptop }} +~/.config/bspwm/monitor_desktop.sh +{{ /laptop }} + ~/.config/polybar/launch.sh diff --git a/dots/bspwm/monitor_desktop.sh.template b/dots/bspwm/monitor_desktop.sh.template new file mode 100755 index 0000000..440b059 --- /dev/null +++ b/dots/bspwm/monitor_desktop.sh.template @@ -0,0 +1,23 @@ +############################################################################### +# External Monitor # +############################################################################### + +declare -A workspaces +workspaces[2]="I V VI VIII IX X" +workspaces[0]="II IV VII" +workspaces[1]="III IX" + +MONITORS=({{ MONITORS[@] }}) + +move_to_monitor() { + for D in $(echo $1 | tr " " "\n"); do + bspc desktop $D --to-monitor $2 + done +} + +I=0 +for MONITOR in $MONITORS; do + bspc monitor $MONITOR -d ${workspaces[${I}]} + ((I=I+1)) + # move_to_monitor "${workspaces[${I}]}" $MONITOR +done diff --git a/dots/polybar/config b/dots/polybar/config.template similarity index 85% rename from dots/polybar/config rename to dots/polybar/config.template index 5903462..b6200a6 100644 --- a/dots/polybar/config +++ b/dots/polybar/config.template @@ -26,15 +26,23 @@ border-bottom-color = ${colors.bordercolor} font-0 = Fira Code:size=10;2 font-1 = FontAwesome:size=10;2 +{{ #LAPTOP }} [bar/ext] inherit = bar/base - -monitor = HDMI-2 +monitor = {{.}} modules-left = bspwm +{{ /LAPTOP }} + +{{#SIDE_MONITORS}} +[bar/ext__{{.}}] +inherit = bar/base +monitor = {{.}} +modules-left = bspwm +{{/SIDE_MONITORS}} [bar/main] inherit = bar/base -monitor = eDP-1 +monitor = {{ MAIN_MONITOR }} spacing = 3 lineheight = 2 @@ -45,7 +53,14 @@ module-margin-right = 1 separator = | modules-left = bspwm + +{{ #LAPTOP }} modules-right = battery clock +{{ /LAPTOP }} + +{{ ^LAPTOP }} +modules-right = clock +{{ /LAPTOP }} tray-position = center diff --git a/dots/polybar/launch.sh b/dots/polybar/launch.sh.template similarity index 55% rename from dots/polybar/launch.sh rename to dots/polybar/launch.sh.template index 419418b..e8051f6 100755 --- a/dots/polybar/launch.sh +++ b/dots/polybar/launch.sh.template @@ -1,5 +1,13 @@ #!/bin/sh polybar-msg cmd quit polybar main & disown + +{{ #LAPTOP }} polybar ext & disown +{{ /LAPTOP }} + +{{#SIDE_MONITORS}} +polybar ext__{{.}} & disown +{{/SIDE_MONITORS}} + xdo id -m -N Polybar && polybar-msg cmd hide