1
0
Fork 0
dotfiles/home/dot_local/bin/executable_setup-outputs

12 lines
676 B
Plaintext
Raw Permalink Normal View History

2023-10-02 03:34:08 +00:00
#!/bin/bash
# find displays with duplicate output
# for each displays with duplicate output found, disable the HDMI output
# assuming the other output is DisplayPort (prefered)
while read -r display_with_dup_output; do
while read -r hdmi_output; do
# disable the hdmi output
swaymsg "output $hdmi_output disable"
done < <(swaymsg -t get_outputs | jq --raw-output '.[] | [.name, .make + " " + .model] | @tsv' | grep -E "$display_with_dup_output$" | awk '{print $1}' | grep HDMI) # find the hdmi output
done < <(swaymsg -t get_outputs | jq --raw-output '.[] | [.make + " " + .model] | @tsv' | sort | uniq -d) # list all displays with duplicate outputs