Skip to content

Commit

Permalink
runcommand - cosmetic / fix bad indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
joolswills committed Nov 4, 2020
1 parent fd0b8c2 commit c708017
Showing 1 changed file with 26 additions and 27 deletions.
53 changes: 26 additions & 27 deletions scriptmodules/supplementary/runcommand/runcommand.sh
Original file line number Diff line number Diff line change
Expand Up @@ -276,35 +276,35 @@ function get_all_kms_modes() {

function get_all_x11_modes()
{
declare -Ag MODE
local id
local info
local line
local verbose_info=()
local output="$($XRANDR --verbose | grep " connected" | awk '{ print $1 }')"
declare -Ag MODE
local id
local info
local line
local verbose_info=()
local output="$($XRANDR --verbose | grep " connected" | awk '{ print $1 }')"

while read -r line; do
# scan for line that contains bracketed mode id
id="$(echo "$line" | awk '{ print $2 }' | grep -o "(0x[a-f0-9]\{1,\})")"
while read -r line; do
# scan for line that contains bracketed mode id
id="$(echo "$line" | awk '{ print $2 }' | grep -o "(0x[a-f0-9]\{1,\})")"

if [[ -n "$id" ]]; then
# strip brackets from mode id
id="$(echo ${id:1:-1})"
if [[ -n "$id" ]]; then
# strip brackets from mode id
id="$(echo ${id:1:-1})"

# extract extended details
verbose_info=($(echo "$line" | awk '{ for (i=3; i<=NF; ++i) print $i }'))
# extract extended details
verbose_info=($(echo "$line" | awk '{ for (i=3; i<=NF; ++i) print $i }'))

# extract x/y resolution, vertical refresh rate and append details
read -r line
info="$(echo "$line" | awk '{ print $3 }')"
read -r line
info+="x$(echo "$line" | awk '{ print $3 }') @ $(echo "$line" | awk '{ print $NF }') ("${verbose_info[*]}")"
# extract x/y resolution, vertical refresh rate and append details
read -r line
info="$(echo "$line" | awk '{ print $3 }')"
read -r line
info+="x$(echo "$line" | awk '{ print $3 }') @ $(echo "$line" | awk '{ print $NF }') ("${verbose_info[*]}")"

# populate resolution into arrays
MODE_ID+=($output:$id)
MODE[$output:$id]="$info"
fi
done < <($XRANDR --verbose)
# populate resolution into arrays
MODE_ID+=($output:$id)
MODE[$output:$id]="$info"
fi
done < <($XRANDR --verbose)
}

function get_tvs_mode_info() {
Expand Down Expand Up @@ -496,7 +496,6 @@ function load_mode_defaults() {
local temp
MODE_ORIG=()


if [[ -n "$HAS_MODESET" ]]; then
# populate available modes
[[ -z "$MODE_ID" ]] && get_all_${HAS_MODESET}_modes
Expand All @@ -506,9 +505,9 @@ function load_mode_defaults() {
MODE_CUR=("${MODE_ORIG[@]}")
MODE_ORIG_ID="${MODE_ORIG[0]}${separator}${MODE_ORIG[1]}"

if [[ "$MODE_REQ" == "0" ]]; then
if [[ "$MODE_REQ" == "0" ]]; then
MODE_REQ_ID="$MODE_ORIG_ID"
elif [[ "$HAS_MODESET" == "tvs" ]]; then
elif [[ "$HAS_MODESET" == "tvs" ]]; then
# get default mode for requested mode of 1 or 4
if [[ "$MODE_REQ" =~ (1|4) ]]; then
# if current aspect is anything else like 5:4 / 10:9 just choose a 4:3 mode
Expand Down

0 comments on commit c708017

Please sign in to comment.