解决kde/flameshot/spectacle on x11 截屏错乱问题

现象:

截屏截不到应用,一进入截图页面应用就跳转,要么跳转到其他应用,要不跳转到已经关闭的应用。不管是flameshot或者spectacle 都是这样,其他用户发现的这个问题参考:

原因以及解决建议:

原因: x11 使用了 intel的驱动导致的。
建议: 卸载intel的驱动,使用其他驱动代替。

解决过程:

卸载xf86-video-intel并确保目录/etc/X11/xorg.conf.d/没有关于intel的配置

sudo pacman -Rns xf86-video-intel
ls -l /etc/X11/xorg.conf.d/  # 检查此目录没有关于intel的配置

卸载后重启卡开机界面黑屏了。切换到tty2,按ctl+alt+f2 手动启动x:

startx

根据报错日志查看,/var/log、Xorg.0.log 发现日志提示 Failed to load driver intel,推测应该是X的配置中是用了intel的驱动,然后由被卸载了导致的,查看配置文件 /etc/X11/xorg.conf

...
Section "Device"
    Identifier     "Device0"
    Driver         "intel"
    VendorName     "Intel Corporation"
    BusID          "PCI:0:2:0"
EndSection
...

X的配置文件中显示显卡设备用的是intel的Driver。

https://wiki.archlinux.org/title/Intel_graphics#Installation 中看到:

  1. 安装了mesa 这个包就有驱动了
  2. 一般不推荐使用xf86-video-intel可以使用modesetting 这个驱动代替。

一个可行的方法是把"Device"中的"Driver"改成"modesetting",我是重新生成了一下X的配置文件:

sudo mv /etc/X11/xorg.conf /etc/X11/xorg.conf.bak
sudo systemctl stop sddm  # 必须在x停止的情况下才能重新生成配置文件,通过停掉sddm 关闭X
sudo xorg -configure # 生成配置文件到 /root/xorg.conf.new
sudo mv /root/xorg.conf.new /etc/X11/xorg.conf

检查新生成的文件:

....
Section "Device"
        Identifier  "Card0"
        Driver      "modesetting"
        BusID       "PCI:0:2:0"
EndSection
...

新的配置文件已经不在使用intel驱动了,重启。
重启发现磁盘clean日志之后直接就黑屏了,再切换到tty2,查看系统日志:

jounalctl -f 

日志中提示是关于nouveau的错误。查看当前是否加载了这个模块:

lsmod |grep nouveau

由于不打算使用nvidia显卡,直接屏蔽这个驱动,添加配置文件 /etc/modprobe.d/blacklist_nouveau.conf,内容:

blacklist nouveau
options nouveau modeset=0

重启,正常启动,也不在加载nouveau模块,flameshot功能正常了。

参考:

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章