Portál AbcLinuxu, 4. listopadu 2025 10:28
synclient -l nebo návratovou hodnotu po synclient TouchpadOff=1; echo $? > soubor.log.
            synclient -l přes acpi funguje? synclient TouchpaddOff=1 vrací nulu?
            synclient TouchpadOff=1 > soubor.log 2>&1
ale mně to chyby píše na standardní výstup, tak v tom asi problém nebyl.
unhandled event by asi nevadila, pokud se vám ten handler spouští tak to je hlavní.
Není možné že se to třeba vypne a hned zase zapne? Já mám svůj handler přibližně takto:
if (synclient -l | grep -e "TouchpadOff" | grep -e "0" > /dev/null) ; then synclient TouchpadOff=1 else synclient TouchpadOff=0 fi if (synclient -l | grep -e "TouchpadOff" | grep -e "0" > /dev/null) ; then message="Touchpad is On" else message="Touchpad is Off" fi echo "$message" > soubor.log
synclient -s? synclient connect to x server
            /etc/X11/xorg.conf SHMConfig true. V manu sice píší jen o -m a -h, ale pokud třeba by to pomohlo.
For the -m and -h options, SHM must be enabled by setting the option SHMConfig "on" in your XOrg/XFree86 configuration.
            xf86-input-synaptics no... Pokud jste třeba upgradoval Xorg, tak je dobré překompilovat x11-drivers (seznam: qlist -I -C x11-drivers).
            
#!/bin/bash
. /usr/share/acpi-support/power-funcs
getXconsole
STATUS=$(synclient -l | grep TouchpadOff | awk '{ print $3 }')
if [ "$STATUS" = '0' ]; then 
    logger "[Fn-F8] Touchpad disabled";
    synclient TouchpadOff=1;
    su $user -c "notify-send ThinkPad 'Touchpad disabled' -i touchpad -t 1000"
else 
    logger "[Fn-F8] Touchpad enabled";
    synclient TouchpadOff=0;
    su $user -c "notify-send ThinkPad 'Touchpad enabled' -i touchpad -t 1000"
fi
Problem je pravdepodobne s xserverom, kedze root nema pristup k premenym prostredia, ktore pouziva uzivatel. Vsetko by mali poriesit funkcie dosutpne s acpi (tie includy na uvod). V scripte mate navyse ukazku, ako moze script zobrazit notifikacie priamo na desktope prihlaseneho uzivatela.
            getXuser() {
  user=$(who | grep -m1 ":$displaynum " | cut -d\  -f 1)
  if [[ -z "$user" ]]; then
    user=$(who | grep -m1 ":$displaynum" | cut -d\  -f 1)
  fi
  if [[ -n "$user" ]]; then
    userhome=$(getent passwd $user | cut -d: -f6)
    export XAUTHORITY=$userhome/.Xauthority
  else
    export XAUTHORITY="$(ps -C X f | tail -n 1 | sed -n -r 's/^.* -auth ([^ ]+) .*$/\1/gp')"
  fi
}
#Find the right XServer to be configured.
for x in /tmp/.X11-unix/*; do
  displaynum=$(sed s,/tmp/.X11-unix/X,, <<<"$x")
  getXuser;
  if [[ -n "$XAUTHORITY" ]]; then
    export DISPLAY=":$displaynum"
  fi
done
neuvědomil jsem si, že díky tomu for cyklu se mi XAUTHORITY a DISPLAY nastaví vždy, pro všechny acpi handlery, tedy i pro synclient :(
            
        Tiskni
            
                Sdílej:
                
                
                
                
                
                
            
    
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.