[{"createTime":1735734952000,"id":1,"img":"hwy_ms_500_252.jpeg","link":"https://activity.huaweicloud.com/cps.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905","name":"华为云秒杀","status":9,"txt":"华为云38元秒杀","type":1,"updateTime":1735747411000,"userId":3},{"createTime":1736173885000,"id":2,"img":"txy_480_300.png","link":"https://cloud.tencent.com/act/cps/redirect?redirect=1077&cps_key=edb15096bfff75effaaa8c8bb66138bd&from=console","name":"腾讯云秒杀","status":9,"txt":"腾讯云限量秒杀","type":1,"updateTime":1736173885000,"userId":3},{"createTime":1736177492000,"id":3,"img":"aly_251_140.png","link":"https://www.aliyun.com/minisite/goods?userCode=pwp8kmv3","memo":"","name":"阿里云","status":9,"txt":"阿里云2折起","type":1,"updateTime":1736177492000,"userId":3},{"createTime":1735660800000,"id":4,"img":"vultr_560_300.png","link":"https://www.vultr.com/?ref=9603742-8H","name":"Vultr","status":9,"txt":"Vultr送$100","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":5,"img":"jdy_663_320.jpg","link":"https://3.cn/2ay1-e5t","name":"京东云","status":9,"txt":"京东云特惠专区","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":6,"img":"new_ads.png","link":"https://www.iodraw.com/ads","name":"发布广告","status":9,"txt":"发布广告","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":7,"img":"yun_910_50.png","link":"https://activity.huaweicloud.com/discount_area_v5/index.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=aXhpYW95YW5nOA===&utm_medium=cps&utm_campaign=201905","name":"底部","status":9,"txt":"高性能云服务器2折起","type":2,"updateTime":1735660800000,"userId":3}]
<>内核支持
由于测试一个特定项目, 事先使用synaptic安装了5.0.0-23版本的kernel, 一开始仅安装了上述四个文件,
进入系统后分辨率仅有800x600, 最高分辨率仅有1176x885, 之后尝试使用xrandr命令调整分辨率时遇到如下错误:
xrandr: Failed to get size of gamma for output default
猜测应当是内核缺少硬件相关部件, 因此追加安装了剩余的三个包, 之后进入系统后可以调整分辨率
在此之前, 为自动加载5.0.0-23版本内核, 修改/etc/default/grub如下:
# 1指开机按"shift"后进入界面中的高级启动选项, 4指从5.0.0-23版本的内核启动, 具体顺序参见grub的高级启动选项 #
修改完后执行sudo update-grub GRUB_DEFAULT="1>4"
<>自动调整分辨率
目前为止已经保证了使用xrandr命令能够正常识别4k显示器, 但这里能调整的最大分辨率仅仅到2K(2560x1600), 仍然看着很不爽,
这里需要的命令如下:
# xrandr --newmode后面的参数可执行 cvt 3840 2160 得到 xrandr --newmode "3840x2160_60.00"
712.75 3840 4160 4576 5312 2160 2163 2168 2237 -hsync +vsync xrandr --addmode
Virtual1"3840x2160_60.00"
这两个命令用于创建并添加4K显示模式, 我直接放在了/etc/profile中, 每次启动都可自动加载
<>自动调整缩放比例
我的电脑是15寸屏幕, 在4K分辨率下字体和图标非常小, 并且此时系统设置中没有调整缩放比例的选项
这里分了两步解决此问题, 首先运行:
# 设置缩放比例为2倍 gsettings set org.gnome.desktop.interface scaling-factor 2 # 神奇命令,
不确定是否必须执行 gsettings set org.gnome.mutter experimental-features
"['scale-monitor-framebuffer']"
按道理现在应该已经好了, 只须执行:
xrandr --output Virtual1 --mode 3840x2160_60.00
应该就能见效, 但现在每次重启都要把这条命令执行一遍, 十分麻烦
要实现开机自动就是4K分辨率+2倍缩放这里有个窍门: 先写一个.sh脚本放在/usr/local/bin (个人习惯, 随便放哪都可),
之后添加开机启动项:
这里的命名同样随意, 脚本内容如下:
#!/bin/bash # 随便进入一个mode xrandr --output Virtual1 --mode 800x600 # 重设为4K模式
xrandr --output Virtual1 --mode 3840x2160_60.00
至此, 大功告成, 进入Ubuntu18.04时自动是5.0.0-23版本内核+4K分辨率+2倍缩放