Skip to content

Instantly share code, notes, and snippets.

@shakedlokits
Created February 4, 2018 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shakedlokits/7b5808e2ea9d621ac70e570fed492967 to your computer and use it in GitHub Desktop.
Save shakedlokits/7b5808e2ea9d621ac70e570fed492967 to your computer and use it in GitHub Desktop.
#! /bin/sh
sxhkd &
# window_height=$(($(xrandr | grep -oP '(?<=connected [0-9]{3-4}x)?[0-9]+(?=\+)' | head -n1)))
bspc config border_width 2
bspc config window_gap 15
bspc config top_padding 55
bspc config normal_border_color "#1D1F21"
bspc config active_border_color "#0a6cf5"
bspc config focused_border_color "#0a6cf5"
bspc config presel_border_color "#0a6cf5"
bspc config urgent_border_color "#0a6cf5"
bspc config focused_locked_border_color "#0a6cf5"
bspc config split_ratio 0.52
# Test monitor type and set desktopsbspc monitor left -d V VI VII
if xrandr | grep -q "DP2-3 connected" ; then
xrandr --output VIRTUAL1 --off --output eDP1 --mode 1920x1080 --pos 3600x0 --rotate normal --output DP1 --off --output DP2-1 --off --output DP2-2 --primary --mode 1920x1080 --pos 1680x0 --rotate normal --output DP2-3 --mode 1680x1050 --pos 0x0 --rotate normal --output HDMI2 --off --output HDMI1 --off --output DP2 --off
echo "Office mode activated"
# Rename monitors
#bspc monitor DP2-2 -n center
#bspc monitor DP2-3 -n left
#bspc monitor eDP1 -n right
bspc monitor DP2-3 -d 5 6 7
bspc monitor DP2-2 -d shell vim browser irc
bspc monitor right -d 8 personal music
elif xrandr | grep -q "HDMI1 connected" ; then
xrandr --output VIRTUAL1 --off --output eDP1 --mode 1920x1080 --pos 0x0 --rotate normal --output DP1 --off --output DP2-1 --off --output DP2-2 --off --output DP2-3 --off --output HDMI2 --off --output HDMI1 --mode 1920x1080 --pos 1920x0 --rotate normal --output DP2 --off
echo "Home mode activated"
#bspc monitor HDMI1 -n center
#bspc monitor eDP1 -n left
bspc monitor HDMI1 -d shell vim browser 5 6 7
bspc monitor eDP1 -d irc music personal 8
else
echo "Standalone mode activated"
xrandr -s 0
xrandr --output eDP1 --auto --mode 1920x1080
bspc monitor -d Shell Editor Browser IRC 5 6 7 8 9 0
fi
# Focus on pointer
bspc config focus_follows_pointer true
# Set background
feh --bg-fill /home/slokits/Documents/Photos/city.jpeg
# Run polyba
process_not_running() {
test "$(pgrep -cf "$1")" -eq 0
}
run_detached() {
cmd_name="$1"
if process_not_running "$cmd_name"; then
echo "Starting command '$*'"
nohup "$@" &>/dev/null </dev/null &
elif $cmd_name | grep -q "polybar"; then
echo "Starting command '$*'"
echo $MONITOR
nohup "$@" &>/dev/null </dev/null &
fi
}
# Load polybar on all monitors
killall -q polybar
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
if type "xrandr"; then
for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
MONITOR=$m run_detached polybar example
done
else
run_detached polybar --reload example
fi
# Load nm-applet
run_detached nm-applet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment