Fix detect-second-display.service
This commit is contained in:
parent
47061871ed
commit
8fbc3f08a5
@ -4353,7 +4353,12 @@ Description=Detect second DISPLAY using xrandr
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart=/bin/bash -c 'export DISPLAY=$DISPLAY.1; xrandr -q | grep "connected" && echo "DISPLAY=$DISPLAY" > ~/.second_display || rm -f ~/.second_display'
|
ExecStart=/bin/bash -c '\
|
||||||
|
source <(systemctl --user show-environment); \
|
||||||
|
SECOND_DISPLAY="$${DISPLAY%\.[0-9]*}.1"; \
|
||||||
|
xrandr -d "$SECOND_DISPLAY" -q | grep "connected" && \
|
||||||
|
{ [ $DISPLAY == $SECOND_DISPLAY ] && echo "DISPLAY=$${DISPLAY%\.[0-9]*}.0 > ~/.second_display || echo "DISPLAY=$SECOND_DISPLAY" > ~/.second_display; \
|
||||||
|
} || rm -f ~/.second_display'
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=yavdr-desktop.target
|
WantedBy=yavdr-desktop.target
|
||||||
|
@ -3,7 +3,12 @@ Description=Detect second DISPLAY using xrandr
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart=/bin/bash -c 'export DISPLAY=$DISPLAY.1; xrandr -q | grep "connected" && echo "DISPLAY=$DISPLAY" > ~/.second_display || rm -f ~/.second_display'
|
ExecStart=/bin/bash -c '\
|
||||||
|
source <(systemctl --user show-environment); \
|
||||||
|
SECOND_DISPLAY="$${DISPLAY%\.[0-9]*}.1"; \
|
||||||
|
xrandr -d "$SECOND_DISPLAY" -q | grep "connected" && \
|
||||||
|
{ [ $DISPLAY == $SECOND_DISPLAY ] && echo "DISPLAY=$${DISPLAY%\.[0-9]*}.0 > ~/.second_display || echo "DISPLAY=$SECOND_DISPLAY" > ~/.second_display; \
|
||||||
|
} || rm -f ~/.second_display'
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=yavdr-desktop.target
|
WantedBy=yavdr-desktop.target
|
||||||
|
Loading…
Reference in New Issue
Block a user