
lightdm
Xサーバーを実行しています。$DISPLAY
どの設定を聞いているのか、どうすればわかりますか?
背景:モニタとGPU(専用ドライバ)の間のDPMS問題をデバッグしており、nvidia
正常に動作しない場合を除き、通常は一緒にうまく動作します(モニタが数時間アイドル状態の後にスタンバイモードで起動しません)。 )。便利ですが、私が何をしているのかをxset dpms force o{ff,n}
知っている場合にのみ可能です。$DISPLAY
グラフィックセッションが実行されている場合(通常は実行されている場合)は問題ありませんが、:0
lightdmはこの規則に準拠していないように見え、DISPLAY=:0
ttyまたはsshでなりすました場合はunable to open display ":0"
エラーが返されます。
答え1
わかりましたが、DPMSとスクリーン専用ブランキング、独自のNVidiaドライバ、lightdm、およびログインセッションを使用して同じ問題があり、ちょうど解決策を見つけました。
Xorgからxauthファイルを読み取れるようにコピーし、XAUTHORITY変数がそのファイルを指すように設定し、ディスプレイをXauthファイルのディスプレイ(私の場合はunix:0)に設定します。
フルラン:
~ $ ssh somecomputer
~ $ ps ax | grep lightdm
40420 ? SLsl 0:00 /usr/sbin/lightdm
62985 tty7 Ssl+ 0:00 /usr/lib/xorg/Xorg :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch
63075 ? Sl 0:00 lightdm --session-child 18 21
63192 ? Ssl 0:00 /usr/sbin/lightdm-gtk-greeter
63240 ? S 0:00 lightdm --session-child 14 21
67141 pts/0 S+ 0:00 grep lightdm
~ $ sudo su
~ # cp /var/run/lightdm/root/:0 /tmp/lightdmauth
~ # chmod a+r /tmp/lightdmauth
~ # exit
~ $ export XAUTHORITY=/tmp/lightdmauth
~ $ xauth -f /tmp/lightdmauth
xauth: /tmp/lightdmauth not writable, changes will be ignored
Using authority file /tmp/lightdmauth
xauth> list
somecomputer/unix:0 MIT-MAGIC-COOKIE-1 5b35f44220224bef134a491dc3bxxxxx
xauth> exit
~ $ export DISPLAY=unix:0
~ $ xeyes &
xeyesがlightdmに表示されます。
この文書はCitrixで提供されています。私を助けた。
画面を自動的に目覚めさせるように設定する方法を探す必要があります。私のアイデア(テストと動作中)は、sxhkdを実行してlightdmにキーボードショートカットを追加して、ディスプレイを正常に戻すために作成したカスタムスクリプトを実行することです(以下にボーナスとして提供されています)。
~ $ cat /usr/local/bin/fix-black-screen
#!/bin/bash
##
# fix_black_screen
# Tries to wake up screen if disconnected due to deep sleep
if [ -n "$1" ]; then
ssh "$1" $(basename $0)
exit $?
fi
# get the list of plugged-in monitors, regardless of whether they are connected
# or disconnected.
# When not showing in nvidia-settings, it looks like this in xrandr:
# DP-3 disconnected 2560x1440+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
# When showing in in nvidia-settings as disabled, it looks like this in xrandr:
# DP-3 connected 2560x1440+0+0 (normal left inverted right x axis y axis) 600mm x 340mm
export DISPLAY=:0
outputs="`xrandr | grep 'connected' | cut -d ' ' -f 1`"
for attempt in {1..10}; do
for output in $outputs ; do
# we only try to re-enable the display if it shows as connected
xrandr --current | grep -q "^$output connected"
if [ "$?" -eq 1 ]; then
echo "Output $output does not show as connected, will retry later ($attempt/10)."
continue
fi
xrandr --output $output --preferred --dpi 96
xdotool mousemove 0 0
xrandr -q | grep -q "*"
if [ $? -eq 0 ]; then
echo "Fixed output $output"
break
fi
done
sleep 1
done
xset -dpms
xset dpms 600 1200 0