You are not logged in.
Pages: 1
Hi, I have the next shell script that disables my touchpad
#!/bin/bash
sleep 10
id=$(xinput list | grep TouchPad | grep -Eo "id=[0-9]+" | grep -Eo "[0-9]+")
device_id=$(xinput list-props "SynPS/2 Synaptics TouchPad" | grep "Device Enabled" | grep -Eo "\([0-9]+\)" | tr -d "()")
xinput set-prop $id $device_id 0If I execute it manually it works, If put it /home/admin1/.config/autostart/ it gets executed but xinput does not do anything, if I put it in a cronjob to run every minute, same effect.
In .xinitrc it does not execute.
Last edited by tesla135 (2023-10-29 16:23:00)
Offline
The cronjob will suffer from the missing environment variables (notably DISPLAY; perhaps XAUTHORITY)
"xinput disable $id", and you can btw. just use the device name - how exactly do you assess that
1. the script gets exsecuted
2. "xinput does not do anything"
Is your xinitrc in use at all? How and into what kind of session do you login?
Also https://wiki.archlinux.org/title/Libinp … ation_file & https://man.archlinux.org/man/extra/xor … #Option~40
Offline
exported variables Display and XAUTHORITY fixed the problem
sleep 10
export DISPLAY=:0
export XAUTHORITY=/home/user/.Xauthority
xinput disable "SynPS/2 Synaptics TouchPad"For my xinitrc used a basic /etc/X11/xinit/xinitrc, and at the bottom I used exec mate-session for my mate DE.
And I lanch it with startx.
Last edited by tesla135 (2023-10-29 15:31:19)
Offline
Is that from your /home/admin1/.config/autostart/ or the cronjob?
In .xinitrc it does not execute … I lanch it with startx.
Post the xinitrc you attempted.
Offline
#!/bin/sh
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap
# merge in defaults and keymaps
if [ -f $sysresources ]; then
xrdb -merge $sysresources
fi
if [ -f $sysmodmap ]; then
xmodmap $sysmodmap
fi
if [ -f "$userresources" ]; then
xrdb -merge "$userresources"
fi
if [ -f "$usermodmap" ]; then
xmodmap "$usermodmap"
fi
# start some nice programs
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
[ -x "$f" ] && . "$f"
done
unset f
fi
exec mate-session
echo test >> /home/admin1/log
#/home/scripts/disable_touchpad.sh
QT_SCALE_FACTOR=0.8 VirtualBoxAfter exec mate-session.. that echo line or the commented script is not executed
Is that from your /home/admin1/.config/autostart/ or the cronjob?cronjob
Last edited by tesla135 (2023-10-29 15:30:48)
Offline
Please use [code][/code] tags, not "quote" tags. Edit your post in this regard.
https://man.archlinux.org/man/core/man-pages/exec.1p.en
"exec mate-session" replaces the script process w/mate-session, even if it didn't you wouldn't reach the echo line until mate-session terminated.
…
/home/scripts/disable_touchpad.sh & # there's a delay in that script anyway, otherwise you could (sleep 10; /home/scripts/disable_touchpad.sh) &
exec mate-sessionOffline
/home/scripts/disable_touchpad.sh & exec mate-sessionWell.. disable_touchpad.sh it's executed without any effect (so those exported variables are wrong in xinit?)
P.S. I added a longer delay, and mate took longer to execute;
Offline
You don't have to export any of those but typically they'd be correct - it's more likely that mate re-activates the device.
"mate took longer to execute" makes no sense as long as the script is forked (the ampersand) b/c xinitrc triggers the script and immediately moves on to exec mate-session.
Does it take 10+ seconds longer to execute??
Offline
You don't have to export any of those but typically they'd be correct - it's more likely that mate re-activates the device.
"mate took longer to execute" makes no sense as long as the script is forked (the ampersand) b/c xinitrc triggers the script and immediately moves on to exec mate-session.
Does it take 10+ seconds longer to execute??
I tested 30 seconds, and it tooked 30+ seconds after startx
P.S. I commented those exports, still no effect
Last edited by tesla135 (2023-10-29 16:10:53)
Offline
Post the actual xinitrc
Offline
#!/bin/sh
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap
# merge in defaults and keymaps
if [ -f $sysresources ]; then
xrdb -merge $sysresources
fi
if [ -f $sysmodmap ]; then
xmodmap $sysmodmap
fi
if [ -f "$userresources" ]; then
xrdb -merge "$userresources"
fi
if [ -f "$usermodmap" ]; then
xmodmap "$usermodmap"
fi
# start some nice programs
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
[ -x "$f" ] && . "$f"
done
unset f
fi
/home/scripts/disable_touchpad.sh && exec mate-session
#QT_SCALE_FACTOR=0.8 VirtualBoxOffline
ONE ampersand.
Two ampersands are a logical connector - the line says "run disable_touchpad.sh and only if that succeeds run exec mate-session afterwards"
Offline
ONE ampersand.
Two ampersands are a logical connector - the line says "run disable_touchpad.sh and only if that succeeds run exec mate-session afterwards"
Yeah, It worked, thx
Offline
Pages: 1