NixOS系统LightDM+XMonad环境下DPI缩放问题求助
Hey Jordan, let's sort out those annoying HiDPI cursor and TTY font issues you're dealing with. Since your terminal and Firefox are scaling correctly, we just need to target the cursor and console specifically—here's how to fix them:
First up, the tiny cursor and sluggish movement. There are two reliable ways to address this:
Persistent Xorg Configuration (Recommended)
This ensures the cursor setting applies as soon as X starts (even before lightdm logs you in). Create a new config file in /etc/X11/xorg.conf.d/:
sudo nano /etc/X11/xorg.conf.d/90-hidpi-cursor.conf
Paste this content, adjusting the CursorSize value to match your screen's DPI (48 is a good starting point for 2x HiDPI; tweak up/down if needed):
Section "InputClass" Identifier "hidpi-cursor" MatchIsPointer "on" Option "CursorSize" "48" # Fix cursor lag by disabling acceleration (adjust AccelSpeed if you prefer some) Option "AccelerationProfile" "2" Option "AccelerationScheme" "none" Option "AccelSpeed" "0.0" EndSection
Save the file and restart your system—your cursor should be properly scaled and move smoothly afterward.
Xmonad Startup Hook Alternative
If you prefer to handle this directly in your xmonad config, add this to your xmonad.hs startup hook to set the cursor size on login:
import XMonad.Util.SpawnOnce myStartupHook = do spawnOnce "xsetroot -cursor_size 48" -- Keep your other startup commands here
Recompile xmonad (xmonad --recompile) and restart it, and the cursor size will update immediately.
For the default TTY font, we can adjust the console font settings to scale with your HiDPI screen:
Using console-setup (Debian/Ubuntu-based systems)
- Edit the console setup config:
sudo nano /etc/default/console-setup
- Update these values (adjust
FONTSIZEto fit your screen—12x24 or 16x32 work well for HiDPI):
FONTFACE="Terminus" FONTSIZE="12x24"
- Apply the changes without rebooting:
sudo dpkg-reconfigure console-setup
When prompted, select your encoding (usually UTF-8) and confirm the font settings.
Using vconsole.conf (Systemd-based systems)
If you're using systemd, edit /etc/vconsole.conf:
sudo nano /etc/vconsole.conf
Add a line specifying a scaled font (e.g., Terminus 32pt):
FONT=ter-v32n
Apply the changes with:
sudo systemctl restart systemd-vconsole-setup
Now your TTY fonts will be large enough to read comfortably.
内容的提问来源于stack exchange,提问作者Jordan Mackie

