Lew*_*wis 5 xrandr scaling display-resolution
我使用的是 Ubuntu 18.10。
我试图在 .bashrc 中为“resdown”和“resup”命令创建两个别名(即分别降低和增加屏幕分辨率)。
resdown命令如下,并且工作得很好:
xrandr --输出 DP-2 --模式 3840x2160
我遇到的问题是resup。当我运行以下命令时:
xrandr --输出 DP-2 --模式 3840x2160
UI 缩放比例设置回 100%。我需要将缩放比例更改为 200%,否则 4K 显示器上的所有内容都非常小。
我一直在尝试 xrandr 的“--scale”选项,但它完全搞乱了我的显示。因此,我不确定它正在做我认为它正在做的事情:
xrandr --输出 DP-2 --模式 3840x2160 --规模 2x2
如果我使用第二台显示器返回 gnome-control-center,我可以很好地设置屏幕分辨率和缩放比例,一切都会恢复正常。但是,我想从命令行执行此操作。
基本上- 我想知道如何从命令行设置您在 gnome-control-center (见下文)中看到的“缩放”设置。我怎样才能做到这一点?:
塔尔;博士:
sed -i -e '/<scale>/ s/1/2/' ~/.config/monitors.xml && sudo systemctl restart gdm
Mutter 确实监听了 Gsettings 中的一些设置,在查看代码后,发现一些遗留的 gsettings 支持已弃用的设置,例如 gsettings ui-scaling-factor。对于其他事情,它支持使用 XML 进行配置。您可能需要Alt+F2, r重新启动 gnome-shell 才能应用设置...或从代码中找出 dbus 详细信息。
这是我的旧显示器的配置...注意这一行...易于 sed
~/.config/monitors.xml
<monitors version="2">
<configuration>
<logicalmonitor>
<x>0</x>
<y>0</y>
<scale>1</scale>
<primary>yes</primary>
<transform>
<rotation>upside_down</rotation>
<flipped>no</flipped>
</transform>
<monitor>
<monitorspec>
<connector>HDMI-1</connector>
<vendor>ACR</vendor>
<product>V226HQL</product>
<serial>T0WAA0072442</serial>
</monitorspec>
<mode>
<width>1920</width>
<height>1080</height>
<rate>60</rate>
</mode>
</monitor>
</logicalmonitor>
</configuration>
Run Code Online (Sandbox Code Playgroud)
我把上面的代码放在一起做了 200x。它适用于 Wayland 和 X,但会让您退出。如果你可以执行 ALt+F2, r,那显然会更好...我尝试使用终端命令执行此操作,但总是使 gnome 崩溃。可能使用 Robot.js 或 xdotool 发送重启命令...就像这样
xdotool keydown alt && sleep 1 && xdotool key F2 keyup alt && sleep 1 && xdotool key r && sleep 1 && xdotool key KP_Enter
我的 X11 完整版本swap-res.sh...这也适用于 ubuntu 键盘快捷键
#!/bin/bash
File=~/.config/monitors.xml
if grep -q "<scale>1" "$File"; then
sed -i -e '/<scale>1/ s/1/3/' "$File"
else
sed -i -e '/<scale>3/ s/3/1/' "$File"
fi
# Unix Utils
xdotool keydown alt && sleep 1 && xdotool key F2 keyup alt \
&& sleep 1 && xdotool key r key KP_Enter
Run Code Online (Sandbox Code Playgroud)
来源: https: //gitlab.gnome.org/GNOME/mutter/(毫不夸张地说,留下一颗星!)
SEO/类似问题:
在 HiDPI 显示屏上缩放 Gnome 登录屏幕
如何将 Mutter 与 GNOME Shell 一起使用?
从命令行更改 UI 缩放
小智 0
对于 4k 中的 X11,首先执行 execulate gsettings set org.gnome.desktop.interface scaling-factor 2,然后执行 execlate xrandr --output Virtual1 --mode 3840x2160 --scale 1x1。您可以获得 200% 比例的 UI。
| 归档时间: |
|
| 查看次数: |
5510 次 |
| 最近记录: |