Created
August 22, 2018 09:59
-
-
Save albertogarrido/5bb2d6438a6315871dc5dbc3f1422dfa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
HDMI=$(xrandr | grep " connected " | grep "HDMI-0") | |
THUNDER=$(xrandr | grep " connected " | grep "^DP-1") | |
INTERNAL=$(xrandr | grep " connected " | grep "eDP-1") | |
# Terminate already running bar instances | |
killall -q polybar | |
# Wait until the processes have been shut down | |
while pgrep -x polybar >/dev/null; do sleep 1; done | |
if [ ${#HDMI} -gt 0 ]; then | |
xrandr --output eDP-1-1 --auto --output HDMI-0 --auto --right-of eDP-1-1 | |
polybar -c /home/alberto/.config/polybar/config_hdmi_top main_bar & | |
elif [ ${#THUNDER} -gt 0 ]; then | |
xrandr --output eDP-1-1 --auto --output DP-1 --auto --right-of eDP-1-1 | |
polybar -c /home/alberto/.config/polybar/config_hdmi_top main_bar & | |
elif [ ${#INTERNAL} ]; then | |
xrandr --output HDMI-0 --off | |
xrandr --output DP-1 --off | |
fi | |
polybar -c /home/alberto/.config/polybar/config_top main_bar & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment