Change only one display orientation from terminal
up vote
3
down vote
favorite
I am starting to work with 2 displays on Ubuntu. One of them is rotateable, so I can use it easily in both landscape and portrait mode. But I world prefer to have ability to change orientation setting (which could be found in System Settings->Desktop) from terminal or script on one display but don't rotate other one.
I am pretty sure it is possible via xrandr
!
display xrandr system-settings
add a comment |
up vote
3
down vote
favorite
I am starting to work with 2 displays on Ubuntu. One of them is rotateable, so I can use it easily in both landscape and portrait mode. But I world prefer to have ability to change orientation setting (which could be found in System Settings->Desktop) from terminal or script on one display but don't rotate other one.
I am pretty sure it is possible via xrandr
!
display xrandr system-settings
Is your question mainly on how to script it, or how to do it with xrandr? In the last case, you will find it here: askubuntu.com/a/171154/72216, but it can be made changeable / toggle with a key combination of course, but then the scripting is actually the question.
– Jacob Vlijm
Dec 21 '14 at 9:31
@JacobVlijm as I just found answer on my own fromman
. Thanks. I think thatbash
script withxrandr
command inside will work, won't it?
– Lapshin Dmitry
Dec 21 '14 at 9:38
Absolutely. The nicest would be to toggle; make a script read from xrandr what is the current rotation of the second screen, set it to "the other option" under a shortcut key.
– Jacob Vlijm
Dec 21 '14 at 9:42
1
@JacobVlijm I did it, using basiclyxrandr
andgrep
.
– Lapshin Dmitry
Dec 21 '14 at 18:20
add a comment |
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I am starting to work with 2 displays on Ubuntu. One of them is rotateable, so I can use it easily in both landscape and portrait mode. But I world prefer to have ability to change orientation setting (which could be found in System Settings->Desktop) from terminal or script on one display but don't rotate other one.
I am pretty sure it is possible via xrandr
!
display xrandr system-settings
I am starting to work with 2 displays on Ubuntu. One of them is rotateable, so I can use it easily in both landscape and portrait mode. But I world prefer to have ability to change orientation setting (which could be found in System Settings->Desktop) from terminal or script on one display but don't rotate other one.
I am pretty sure it is possible via xrandr
!
display xrandr system-settings
display xrandr system-settings
edited Dec 20 '14 at 23:12
asked Dec 20 '14 at 22:43
Lapshin Dmitry
173110
173110
Is your question mainly on how to script it, or how to do it with xrandr? In the last case, you will find it here: askubuntu.com/a/171154/72216, but it can be made changeable / toggle with a key combination of course, but then the scripting is actually the question.
– Jacob Vlijm
Dec 21 '14 at 9:31
@JacobVlijm as I just found answer on my own fromman
. Thanks. I think thatbash
script withxrandr
command inside will work, won't it?
– Lapshin Dmitry
Dec 21 '14 at 9:38
Absolutely. The nicest would be to toggle; make a script read from xrandr what is the current rotation of the second screen, set it to "the other option" under a shortcut key.
– Jacob Vlijm
Dec 21 '14 at 9:42
1
@JacobVlijm I did it, using basiclyxrandr
andgrep
.
– Lapshin Dmitry
Dec 21 '14 at 18:20
add a comment |
Is your question mainly on how to script it, or how to do it with xrandr? In the last case, you will find it here: askubuntu.com/a/171154/72216, but it can be made changeable / toggle with a key combination of course, but then the scripting is actually the question.
– Jacob Vlijm
Dec 21 '14 at 9:31
@JacobVlijm as I just found answer on my own fromman
. Thanks. I think thatbash
script withxrandr
command inside will work, won't it?
– Lapshin Dmitry
Dec 21 '14 at 9:38
Absolutely. The nicest would be to toggle; make a script read from xrandr what is the current rotation of the second screen, set it to "the other option" under a shortcut key.
– Jacob Vlijm
Dec 21 '14 at 9:42
1
@JacobVlijm I did it, using basiclyxrandr
andgrep
.
– Lapshin Dmitry
Dec 21 '14 at 18:20
Is your question mainly on how to script it, or how to do it with xrandr? In the last case, you will find it here: askubuntu.com/a/171154/72216, but it can be made changeable / toggle with a key combination of course, but then the scripting is actually the question.
– Jacob Vlijm
Dec 21 '14 at 9:31
Is your question mainly on how to script it, or how to do it with xrandr? In the last case, you will find it here: askubuntu.com/a/171154/72216, but it can be made changeable / toggle with a key combination of course, but then the scripting is actually the question.
– Jacob Vlijm
Dec 21 '14 at 9:31
@JacobVlijm as I just found answer on my own from
man
. Thanks. I think that bash
script with xrandr
command inside will work, won't it?– Lapshin Dmitry
Dec 21 '14 at 9:38
@JacobVlijm as I just found answer on my own from
man
. Thanks. I think that bash
script with xrandr
command inside will work, won't it?– Lapshin Dmitry
Dec 21 '14 at 9:38
Absolutely. The nicest would be to toggle; make a script read from xrandr what is the current rotation of the second screen, set it to "the other option" under a shortcut key.
– Jacob Vlijm
Dec 21 '14 at 9:42
Absolutely. The nicest would be to toggle; make a script read from xrandr what is the current rotation of the second screen, set it to "the other option" under a shortcut key.
– Jacob Vlijm
Dec 21 '14 at 9:42
1
1
@JacobVlijm I did it, using basicly
xrandr
and grep
.– Lapshin Dmitry
Dec 21 '14 at 18:20
@JacobVlijm I did it, using basicly
xrandr
and grep
.– Lapshin Dmitry
Dec 21 '14 at 18:20
add a comment |
2 Answers
2
active
oldest
votes
up vote
4
down vote
accepted
Strange, but I found answer first!
You use
$ xrandr --output $monitorName --rotate $direction
where $monitorName
can be found in output of
$ xrandr
and $direction
is left
for counter-clockwise or right
for clockwise.
Edit: Using grep
, it is possible to write a script like this:
#!/bin/bash
screen="HDMI1"
descr=$(xrandr | grep "$screen")
if echo "$descr" | grep disconnected
then
echo "No $screen connected"
exit 1
fi
alt="left"
if echo "$descr" | grep --quiet -P "^[^(]*$alt"
then
rotate="normal"
else
rotate="$alt"
fi
xrandr --output $screen --rotate $rotate
which actually switches orientation of monitor storaged in $screen
variable, and $alt
is the alternative orientation.
1
nice, and it works!
– Jacob Vlijm
Dec 21 '14 at 18:32
add a comment |
up vote
3
down vote
You'll need to use xrandr
for that.
xrandr -o $orientation
Where $orientation
is left
, right
, inverted
, or normal
.
You can select the display you want to rotate with the --display
option.
--dsplay
selects X server, not the monitor, does it?
– Lapshin Dmitry
Dec 21 '14 at 9:28
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f563809%2fchange-only-one-display-orientation-from-terminal%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
accepted
Strange, but I found answer first!
You use
$ xrandr --output $monitorName --rotate $direction
where $monitorName
can be found in output of
$ xrandr
and $direction
is left
for counter-clockwise or right
for clockwise.
Edit: Using grep
, it is possible to write a script like this:
#!/bin/bash
screen="HDMI1"
descr=$(xrandr | grep "$screen")
if echo "$descr" | grep disconnected
then
echo "No $screen connected"
exit 1
fi
alt="left"
if echo "$descr" | grep --quiet -P "^[^(]*$alt"
then
rotate="normal"
else
rotate="$alt"
fi
xrandr --output $screen --rotate $rotate
which actually switches orientation of monitor storaged in $screen
variable, and $alt
is the alternative orientation.
1
nice, and it works!
– Jacob Vlijm
Dec 21 '14 at 18:32
add a comment |
up vote
4
down vote
accepted
Strange, but I found answer first!
You use
$ xrandr --output $monitorName --rotate $direction
where $monitorName
can be found in output of
$ xrandr
and $direction
is left
for counter-clockwise or right
for clockwise.
Edit: Using grep
, it is possible to write a script like this:
#!/bin/bash
screen="HDMI1"
descr=$(xrandr | grep "$screen")
if echo "$descr" | grep disconnected
then
echo "No $screen connected"
exit 1
fi
alt="left"
if echo "$descr" | grep --quiet -P "^[^(]*$alt"
then
rotate="normal"
else
rotate="$alt"
fi
xrandr --output $screen --rotate $rotate
which actually switches orientation of monitor storaged in $screen
variable, and $alt
is the alternative orientation.
1
nice, and it works!
– Jacob Vlijm
Dec 21 '14 at 18:32
add a comment |
up vote
4
down vote
accepted
up vote
4
down vote
accepted
Strange, but I found answer first!
You use
$ xrandr --output $monitorName --rotate $direction
where $monitorName
can be found in output of
$ xrandr
and $direction
is left
for counter-clockwise or right
for clockwise.
Edit: Using grep
, it is possible to write a script like this:
#!/bin/bash
screen="HDMI1"
descr=$(xrandr | grep "$screen")
if echo "$descr" | grep disconnected
then
echo "No $screen connected"
exit 1
fi
alt="left"
if echo "$descr" | grep --quiet -P "^[^(]*$alt"
then
rotate="normal"
else
rotate="$alt"
fi
xrandr --output $screen --rotate $rotate
which actually switches orientation of monitor storaged in $screen
variable, and $alt
is the alternative orientation.
Strange, but I found answer first!
You use
$ xrandr --output $monitorName --rotate $direction
where $monitorName
can be found in output of
$ xrandr
and $direction
is left
for counter-clockwise or right
for clockwise.
Edit: Using grep
, it is possible to write a script like this:
#!/bin/bash
screen="HDMI1"
descr=$(xrandr | grep "$screen")
if echo "$descr" | grep disconnected
then
echo "No $screen connected"
exit 1
fi
alt="left"
if echo "$descr" | grep --quiet -P "^[^(]*$alt"
then
rotate="normal"
else
rotate="$alt"
fi
xrandr --output $screen --rotate $rotate
which actually switches orientation of monitor storaged in $screen
variable, and $alt
is the alternative orientation.
edited Dec 21 '14 at 18:24
answered Dec 21 '14 at 9:36
Lapshin Dmitry
173110
173110
1
nice, and it works!
– Jacob Vlijm
Dec 21 '14 at 18:32
add a comment |
1
nice, and it works!
– Jacob Vlijm
Dec 21 '14 at 18:32
1
1
nice, and it works!
– Jacob Vlijm
Dec 21 '14 at 18:32
nice, and it works!
– Jacob Vlijm
Dec 21 '14 at 18:32
add a comment |
up vote
3
down vote
You'll need to use xrandr
for that.
xrandr -o $orientation
Where $orientation
is left
, right
, inverted
, or normal
.
You can select the display you want to rotate with the --display
option.
--dsplay
selects X server, not the monitor, does it?
– Lapshin Dmitry
Dec 21 '14 at 9:28
add a comment |
up vote
3
down vote
You'll need to use xrandr
for that.
xrandr -o $orientation
Where $orientation
is left
, right
, inverted
, or normal
.
You can select the display you want to rotate with the --display
option.
--dsplay
selects X server, not the monitor, does it?
– Lapshin Dmitry
Dec 21 '14 at 9:28
add a comment |
up vote
3
down vote
up vote
3
down vote
You'll need to use xrandr
for that.
xrandr -o $orientation
Where $orientation
is left
, right
, inverted
, or normal
.
You can select the display you want to rotate with the --display
option.
You'll need to use xrandr
for that.
xrandr -o $orientation
Where $orientation
is left
, right
, inverted
, or normal
.
You can select the display you want to rotate with the --display
option.
edited Dec 3 at 16:50
Zanna
49.6k13128237
49.6k13128237
answered Dec 20 '14 at 23:16
argarevarg
483
483
--dsplay
selects X server, not the monitor, does it?
– Lapshin Dmitry
Dec 21 '14 at 9:28
add a comment |
--dsplay
selects X server, not the monitor, does it?
– Lapshin Dmitry
Dec 21 '14 at 9:28
--dsplay
selects X server, not the monitor, does it?– Lapshin Dmitry
Dec 21 '14 at 9:28
--dsplay
selects X server, not the monitor, does it?– Lapshin Dmitry
Dec 21 '14 at 9:28
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f563809%2fchange-only-one-display-orientation-from-terminal%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Is your question mainly on how to script it, or how to do it with xrandr? In the last case, you will find it here: askubuntu.com/a/171154/72216, but it can be made changeable / toggle with a key combination of course, but then the scripting is actually the question.
– Jacob Vlijm
Dec 21 '14 at 9:31
@JacobVlijm as I just found answer on my own from
man
. Thanks. I think thatbash
script withxrandr
command inside will work, won't it?– Lapshin Dmitry
Dec 21 '14 at 9:38
Absolutely. The nicest would be to toggle; make a script read from xrandr what is the current rotation of the second screen, set it to "the other option" under a shortcut key.
– Jacob Vlijm
Dec 21 '14 at 9:42
1
@JacobVlijm I did it, using basicly
xrandr
andgrep
.– Lapshin Dmitry
Dec 21 '14 at 18:20