如何以最简单的方式旋转显示器?

Agm*_*nor 58 display

我是枢轴显示器的幸运拥有者,该显示器可以(物理上)旋转。当我转动显示器时,让显示器转动的最简单方法是什么?

目前我首先启动“显示”应用程序,然后更改设置并确认。但这实际上是一个相当费力的过程,因为我想每分钟切换几次我的方向。

那么是否有相关指标或等效指标?我可以设置一个启动专用命令的键盘快捷键吗?事实上,我正在考虑类似于 Windows 程序iRotate的东西。

roa*_*dmr 100

进入键盘 -> 快捷方式,选择“自定义快捷方式”,然后按“+”添加新的快捷方式。

“名称”是动作的描述性名称(即“旋转监视器”)。在“命令”中键入激活快捷方式时要运行的自定义命令。

快捷方式出现在列表中后,选择其行,按 ENTER,然后选择要激活快捷方式的组合键。如果有冲突,快捷方式管理器会告诉你,你可以选择不同的组合。

您可以使用快捷方式启用旋转显示和另一个将其恢复到直立位置。如果您有足够的知识,您甚至可以编写一个命令来保持状态并在直立/旋转之间切换。

现在,至于您需要使用的命令,它可能是 xrandr:

xrandr --output HDMI1 --rotate left

xrandr --output HDMI1 --rotate normal
Run Code Online (Sandbox Code Playgroud)

输出参数取决于您的显示器插入的端口。要查看您当前拥有的内容,请键入:

xrandr -q
Run Code Online (Sandbox Code Playgroud)

我的 说:

Screen 0: minimum 320 x 200, current 1366 x 768, maximum 8192 x 8192
LVDS1 connected 1366x768+0+0 (normal left inverted right x axis y axis) 309mm x 174mm
   1366x768       60.0*+
   1360x768       59.8     60.0  
   1024x768       60.0  
   800x600        60.3     56.2  
   640x480        59.9  
VGA2 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
DP1 disconnected (normal left inverted right x axis y axis)
Run Code Online (Sandbox Code Playgroud)

在这种情况下,我的 --output 将是 LVDS1,因为所有其他输出都已断开连接。

  • 嘿,执行`xrandr -o right` 也可以,不需要指定当前目标 (11认同)
  • 这是极好的。 (2认同)

小智 16

很好用

xrandr --output LVDS1 --rotate left
xrandr --output LVDS1 --rotate right
xrandr --output LVDS1 --rotate inverted
xrandr --output LVDS1 --rotate normal
Run Code Online (Sandbox Code Playgroud)


Vin*_*ris 6

这是一个关于如何根据传感器输入执行此操作的好示例:https : //linuxappfinder.com/blog/auto_screen_rotation_in_ubuntu

所以基本上尝试上面的方法来识别你想看到旋转的屏幕。根据型号显示器,可能有一个传感器发送信号?

这对我的带有内置旋转传感器的联想 Yoga 2 11 非常有用,它也可以移动统一底座。

剧本:

#!/bin/sh
# Auto rotate screen based on device orientation

# Receives input from monitor-sensor (part of iio-sensor-proxy package)
# Screen orientation and launcher location is set based upon accelerometer position
# Launcher will be on the left in a landscape orientation and on the bottom in a portrait orientation
# This script should be added to startup applications for the user

# Clear sensor.log so it doesn't get too long over time
> sensor.log

# Launch monitor-sensor and store the output in a variable that can be parsed by the rest of the script
monitor-sensor >> sensor.log 2>&1 &

# Parse output or monitor sensor to get the new orientation whenever the log file is updated
# Possibles are: normal, bottom-up, right-up, left-up
# Light data will be ignored
while inotifywait -e modify sensor.log; do
# Read the last line that was added to the file and get the orientation
ORIENTATION=$(tail -n 1 sensor.log | grep 'orientation' | grep -oE '[^ ]+$')

# Set the actions to be taken for each possible orientation
case "$ORIENTATION" in
normal)
xrandr --output eDP1 --rotate normal && gsettings set com.canonical.Unity.Launcher launcher-position Left ;;
bottom-up)
xrandr --output eDP1 --rotate inverted && gsettings set com.canonical.Unity.Launcher launcher-position Left ;;
right-up)
xrandr --output eDP1 --rotate right && gsettings set com.canonical.Unity.Launcher launcher-position Bottom ;;
left-up)
xrandr --output eDP1 --rotate left && gsettings set com.canonical.Unity.Launcher launcher-position Bottom ;;
esac
done
Run Code Online (Sandbox Code Playgroud)

和传感器的先决条件:

sudo apt install iio-sensor-proxy inotify-tools
Run Code Online (Sandbox Code Playgroud)