
我在 VirtualBox 虛擬機器上執行 Ubuntu 20.04.2。我想使用 i3 視窗管理器,並且已經這樣安裝了。
我遇到的一個問題是,即使安裝了來賓添加項,來賓也無法檢測到正確的螢幕分辨率,因此我.xprofile
使用必要的命令設定了一個檔案來設定分辨率:
#!/usr/bin/env bash
xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
xrandr --addmode Virtual1 1920x1080_60.00
xrandr -s 1920x1080_60.00
問題在於它.xprofile
在登入序列中運行得很晚,大概是在 i3 啟動之後,因為它最終看起來像這樣:
顯然,狀態列和頂部標題列使用的是舊的 dpi,因此顯示太大。
那麼,我能做些什麼來解決這個問題呢?有沒有更好的方法來獲得 i3 會尊重的 1920x1080 解析度?我可以編輯任何 i3 設定來解決此問題嗎?謝謝。
答案1
我透過在 處新增自訂 xorg 配置來修復此問題/usr/share/X11/xorg.conf.d/5-monitor.conf
,其內容為:
Section "Monitor"
Identifier "HD Monitor"
Modeline "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
EndSection
Section "Device"
Identifier "Configured device"
EndSection
Section "Screen"
Identifier "Default screen"
Device "Configured device"
Monitor "HD Monitor"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1920x1080_60.00"
EndSubSection
EndSection
此配置在登入過程中載入得足夠早,以影響 i3 的設定方式。