#!/usr/bin/env bash IFS=$'\n' monitors=( "ASUSTek COMPUTER INC ASUS VA24E R2LMTF127165" ) disabled="$(swaymsg -t get_outputs | grep power.*false)" if [[ "${disabled}" = "" ]]; then action="off" else action="on" fi for monitor in ${monitors[@]}; do swaymsg "output \"${monitor}\" power ${action}" done