#!/bin/bash
-if [[ -s ~/.bashrc ]];then . ~/.bashrc;fi
-set -x
-# Copyright (C) 2016 Ian Kelling
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to switch
+# its license to GPL.
+
+# Copyright 2024 Ian Kelling
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# See the License for the specific language governing permissions and
# limitations under the License.
-type=model01
+
+
+set -e; . /usr/local/lib/bash-bear; set +e
+
+script_name="${0##*/}"
+
+
+m() { printf "$script_name: %s\n" "$*"; "$@"; }
+
+## disabed because unused
+# ms() {
+# xinput --set-ptr-feedback "$1" $2 ${3%/*} ${3#*/}
+# # running newer system that uses libinput and has far less
+# # customizability. I havent yet determined the best settings here.
+# if xinput --list-props "$1" | grep "libinput Accel Speed" &>/dev/null; then
+# m xinput --set-prop "$1" "libinput Accel Speed" 1
+# else
+# m xinput --set-prop "$1" 'Device Accel Profile' $4
+# m xinput --set-prop "$1" 'Device Accel Constant Deceleration' $5
+# m xinput --set-prop "$1" 'Device Accel Velocity Scaling' $6
+# fi
+# xinput --get-feedbacks "$1" | grep "threshold"
+# xinput --get-feedbacks "$1" | grep "accelNum\|accelDenom"
+# xinput --list-props "$1"
+# }
+# set_device_id() {
+# if [[ $2 ]] && $2; then
+# cmd="tail -n1"
+# else
+# cmd="head -n1"
+# fi
+# if device_id=$(xinput --list | grep "$1" | $cmd); then
+# device_id=${device_id##*id=}
+# device_id=${device_id%%[[:space:]]*}
+# echo "2:$2 device_id=$device_id"
+# else
+# return 1
+# fi
+# }
case $1 in
l) type=laptop ;;
- m) type=model01 ;;
+ m) type=keyboardio ;;
esac
-#set -x
-mi() {
- xinput --get-feedbacks "$1" | grep "threshold"
- xinput --get-feedbacks "$1" | grep "accelNum\|accelDenom"
- xinput --list-props "$1"
-}
-ms() {
- xinput --set-ptr-feedback "$1" $2 ${3%/*} ${3#*/}
- # running newer system that uses libinput and has far less
- # customizability. I havent yet determined the best settings here.
- if xinput --list-props "$1" | grep "libinput Accel Speed" &>/dev/null; then
- xinput --set-prop "$1" "libinput Accel Speed" 1
- else
- xinput --set-prop "$1" 'Device Accel Profile' $4
- xinput --set-prop "$1" 'Device Accel Constant Deceleration' $5
- xinput --set-prop "$1" 'Device Accel Velocity Scaling' $6
- fi
- mi "$1"
-}
-set_device_id() {
- if [[ $2 ]] && $2; then
- cmd="tail -n1"
- else
- cmd="head -n1"
- fi
- if device_id=$(xinput --list | grep "$1" | $cmd); then
- device_id=${device_id##*id=}
- device_id=${device_id%%[[:space:]]*}
- echo "2:$2 device_id=$device_id"
+if [[ ! $type ]]; then
+ if xinput | grep -i keyboardio; then
+ type=keyboardio
else
- return 1
+ type=laptop
fi
-}
-
-# default via xset q is 660 25. (delay for autorepeat, repeat rate)
-# was at 200 13, but while learning to use keyboardio, i hold keys a bit longer sometimes.
-xset r rate 400 13 # decrease rate delay
+fi
-if set_device_id "SteelSeries World of Warcraft MMO Gaming Mouse"; then
- ms "$device_id" 100 1000/1 7 4 1
+# start auto-repeat faster, but go slower.
+#
+# default via xset q is 660 25. (delay for autorepeat, repeat rate). At
+# one point I used 200 13, but while learning to use keyboardio, i found
+# it a bit too fast.
+m xset r rate 400 13 # decrease rate delay
- # under the new "improved" libinput, the mouse speed/accel has
- # changed all around and is much more limited.
- # Other xinput commands will fail and this will succeed.
- xinput --set-prop "$device_id" "libinput Accel Speed" '.8'
-fi
+# # disabled because i'm not using it atm 2024
+# if set_device_id "SteelSeries World of Warcraft MMO Gaming Mouse"; then
+# ms "$device_id" 100 1000/1 7 4 1
+# # under the new "improved" libinput, the mouse speed/accel has
+# # changed all around and is much more limited.
+# # Other xinput commands will fail and this will succeed.
+# xinput --set-prop "$device_id" "libinput Accel Speed" '.8'
+# fi
# todo, differentiate for work pc
#/a/bin/radl
case $type in
- model01)
- # original saved with:
+ keyboardio)
+ # at some point, I found the international variant useful:
# setxkbmap -layout us -variant intl
- # xkbcomp $DISPLAY /a/c/etiona-2021-intl.xkb
- xkbcomp /a/c/model01.xkb $DISPLAY
+ # xkbcomp $DISPLAY xkbcomp-t9-intl.xkb
+ #
+ # I create these for a new os by comparing the diff with the default
+ # of previous os, then recreating the diff manually on the new
+ # default. the x2 version has changes on top of keyboardio, so
+ # create the keyboardio one first.
+ #
+ # xkbcomp $DISPLAY xkbcomp-t12.xkb
+ # cp xkbcomp-t12.xkb keyboardio-t12.xkb
+ # diff xkbcomp-t9.xkb keyboardio-t9.xkb
+ # g keyboardio-t12.xkb
+ # # finish editing
+ # cp keyboardio-t12.xkb x2-t12.xkb
+ # diff xkbcomp-t9.xkb x2-t9.xkb
+ # g x2-t12.xkb
+ m xkbcomp /a/c/keyboardio-t12.xkb $DISPLAY
;;
laptop)
- xkbcomp /a/c/x2.xkb $DISPLAY
-
+ m xkbcomp /a/c/x2-t12.xkb $DISPLAY
;;
esac
+## disabled because i'm not using it atm.
# for desktop and htpc
-if set_device_id "Logitech Unifying Device"; then
- xinput --set-prop "$device_id" 'Evdev Middle Button Emulation' 1
-fi
+# if set_device_id "Logitech Unifying Device"; then
+# xinput --set-prop "$device_id" 'Evdev Middle Button Emulation' 1
+# fi
-# slow down ploopy trackball, until we recompile firmware
+## slow down ploopy trackball, until we recompile firmware
id=$(xinput list | grep -F 'Ploopy Corporation Trackball Mouse' | sed -rn 's/.*[[:space:]]id=([^[:space:]]*).*/\1/p' ||:)
if [[ $id ]]; then
- xinput --set-prop 'libinput Accel Speed' -0.9
+ m xinput --set-prop $id 'libinput Accel Speed' -0.7
fi
-set +x
exit 0