mirror of
https://github.com/raspberrypi/userland.git
synced 2025-12-06 04:49:12 +00:00
dtoverlay: only run lxpanelctl hooks when lxpanel is running
This commit is contained in:
committed by
popcornmix
parent
1117308aaa
commit
f594b9b161
@@ -1,17 +1,16 @@
|
||||
#!/bin/bash
|
||||
if [ "$DISPLAY" == "" ]; then
|
||||
export DISPLAY=":0.0"
|
||||
|
||||
if ! hash lxpanelctl 2> /dev/null; then
|
||||
exit 0
|
||||
fi
|
||||
CMD="which lxpanelctl >/dev/null 2>&1 && lxpanelctl command volumealsabt start >/dev/null"
|
||||
if [ $EUID -eq 0 ]; then
|
||||
if [ "$SUDO_USER" != "" ]; then
|
||||
user=$SUDO_USER
|
||||
elif [ "$LOGNAME" != "" ]; then
|
||||
user=$LOGNAME
|
||||
else
|
||||
user=pi
|
||||
|
||||
CMD="lxpanelctl command volumealsabt start > /dev/null"
|
||||
|
||||
for PID in $(pgrep -x lxpanel); do
|
||||
eval "$(grep -z "DISPLAY=" "/proc/$PID/environ" | tr -d '\0')"
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
exec $CMD
|
||||
fi
|
||||
exec su $user -c "$CMD"
|
||||
else
|
||||
exec $CMD
|
||||
fi
|
||||
user="$(ps -p "$PID" -o uname=)"
|
||||
su "$user" -c "$CMD"
|
||||
done
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
#!/bin/bash
|
||||
if [ "$DISPLAY" == "" ]; then
|
||||
export DISPLAY=":0.0"
|
||||
|
||||
if ! hash lxpanelctl 2> /dev/null; then
|
||||
exit 0
|
||||
fi
|
||||
CMD="which lxpanelctl >/dev/null 2>&1 && lxpanelctl command volumealsabt stop >/dev/null"
|
||||
if [ $EUID -eq 0 ]; then
|
||||
if [ "$SUDO_USER" != "" ]; then
|
||||
user=$SUDO_USER
|
||||
elif [ "$LOGNAME" != "" ]; then
|
||||
user=$LOGNAME
|
||||
else
|
||||
user=pi
|
||||
|
||||
CMD="lxpanelctl command volumealsabt stop >/dev/null"
|
||||
|
||||
for PID in $(pgrep -x lxpanel); do
|
||||
eval "$(grep -z "DISPLAY=" "/proc/$PID/environ" | tr -d '\0')"
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
exec $CMD
|
||||
fi
|
||||
exec su $user -c "$CMD"
|
||||
else
|
||||
exec $CMD
|
||||
fi
|
||||
user="$(ps -p "$PID" -o uname=)"
|
||||
su "$user" -c "$CMD"
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user