Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Jay Ta'ala
jt-config-repo
Commits
ab0e449e
Commit
ab0e449e
authored
Sep 25, 2019
by
Jay Ta'ala
Browse files
Added switching to resolution after successfully creating it (addresolution script).
parent
c3171110
Changes
1
Hide whitespace changes
Inline
Side-by-side
scripts/addresolution
View file @
ab0e449e
#!/bin/bash
showExample
()
{
echo
-e
"
\n
e.g.
\"
"
$(
basename
--
"
$0
"
)
" 1920 1080 60
\"\n
"
echo
-e
"
\n
e.g.
\"
"
$(
basename
--
"
$0
"
)
"
eDP1
1920 1080 60
\"\n
"
}
createRes
()
{
...
...
@@ -9,32 +9,43 @@ createRes() {
}
addRes
()
{
xrandr
--addmode
eDP1
"
$WIDTH
"
x
"
$HEIGHT
"
_
"
$REFRESH
"
.00
xrandr
--addmode
"
$DEVICE
"
"
$WIDTH
"
x
"
$HEIGHT
"
_
"
$REFRESH
"
.00
}
switchRes
()
{
xrandr
--output
"
$DEVICE
"
--mode
"
$WIDTH
"
x
"
$HEIGHT
"
_
"
$REFRESH
"
.00
}
# check arguments
if
[
-z
"
$1
"
]
;
then
echo
"Please provide a
screen width
as the first argument"
echo
"Please provide a
n output devide
as the first argument"
showExample
exit
128
fi
if
[
-z
"
$2
"
]
;
then
echo
"Please provide a screen
height
as the second argument"
echo
"Please provide a screen
width
as the second argument"
showExample
exit
128
fi
if
[
-z
"
$3
"
]
;
then
echo
"Please provide a refresh rate as the third argument"
echo
"Please provide a screen height as the third argument"
showExample
exit
128
fi
if
[
-z
"
$4
"
]
;
then
echo
"Please provide a refresh rate as the fourth argument"
showExample
exit
128
fi
#init
WIDTH
=
$1
HEIGHT
=
$2
REFRESH
=
$3
DEVICE
=
$1
WIDTH
=
$2
HEIGHT
=
$3
REFRESH
=
$4
createRes
||
{
echo
-e
"
\n
ERROR creating resolution with
\"
cvt
\"\n
"
...
...
@@ -46,4 +57,17 @@ addRes || {
exit
1
}
exit
0
echo
-e
"
\n
"
while
true
;
do
read
-p
"Do you want to switch to this resolution now? (y/n) "
yn
case
$yn
in
[
Yy]
*
)
switchRes
||
{
echo
-e
"
\n
ERROR switching resolution with
\"
xrandr
\"\n
"
return
1
}
;
break
;;
[
Nn]
*
)
break
;;
*
)
echo
"Please type
\"
y
\"
or
\"
n
\"
"
;;
esac
done
exit
0
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment