fix: rename who to w -hs and adjust Firefox URL
This commit is contained in:
parent
5257ac8a0b
commit
8c338df532
@ -36,14 +36,14 @@ if [[ "$1" == wl* ]] && [ "$2" = "up" ]; then
|
||||
log "CAPTIVE PORTAL DETECTED! Opening browser..."
|
||||
|
||||
# Finde Benutzer und starte Firefox
|
||||
local_user=$(who | grep "(:0)" | awk '{print $1}' | head -n1)
|
||||
local_user=$(w -hs | grep ":0" | awk '{print $1}' | head -n1)
|
||||
if [ -n "$local_user" ]; then
|
||||
export DISPLAY=:0
|
||||
export XAUTHORITY=/home/$local_user/.Xauthority
|
||||
|
||||
# Starte Firefox im Hintergrund
|
||||
sudo -u $local_user env DISPLAY=:0 XAUTHORITY=/home/$local_user/.Xauthority \
|
||||
firefox --new-window "http://captive.apple.com" &
|
||||
firefox --new-window "http://detectportal.firefox.com/canonical.html" &
|
||||
log "Firefox started for user $local_user"
|
||||
fi
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user