Last active
January 11, 2021 19:17
-
-
Save nikp123/de97260620146b8f41d0134ee1f90127 to your computer and use it in GitHub Desktop.
Changing display resolutions in sway
This file contains 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 | |
swaymsg="$(swaymsg -t get_outputs -r)" | |
numOfModes=$(echo $swaymsg|jq -r '.[0].modes | length') | |
modes='' | |
widths="$(echo $swaymsg|jq -r '.[0].modes[].width')" | |
IFS=$'\n' widths=($widths) | |
IFS=$' ' | |
heights="$(echo $swaymsg|jq -r '.[0].modes[].height')" | |
IFS=$'\n' heights=($heights) | |
IFS=$' ' | |
sum='' | |
for (( i=0; i<numOfModes; i++ )); do | |
modes[$i]=$(echo ${widths[$i]}x${heights[$i]}) | |
if [ ${modes[$i]} = ${modes[((i-1))]} ]; then | |
continue | |
fi | |
sum+="${modes[$i]}\n" | |
done | |
swaymsg output $(echo $swaymsg|jq -r '.[0].name') mode $(printf $sum | rofi -dmenu -i) | |
@layus Yeah, just read about it. For those unaware, it's a GUI configuration tool for wlroots compositors, which includes sway.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You may prefer using wdisplays :-)