![]() |
|
OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below. |
![]() |
|
Thread Tools | Display Modes |
|
|||
![]()
The new touchpad configuration tools make it difficult for a user to disable to touchpad. The soon to be phased out synclient(1) tools made it easy for a user to disable the touchpad while the new wsconsctl commands need to be run as root.
My HP Stream 14 ergonomics would benefit from an easy way to disable the touchpad and fortunately, the F5 key is not dedicated to a special function. The following enables me to toggle the touchpad on/off with F5. 1. /etc/doas.conf entry Code:
permit nopass :wheel as root cmd /sbin/wsconsctl mouse.tp.disable Code:
#!/bin/sh # Determine touchpad state TP_STATE=`doas wsconsctl 2>/dev/null | grep mouse.tp.disable | cut -d "=" -f 2` if [[ $TP_STATE -eq 0 ]] ; then `doas wsconsctl mouse.tp.disable=1 1>/dev/null` else `doas wsconsctl mouse.tp.disable=0 1>/dev/null` fi Last edited by shep; 4th December 2022 at 05:57 PM. |
|
|||
![]()
I was hoping for a more elegant implementation of tp_state. When developing the script, I ran each command individually to step through it. The stderr outputs were more warnings than frank errors but still had to filtered out. Cutting down the pipes with awk is more elegant - I need to learn more about awk/sed and posix compliance.
Thanks |
|
||||
![]()
I don't have an OpenBSD system handy to test but I think you could omit the search in awk by specifying the wsconsctl variable:
Code:
tp_state=$(doas wsconsctl mouse.tp.disable 2>/dev/null | awk -F'=' '{print $2}') |
|
|||
![]()
Tested your changes on OpenBSD current. Worked fine.
I'm have a similar script that uses yad --scale (zenity --scale, xdialog --gauge) to adjust sndio audio volume. The awk stanza also worked in that script. That script also uses back tic's which I'll clean up and post later. Thanks |
|
|||
![]()
My /etc/doas.conf needed full cmd paths in the script.
Code:
#!/bin/sh # Determine Touchpad state tp_state=$(doas /sbin/wsconsctl 2>/dev/null | awk -F'=' '/mouse.tp.disable/{print $2}') # Flip Touchpad state if [ "$tp_state" -eq 0 ] ; then doas /sbin/wsconsctl mouse.tp.disable=1 1>/dev/null else doas /sbin/wsconsctl mouse.tp.disable=0 1>/dev/null fi Last edited by shep; 4th December 2022 at 10:48 PM. Reason: See next post :Thnx @Head_on_a_Stick |
|
||||
![]()
You've used the
if [ "$tp_state" -eq 0 ] ; then line from my example but kept the TP_STATE variable name in the # Determine Touchpad state section.Sorry, that's my fault. I prefer to use lower case with custom variable names to avoid confusion or conflict with system variables, which are usually upper case. |
![]() |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
wsconsctl.conf variables | LeFrettchen | OpenBSD General | 11 | 5th January 2020 09:05 AM |
wsconsctl elusive keycodes | radix | OpenBSD General | 15 | 8th March 2015 08:17 PM |
HP kills TouchPad | ocicat | News | 10 | 21st March 2012 05:31 PM |
How to disable touchpad | gpatrick | OpenBSD General | 3 | 4th March 2012 03:36 PM |
Cannot get touchpad to scroll! | cgc2 | FreeBSD General | 5 | 16th August 2008 05:53 PM |