Skip to content

Instantly share code, notes, and snippets.

@tsundokul
Created October 4, 2020 08:11
Show Gist options
  • Save tsundokul/11c29d7cf01e99800b88d7136a74f971 to your computer and use it in GitHub Desktop.
Save tsundokul/11c29d7cf01e99800b88d7136a74f971 to your computer and use it in GitHub Desktop.
bspwm and polybar config
#!/bin/bash
. $HOME/.bashrc
# Check if second monitor is connected and set
# $_SCR1 and $_SCR2 variables
. $HOME/scripts/setscreen.sh
## BSPWM configuration
# Set desktop names
bspc monitor ${_SCR1} -d web code term misc alt
if [[ "${_SCR2}" != "" ]]; then
bspc monitor ${_SCR2} -d 6 7 8
fi
for mon in `bspc query -M`; do
bspc config -m $mon right_padding 0
bspc config -m $mon bottom_padding 0
bspc config -m $mon left_padding 0
bspc config -m $mon top_padding 0
done
# Set spacing
bspc config focus_follows_pointer true
bspc config split_ratio 0.52
bspc config borderless_monocle true
bspc config gapless_monocle true
bspc config auto_alternate true
bspc config auto_cancel true
bspc config focus_by_distance true
bspc config history_aware_focus true
bspc config focused_border_color "#111111"
bspc config normal_border_color "#111111"
# Set rules for certain processes
bspc rule -a Org.gnome.Nautilus state=floating
bspc rule -a Terminator state=floating
bspc rule -a mplayer2 state=floating
bspc rule -a nautilus state=floating
bspc rule -a Screenkey manage=off
bspc rule -a st-256color state=floating
bspc rule -a copyq state=floating
## Process spawning rules
function runs {
# Helper that returns false if a process is running
if pgrep ${1}; then return 1; fi
return 0
}
# Start some processes unless they're already runnning
runs sxhkd && `sxhkd &`
runs copyq && `copyq &`
runs compton && `compton --config $HOME/scripts/compton.conf &`
killall -9 polybar
polybar -c $HOME/scripts/polybar -r primary &
polybar -c $HOME/scripts/polybar -r bottom &
polybar -c $HOME/scripts/polybar -r secondary &
## MISC settings
# Set cursor
xsetroot -cursor_name left_ptr
# Set wallpaper
feh --bg-fill $HOME/Pictures/ethan-hoover-eIVJAkj1uCs-unsplash.jpg
# Disable screen blanking
xset s off -dpms
# Set mouse speed
xinput --set-prop "GXT 107 Gaming Mouse" "libinput Accel Speed" -0.5
xinput --set-prop "SteelSeries SteelSeries Rival 3" "libinput Accel Speed" -0.5
# Disable CTRL + s terminal freeze
stty -ixon
# Set margins for windows
bspc config border_width 1
bspc config window_gap 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment