27 lines
625 B
Bash
Executable file
27 lines
625 B
Bash
Executable file
#!/bin/bash
|
|
function addInputConfig() {
|
|
local configFile=/etc/xdg/kcminputrc;
|
|
local id1="$1";
|
|
local id2="$2";
|
|
local deviceName="$3";
|
|
local statements="${@:4}";
|
|
|
|
if [ -z "$statements" ]
|
|
then
|
|
statements="$(cat)";
|
|
fi;
|
|
|
|
if ! { cat "$configFile" | grep "\\[$deviceName\\]"; } > /dev/null 2>&1
|
|
then
|
|
{
|
|
if [ -f "$configFile" ] && [ -n "$(cat "$configFile")" ]
|
|
then
|
|
echo "";
|
|
fi;
|
|
|
|
echo "[Libinput][$id1][$id2][$deviceName]";
|
|
echo "$statements";
|
|
} | sudo tee "$configFile" > /dev/null;
|
|
fi;
|
|
}
|