diff options
Diffstat (limited to 'init_monitor.sh')
-rwxr-xr-x | init_monitor.sh | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/init_monitor.sh b/init_monitor.sh index e2ed676..c008461 100755 --- a/init_monitor.sh +++ b/init_monitor.sh @@ -15,9 +15,28 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. +SCR1=$(xrandr -q | grep ' connected' | grep primary | awk '{print $1}') + while [ true ]; do - if [ "$(xrandr -q | grep 'DP2' | awk '{print $2}')" == "connected" ]; then - bspc monitor 'DP2' -n 2 -d 1 2 3 4 5 6 7 8 9 + SCR2=$(xrandr -q | grep ' connected' | grep -v primary | awk '{print $1}') + + if [ "$(xrandr -q | grep "${SCR2}" | awk '{print $2}')" == "connected" ]; then + xrandr --output "${SCR2}" --auto + xrandr --output "${SCR2}" --right-of "${SCR1}" + + sleep 1 + + bspc monitor "${SCR2}" -n 2 -d 1 2 3 4 5 6 7 8 9 + + MODE=$(readlink ~/.config/polybar | sed 's/\//\n/g' | tail -n 1) + if [ "${MODE}" == "normal" ]; then + BG="wallpaper" + elif [ "${MODE}" == "unsafe" ]; then + BG="unsafe_wallpaper" + fi + + feh --no-fehbg --bg-fill "${HOME}/.config/bspwm/${BG}" + exit 0 fi |