Separated loading workspace and init script with bspwm so it can be run one or another

Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
This commit is contained in:
Louis Vallat 2022-06-23 11:05:52 +02:00
parent 3fcc0c2073
commit 14ae6d7099
No known key found for this signature in database
GPG Key ID: 0C87282F76E61283
3 changed files with 31 additions and 25 deletions

View File

@ -1,4 +1,4 @@
#!/bin/bash
dunstify "Autorandr" "Changed configuration to $AUTORANDR_CURRENT_PROFILE."
"${HOME}"/.config/bspwm/bspwmrc
"${HOME}"/.config/load_workspace.sh

View File

@ -4,39 +4,22 @@
set -x
# Autostart
autorandr --change & disown
pgrep -x sxhkd > /dev/null || sxhkd & disown
xrdb -load $HOME/.config/.Xresources &
dunst -conf $HOME/.config/dunst/dunstrc &
picom --experimental-backends &
$HOME/.fehbg &
xrdb -load $HOME/.config/.Xresources & disown
dunst -conf $HOME/.config/dunst/dunstrc & disown
picom --experimental-backends & disown
/usr/lib/kdeconnectd & disown
pgrep 'nextcloud' || nextcloud & disown
killall polybar
nextcloud & disown
xset -b
DISPLAYS=$(xrandr -q | grep -w 'connected' | grep -v 'primary' | cut -d ' ' -f 1)
PRIMARY_DISPLAY=$(xrandr -q | grep -w 'connected primary' | cut -d ' ' -f 1)
echo "Displays '${DISPLAYS}' have been detected. '${PRIMARY_DISPLAY}' is primary."
bspc config border_width 0
bspc config window_gap 8
bspc config top_padding 20
bspc config split_ratio 0.6
EXT_DISPLAY=${DISPLAYS%% *}
killall -q polybar
if [ "${EXT_DISPLAY}" != "" ]; then
bspc monitor ${PRIMARY_DISPLAY} -d 1 2 3 4 5
bspc monitor ${EXT_DISPLAY} -d 6 7 8 9 0
MONITOR=${EXT_DISPLAY} polybar main & disown
else
bspc monitor ${PRIMARY_DISPLAY} -d 1 2 3 4 5 6 7 8 9 0
fi
MONITOR=${PRIMARY_DISPLAY} polybar main & disown
# Fix for Java applications
wmname LG3D
"${HOME}"/.config/load_workspace.sh & disown

23
.config/load_workspace.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
set -x
$HOME/.fehbg &
DISPLAYS=$(xrandr -q | grep -w 'connected' | grep -v 'primary' | cut -d ' ' -f 1)
PRIMARY_DISPLAY=$(xrandr -q | grep -w 'connected primary' | cut -d ' ' -f 1)
echo "Displays '${DISPLAYS}' have been detected. '${PRIMARY_DISPLAY}' is primary."
EXT_DISPLAY=${DISPLAYS%% *}
killall -q polybar
if [ "${EXT_DISPLAY}" != "" ]; then
bspc monitor ${PRIMARY_DISPLAY} -d 1 2 3 4 5
bspc monitor ${EXT_DISPLAY} -d 6 7 8 9 0
MONITOR=${EXT_DISPLAY} polybar main & disown
else
bspc monitor ${PRIMARY_DISPLAY} -d 1 2 3 4 5 6 7 8 9 0
fi
MONITOR=${PRIMARY_DISPLAY} polybar main & disown