mirror of
https://github.com/rbreaves/kinto.git
synced 2025-08-01 16:56:38 +02:00
- Updated xkeysnail installer to properly copy desktop autostart and to restart service on config file changes
This commit is contained in:
21
system-config/unipkg.sh
Executable file
21
system-config/unipkg.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
if pkgmgr="$( which apt-get )" 2> /dev/null; then
|
||||
echo "Debian"
|
||||
$pkgmgr update
|
||||
$pkgmgr install "$1"
|
||||
elif pkgmgr="$( which dnf )" 2> /dev/null; then
|
||||
echo "dnf"
|
||||
$pkgmgr check-update; $pkgmgr install -y "$1"
|
||||
elif pkgmgr="$( which pacman )" 2> /dev/null; then
|
||||
echo "Arch-based"
|
||||
$pkgmgr -Syy; $pkgmr -S "$1"
|
||||
else
|
||||
echo "Package manager not found, please install $1" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ 1 -ne $# ]]; then
|
||||
echo "Syntax: $0 PACKAGE"
|
||||
exit 1
|
||||
fi
|
||||
exit $?
|
8
xkeysnail-config/xkeysnail.desktop
Normal file
8
xkeysnail-config/xkeysnail.desktop
Normal file
@@ -0,0 +1,8 @@
|
||||
[Desktop Entry]
|
||||
Name=Kinto_xkey
|
||||
GenericName=Kinto_xkey
|
||||
Comment=Make Linux Type Like it's a Mac
|
||||
Exec=/usr/bin/xhost +SI:localuser:root
|
||||
Terminal=false
|
||||
Type=Application
|
||||
X-GNOME-Autostart-enabled=true
|
@@ -5,7 +5,7 @@ Description=xkeysnail
|
||||
Type=simple
|
||||
KillMode=process
|
||||
ExecStartPre=/sbin/runuser -l {username} -c /home/{username}/.config/kinto/prexk.sh
|
||||
ExecStart=/usr/bin/sudo /usr/local/bin/xkeysnail --quiet --watch /home/{username}/.config/kinto/kinto.py
|
||||
ExecStart=/usr/bin/sudo /bin/bash -c '/home/{username}/.config/kinto/xkeystart.sh "/home/{username}/.config/kinto/kinto.py"'
|
||||
ExecStop=/usr/bin/sudo /usr/bin/killall xkeysnail
|
||||
Restart=on-failure
|
||||
RestartSec=3
|
||||
|
8
xkeysnail-config/xkeystart.sh
Executable file
8
xkeysnail-config/xkeystart.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
# >/dev/null 2>&1
|
||||
/usr/local/bin/xkeysnail --quiet --watch "$1" &
|
||||
while true
|
||||
do inotifywait -e close_write,moved_to,create -q "$1"
|
||||
/usr/bin/killall xkeysnail
|
||||
/usr/local/bin/xkeysnail --quiet --watch "$1" &
|
||||
done
|
@@ -15,6 +15,10 @@ if [ $# -eq 0 ]; then
|
||||
fi
|
||||
|
||||
if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1 == "chromebook" ]]; then
|
||||
if ! [ -x "$(command -v inotifywait)" ]; then
|
||||
echo "Will need to install inotify-tools to restart key remapper live for config file changes..."
|
||||
sudo ./system-config/unipkg.sh inotify-tools
|
||||
fi
|
||||
# echo "Transferring files..."
|
||||
mkdir -p ~/.config/kinto
|
||||
|
||||
@@ -23,9 +27,13 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1
|
||||
echo -e '#!/bin/sh\rxhost +SI:localuser:root' > ~/.kde/Autostart/kintohost.sh
|
||||
chmod +x ~/.kde/Autostart/kintohost.sh
|
||||
|
||||
cp ./xkeysnail-config/kinto.py ./xkeysnail-config/kinto.py.new
|
||||
cp ./xkeysnail-config/prexk.sh ~/.config/kinto/prexk.sh
|
||||
cp ./xkeysnail-config/xkeysnail.service ./xkeysnail-config/xkeysnail.service.new
|
||||
# KDE startup - xhost fix
|
||||
yes | cp -rf ./xkeysnail-config/xkeysnail.desktop ~/.config/autostart/xkeysnail.desktop
|
||||
|
||||
yes | cp -rf ./xkeysnail-config/xkeystart.sh ~/.config/kinto/xkeystart.sh
|
||||
yes | cp -rf ./xkeysnail-config/kinto.py ./xkeysnail-config/kinto.py.new
|
||||
yes | cp -rf ./xkeysnail-config/prexk.sh ~/.config/kinto/prexk.sh
|
||||
yes | cp -rf ./xkeysnail-config/xkeysnail.service ./xkeysnail-config/xkeysnail.service.new
|
||||
sed -i "s/{username}/`whoami`/g" ./xkeysnail-config/xkeysnail.service.new
|
||||
sed -i "s/{displayid}/`echo "$DISPLAY"`/g" ./xkeysnail-config/xkeysnail.service.new
|
||||
else
|
||||
@@ -55,9 +63,6 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1
|
||||
|
||||
echo "Adding xhost fix..."
|
||||
|
||||
# KDE startup - xhost fix
|
||||
cp ./xkeysnail-config/xkeysnail.desktop ~/.config/autostart/xkeysnail.desktop
|
||||
|
||||
LINE='xhost +SI:localuser:root'
|
||||
|
||||
if [ ! -e "~/.xprofile" ]; then
|
||||
|
Reference in New Issue
Block a user