.bashrc 中的 Xrandr 配置直到我打开终端才运行?

Tay*_*ell 3 xrandr

我的 .bashrc 文件中有以下内容...

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# multi-monitor configuration
xrandr --output HDMI1 --mode 1920x1080 --pos 0x0 --rotate normal --output DP1 --off --output VGA1 --mode 1600x900 --pos 1920x0 --rotate normal
Run Code Online (Sandbox Code Playgroud)

当我登录时,我的显示器被镜像并且分辨率很差,让我相信这没有运行。但是,登录后第一次打开终端时,我的显示器会调整正确的分辨率并正确扩展。

为什么这个 .bashrc 文件似乎只有在我打开终端后才运行?我的印象是它在我登录时运行。我怎样才能让它这样做?

Lek*_*eyn 5

.bashrc (顾名思义)仅在 bash shell 启动时执行。

您必须进行编辑~/.profile才能将更改应用于图形会话。请注意,此文件用于设置环境变量等。您最好创建一个启动脚本来完成此任务。