Qee*_*ato 5 command-line display shortcut-keys scaling
我正在寻找键盘快捷键或 CLI 指令来动态更改显示比例。似乎在 compiz-config 管理器中没有任何东西可以处理这个问题?
pa4*_*080 11
@rubo77 的这个答案为类似问题提供了很好的解决方案。我将在最后一部分详细说明它以实现此结果。
如果您打开终端,您可以找到更改设置的位置:
Run Code Online (Sandbox Code Playgroud)gsettings list-recursively > /tmp/before echo 'Now unity-control-center should open. Please change the scaling in "Displays" and close.' unity-control-center gsettings list-recursively > /tmp/after diff /tmp/before /tmp/after | grep '[>|<]'
将上述行复制并粘贴到终端中。这些命令将创建两个临时文件 -更改比例因子之前和之后。按Enter您紧密团结控制中心来执行的最后一行后,将比较这两个临时文件。
在我的系统中,当我将比例因子从 1 更改为 1.5 时,上述输出为:
< org.gnome.desktop.interface text-scaling-factor 1.0
> org.gnome.desktop.interface text-scaling-factor 1.5
< org.gnome.desktop.interface cursor-size 24
> org.gnome.desktop.interface cursor-size 36
< com.ubuntu.user-interface scale-factor {'VGA-1': 8, 'HDMI-0': 8, 'HDMI-1': 8}
> com.ubuntu.user-interface scale-factor {'VGA-1': 8, 'HDMI-0': 8, 'HDMI-1': 12}
Run Code Online (Sandbox Code Playgroud)
所以新值是:
> org.gnome.desktop.interface text-scaling-factor 1.5
> org.gnome.desktop.interface cursor-size 36
> com.ubuntu.user-interface scale-factor {'VGA-1': 8, 'HDMI-0': 8, 'HDMI-1': 12}
Run Code Online (Sandbox Code Playgroud)
我已经记录了缩放因子为1
、1.25
和时的值1.5
。
这些值可以通过命令在命令行中更改gsettings set
。因此,根据原始答案,我创建了一个脚本,调用setscalefactor
并放置在 中/usr/local/bin/
,因此它将可用作 shell 命令:
sudo touch /usr/local/bin/setscalefactor
sudo chmod +x /usr/local/bin/setscalefactor
sudo nano /usr/local/bin/setscalefactor
Run Code Online (Sandbox Code Playgroud)
我的脚本内容是:
gsettings list-recursively > /tmp/before
echo 'Now unity-control-center should open. Please change the scaling in "Displays" and close.'
unity-control-center
gsettings list-recursively > /tmp/after
diff /tmp/before /tmp/after | grep '[>|<]'
Run Code Online (Sandbox Code Playgroud)
nano
:Shift+中Insert用于粘贴;Ctrl+O和Enter保存;Ctrl+X退出。gsettings set
系统中的值替换之后的内容!"{'VGA-1': ...}"
.现在setscalefactor
可作为 shell 命令使用,并且可以处理1.0
,1.25
并且1.5
作为参数,当它在没有参数的情况下执行时,它会卖到 1。脚本将打印和一些状态消息。
下一步是创建这个可通过快捷键组合访问的脚本。转到:Unity 控制中心(系统设置)> 键盘 > 快捷方式 > 自定义快捷方式。然后创建您的自定义快捷方式,如图像:
你必须看看xrandr。我说这是首选工具。
编辑:xrandr --output "output_name" --scale 0.9x0.9
查看更多示例:man xrandr