use*_*686 7 bash arch-linux xorg
启动后,我可以自动登录到虚拟控制台。现在我希望 X 服务器自动启动,而不是输入startx. 这之前有效,但切换到 systemd 后,X 不会自行启动。根据维基页面,我编辑了我的~/.bash_profile:
#
# ~/.bash_profile
#
[[ -f ~/.bashrc ]] && . ~/.bashrc
[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx
Run Code Online (Sandbox Code Playgroud)
但 X 不会启动(startx手动执行有效)。
维基还指出:
X 必须始终在登录发生的同一个 tty 上运行,以保留 logind 会话。这是由默认的 /etc/X11/xinit/xserverrc 处理的。
但我不知道如何处理这个。我的/etc/X11/xinit/xserverrc:
#!/bin/sh
if [ -z "$XDG_VTNR" ]; then
exec /usr/bin/X -nolisten tcp "$@"
else
exec /usr/bin/X -nolisten tcp "$@" vt$XDG_VTNR
fi
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
~/.xinitrc:
#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)
# Keyboard layout
setxkbmap -layout de nodeadkeys
# Set the cursor
xsetroot -cursor_name left_ptr
# Autostart
tint2 & #Taskbar
/usr/lib/notification-daemon-1.0/notification-daemon & #Notifications
numlockx & #activate numlock
case "$1" in
openbox)
exec ck-launch-session openbox-session ;;
xmonad)
exec ck-launch-session xmonad ;;
*) #default
exec ck-launch-session xmonad ;;
esac
Run Code Online (Sandbox Code Playgroud)
我没有~/.Xresources文件,我以前也不需要。那很重要么?
我不确定 XDG_VTNR 意味着什么,但是这个脚本对我有用,把行放到 ~/.bashrc
(我在 tty3 上做 auto-X)
if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty3 ]]; then exec startx; fi
还要定义“不工作”,如果你startx手动启动它会工作吗?如果没有,请先检查您的 ~/.xinitrc。