f6k
2020-09-30 09:56:54 UTC
hello,
i've made myself a really simple acpi/actions scripts to handle the
volume from Fn keys and display volume level thanks to osd_cat. but i
can't have osd_cat display anything after the boot. i need to restart
acpid to make it display on my screen. here's the script for
volumedown:
------8<-------
amixer -q set Master 2-
if [ ! -z "$DISPLAY" ]; then
VOLUME=$(amixer get Master| grep Mono:| sed -r 's/.*\[(.*)%\].*/\1/')
pkill osd_cat &>/dev/null
DISPLAY=:0 osd_cat -f "-xos4-terminus-bold-r-normal--24-*-*-*-*-*-*" -b percentage -d 2 -P $VOLUME -A center -p bottom -l 2 -o 5 -c green&
fi
------8<-------
again, the problem i have it that, after the boot, osd_cat don't
display anything -- but the volume is goind down. i have to
/etc/rc.d/rc.acpid restart to make osd_cat display something. i was
thinking that the problem was from my if statement since during the
boot there's no $DISPLAY and that maybe the script stays like that in
some cache. so i used something more complicated found on thinkwiki[1]
which basically define $DISPLAY based on what's available in
/tmp/.X11-unix/X*
1: http://www.thinkwiki.org/wiki/ACPI_action_script_optimized_for_R51
------8<-------
export DISPLAY="auto"
amixer -q set Master 2-
if [ "${DISPLAY}" == "auto" ]; then
X="$(ls /tmp/.X11-unix/X* | head -n1)";
[ "${X}" != "" ] && export DISPLAY=":${X/\/tmp\/.X11-unix\/X/}"
fi
if [ "${DISPLAY}" != "auto" ]; then
pkill osd_cat &>/dev/null
echo "$DISPLAY" > /tmp/display.txt
DISPLAY="$DISPLAY" osd_cat -f "-xos4-terminus-bold-r-normal--24-*-*-*-*-*-*" -b percentage -d 2 -P $VOLUME -A center -p bottom -l 2 -o 5 -c green&
else
logger "OSD cat: $@"
fi
------8<-------
but again, it doesn't work, osd_cat doesn't display nothing after the
boot and i have to /etc/rc.d/rc.acpid restart.
please note the test echo inside the second if statement. it gives me
the expected result, meaning ":0" (without restarting acpid after the
boot). i'm out of ideas and i can't see by myself what i'm doing
wrong. can anyone help me please? thanks.
-f6k
i've made myself a really simple acpi/actions scripts to handle the
volume from Fn keys and display volume level thanks to osd_cat. but i
can't have osd_cat display anything after the boot. i need to restart
acpid to make it display on my screen. here's the script for
volumedown:
------8<-------
amixer -q set Master 2-
if [ ! -z "$DISPLAY" ]; then
VOLUME=$(amixer get Master| grep Mono:| sed -r 's/.*\[(.*)%\].*/\1/')
pkill osd_cat &>/dev/null
DISPLAY=:0 osd_cat -f "-xos4-terminus-bold-r-normal--24-*-*-*-*-*-*" -b percentage -d 2 -P $VOLUME -A center -p bottom -l 2 -o 5 -c green&
fi
------8<-------
again, the problem i have it that, after the boot, osd_cat don't
display anything -- but the volume is goind down. i have to
/etc/rc.d/rc.acpid restart to make osd_cat display something. i was
thinking that the problem was from my if statement since during the
boot there's no $DISPLAY and that maybe the script stays like that in
some cache. so i used something more complicated found on thinkwiki[1]
which basically define $DISPLAY based on what's available in
/tmp/.X11-unix/X*
1: http://www.thinkwiki.org/wiki/ACPI_action_script_optimized_for_R51
------8<-------
export DISPLAY="auto"
amixer -q set Master 2-
if [ "${DISPLAY}" == "auto" ]; then
X="$(ls /tmp/.X11-unix/X* | head -n1)";
[ "${X}" != "" ] && export DISPLAY=":${X/\/tmp\/.X11-unix\/X/}"
fi
if [ "${DISPLAY}" != "auto" ]; then
pkill osd_cat &>/dev/null
echo "$DISPLAY" > /tmp/display.txt
DISPLAY="$DISPLAY" osd_cat -f "-xos4-terminus-bold-r-normal--24-*-*-*-*-*-*" -b percentage -d 2 -P $VOLUME -A center -p bottom -l 2 -o 5 -c green&
else
logger "OSD cat: $@"
fi
------8<-------
but again, it doesn't work, osd_cat doesn't display nothing after the
boot and i have to /etc/rc.d/rc.acpid restart.
please note the test echo inside the second if statement. it gives me
the expected result, meaning ":0" (without restarting acpid after the
boot). i'm out of ideas and i can't see by myself what i'm doing
wrong. can anyone help me please? thanks.
-f6k
--
~{,_,"> indignus LabRat - ftp://shl.huld.re
~{,_,"> indignus LabRat - ftp://shl.huld.re