- WIP Updated installer to setup budgie system tray

This commit is contained in:
Ben Reaves
2020-07-31 21:22:50 -05:00
parent 83aaca7f6b
commit 57d56261ed
5 changed files with 62 additions and 27 deletions

View File

@@ -6,4 +6,4 @@ Description=Kinto Applet
Authors=Ben Reaves Authors=Ben Reaves
Copyright=Copyright © 2020 Ben Reaves Copyright=Copyright © 2020 Ben Reaves
Website=github.com/rbreaves Website=github.com/rbreaves
Icon=kinto-invert Icon=kinto-solid

View File

@@ -63,7 +63,7 @@ class KintoApplet(Budgie.Applet):
chkautostart_id=0 chkautostart_id=0
autostart_bool = False autostart_bool = False
subprocess.Popen(['sh',homedir+'/.config/kinto/logoff.sh']) # subprocess.Popen(['sh',homedir+'/.config/kinto/logoff.sh'])
with open(kconfig) as configfile: with open(kconfig) as configfile:
autostart_line = configfile.read().split('\n')[1] autostart_line = configfile.read().split('\n')[1]
@@ -87,11 +87,11 @@ class KintoApplet(Budgie.Applet):
self.checkbox_autostart.set_label("Autostart") self.checkbox_autostart.set_label("Autostart")
# self.checkbox_autostart.modify_fg(Gtk.STATE_NORMAL, Gtk.Gdk.color_parse('#366B7E')); # self.checkbox_autostart.modify_fg(Gtk.STATE_NORMAL, Gtk.Gdk.color_parse('#366B7E'));
if self.autostart_bool: if self.autostart_bool:
subprocess.Popen(['sudo', 'systemctl','restart','xkeysnail']) # subprocess.Popen(['sudo', 'systemctl','restart','xkeysnail'])
self.checkbox_autostart.set_active(True) self.checkbox_autostart.set_active(True)
self.chkautostart_id = self.checkbox_autostart.connect("clicked",self.setAutostart,False) self.chkautostart_id = self.checkbox_autostart.connect("clicked",self.setAutostart,False)
else: else:
subprocess.Popen(['sudo', 'systemctl','stop','xkeysnail']) # subprocess.Popen(['sudo', 'systemctl','stop','xkeysnail'])
self.checkbox_autostart.set_active(False) self.checkbox_autostart.set_active(False)
self.chkautostart_id = self.checkbox_autostart.connect("clicked",self.setAutostart,True) self.chkautostart_id = self.checkbox_autostart.connect("clicked",self.setAutostart,True)
# self.chkautostart_id = self.checkbox_autostart.connect("clicked",self.setAutostart,True) # self.chkautostart_id = self.checkbox_autostart.connect("clicked",self.setAutostart,True)

View File

@@ -5,7 +5,6 @@ Description=xkeysnail
Type=simple Type=simple
KillMode=process KillMode=process
ExecStart=/usr/bin/sudo /bin/bash -c '/usr/bin/xhost +SI:localuser:root && /usr/local/bin/xkeysnail --quiet --watch {homedir}/.config/kinto/kinto.py' ExecStart=/usr/bin/sudo /bin/bash -c '/usr/bin/xhost +SI:localuser:root && /usr/local/bin/xkeysnail --quiet --watch {homedir}/.config/kinto/kinto.py'
ExecStop=/usr/bin/pkill -f xkeysnail
Restart=on-failure Restart=on-failure
RestartSec=3 RestartSec=3
Environment=DISPLAY={displayid} Environment=DISPLAY={displayid}

View File

@@ -86,6 +86,39 @@ function removeAppleKB {
fi fi
} }
function trayApp {
if [ -f /usr/bin/budgie-desktop ];then
while true; do
read -rep $'Would you like to install the Kinto Budgie Applet? (y/n)\n(You will need log off & back on and go to Budgie Desktop Settings & add Kinto to your top panel.)\n' yn
case $yn in
[Yy]* ) yn="y"; break;;
[Nn]* ) yn="n";break;;
* ) echo "Please answer yes or no.";;
esac
done
if [ "$yn" == "y" ]; then
cd ./xkeysnail-config/trayapps/BudgieApplet/
sudo ./install-applet.sh
cd ../../../
echo "Please logoff and back on for the Applet to be available for the top panel."
~/.config/kinto/gnome_logoff.sh&
fi
else
while true; do
read -rep $'Would you like to install the Kinto Gnome/XFCE System Tray? (y/n)\n' yn
case $yn in
[Yy]* ) yn="y"; break;;
[Nn]* ) yn="n";break;;
* ) echo "Please answer yes or no.";;
esac
done
if [ "$yn" == "y" ]; then
echo "Kinto Gnome/XFCE System Tray Installed."
fi
fi
}
function budgieUninstall { function budgieUninstall {
if [ -f /usr/bin/budgie-desktop ];then if [ -f /usr/bin/budgie-desktop ];then
read -n 1 -s -r -p "Your system may log you off immediately during the restoration of budgie-daemon. Press any key to continue..." read -n 1 -s -r -p "Your system may log you off immediately during the restoration of budgie-daemon. Press any key to continue..."
@@ -104,7 +137,7 @@ function budgieUpdate {
# Check for budgie and install App Switching hack # Check for budgie and install App Switching hack
if [ -f /usr/bin/budgie-desktop ];then if [ -f /usr/bin/budgie-desktop ];then
while true; do while true; do
read -rep $'Would you like to update Budgie to support proper App Switching? (y/n)\n(Your system will immediately log you out after this runs.)\n' yn read -rep $'Would you like to update Budgie to support proper App Switching? (y/n)\n(Your system may immediately log you out after this runs.)\n' yn
case $yn in case $yn in
[Yy]* ) yn="y"; break;; [Yy]* ) yn="y"; break;;
[Nn]* ) yn="n";break;; [Nn]* ) yn="n";break;;
@@ -197,10 +230,10 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1
expsh=" " expsh=" "
# fi # fi
sudo systemctl enable xkeysnail >/dev/null 2>&1 sudo systemctl enable xkeysnail >/dev/null 2>&1
if ! [ -x "$(command -v inotifywait)" ]; then # if ! [ -x "$(command -v inotifywait)" ]; then
echo "Will need to install inotify-tools to restart key remapper live for config file changes..." # echo "Will need to install inotify-tools to restart key remapper live for config file changes..."
sudo ./system-config/unipkg.sh inotify-tools # sudo ./system-config/unipkg.sh inotify-tools
fi # fi
if ! [ -x "$(command -v pip3)" ]; then if ! [ -x "$(command -v pip3)" ]; then
echo "Will need to install python3-pip..." echo "Will need to install python3-pip..."
sudo ./system-config/unipkg.sh python3-pip sudo ./system-config/unipkg.sh python3-pip
@@ -229,20 +262,20 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1
mkdir -p ~/.config/kinto mkdir -p ~/.config/kinto
# KDE xhost fix # KDE xhost fix
mkdir -p ~/.kde/Autostart # mkdir -p ~/.kde/Autostart
echo -e '#!/bin/sh\rxhost +SI:localuser:root' > ~/.kde/Autostart/kintohost.sh # echo -e '#!/bin/sh\rxhost +SI:localuser:root' > ~/.kde/Autostart/kintohost.sh
chmod +x ~/.kde/Autostart/kintohost.sh # chmod +x ~/.kde/Autostart/kintohost.sh
# KDE startup - xhost fix # KDE startup - xhost fix
mkdir -p ~/.config/autostart mkdir -p ~/.config/autostart
yes | cp -rf ./xkeysnail-config/xkeysnail.desktop ~/.config/autostart/xkeysnail.desktop 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/xkeystart.sh ~/.config/kinto/xkeystart.sh
yes | cp -rf ./xkeysnail-config/gnome_logoff.sh ~/.config/kinto/gnome_logoff.sh yes | cp -rf ./xkeysnail-config/gnome_logoff.sh ~/.config/kinto/gnome_logoff.sh
yes | cp -rf ./xkeysnail-config/kinto.py ./xkeysnail-config/kinto.py.new yes | cp -rf ./xkeysnail-config/kinto.py ./xkeysnail-config/kinto.py.new
yes | cp -rf ./xkeysnail-config/limitedadmins ./xkeysnail-config/limitedadmins.new yes | cp -rf ./xkeysnail-config/limitedadmins ./xkeysnail-config/limitedadmins.new
yes | cp -rf ./xkeysnail-config/prexk.sh ~/.config/kinto/prexk.sh # yes | cp -rf ./xkeysnail-config/prexk.sh ~/.config/kinto/prexk.sh
yes | cp -rf ./system-config/caret_status_xkey.sh ~/.config/kinto/caret_status_xkey.sh # yes | cp -rf ./system-config/caret_status_xkey.sh ~/.config/kinto/caret_status_xkey.sh
yes | cp -rf ./xkeysnail-config/xkeysnail.service ./xkeysnail-config/xkeysnail.service.new yes | cp -rf ./xkeysnail-config/xkeysnail.service ./xkeysnail-config/xkeysnail.service.new
# yes | cp -rf ./xkeysnail-config/xkeysnail.timer ~/.config/systemd/user/xkeysnail.timer # yes | cp -rf ./xkeysnail-config/xkeysnail.timer ~/.config/systemd/user/xkeysnail.timer
sed -i "s#{experimental-caret}#$exp#g" ./xkeysnail-config/xkeysnail.service.new sed -i "s#{experimental-caret}#$exp#g" ./xkeysnail-config/xkeysnail.service.new
@@ -255,16 +288,15 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1
sed -i "s#{homedir}#`echo "$HOME"`#g" ./xkeysnail-config/xkeysnail.service.new sed -i "s#{homedir}#`echo "$HOME"`#g" ./xkeysnail-config/xkeysnail.service.new
sed -i "s#{xhost}#`\\which xhost`#g" ./xkeysnail-config/xkeysnail.service.new sed -i "s#{xhost}#`\\which xhost`#g" ./xkeysnail-config/xkeysnail.service.new
sed -i "s/{username}/`whoami`/g" ./xkeysnail-config/limitedadmins.new sed -i "s/{username}/`whoami`/g" ./xkeysnail-config/limitedadmins.new
sed -i "s#{homedir}#`echo "$HOME"`#g" ./xkeysnail-config/limitedadmins.new
sed -i "s#{systemctl}#`\\which systemctl`#g" ./xkeysnail-config/limitedadmins.new sed -i "s#{systemctl}#`\\which systemctl`#g" ./xkeysnail-config/limitedadmins.new
sudo chown root:root ./xkeysnail-config/limitedadmins.new sudo chown root:root ./xkeysnail-config/limitedadmins.new
sudo mv ./xkeysnail-config/limitedadmins.new /etc/sudoers.d/limitedadmins sudo mv ./xkeysnail-config/limitedadmins.new /etc/sudoers.d/limitedadmins
sed -i "s#{systemctl}#`\\which systemctl`#g" ~/.config/autostart/xkeysnail.desktop sed -i "s#{systemctl}#`\\which systemctl`#g" ~/.config/autostart/xkeysnail.desktop
sed -i "s#{xhost}#`\\which xhost`#g" ~/.config/autostart/xkeysnail.desktop sed -i "s#{xhost}#`\\which xhost`#g" ~/.config/autostart/xkeysnail.desktop
sed -i "s#{homedir}#`echo "$HOME"`#g" ~/.config/autostart/xkeysnail.desktop sed -i "s#{homedir}#`echo "$HOME"`#g" ~/.config/autostart/xkeysnail.desktop
sed -i "s#{homedir}#`echo "$HOME"`#g" ~/.config/kinto/prexk.sh # sed -i "s#{homedir}#`echo "$HOME"`#g" ~/.config/kinto/prexk.sh
sed -i "s/{displayid}/`echo "$DISPLAY"`/g" ./xkeysnail-config/xkeysnail.service.new sed -i "s/{displayid}/`echo "$DISPLAY"`/g" ./xkeysnail-config/xkeysnail.service.new
sed -i "s/{displayid}/`echo "$DISPLAY"`/g" ~/.config/kinto/prexk.sh # sed -i "s/{displayid}/`echo "$DISPLAY"`/g" ~/.config/kinto/prexk.sh
if $vssublime ; then if $vssublime ; then
perl -pi -e "s/(# )(.*)(- Sublime)/\$2\$3/g" ./xkeysnail-config/kinto.py.new >/dev/null 2>&1 perl -pi -e "s/(# )(.*)(- Sublime)/\$2\$3/g" ./xkeysnail-config/kinto.py.new >/dev/null 2>&1
@@ -333,12 +365,13 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1
sudo pip3 install --upgrade . sudo pip3 install --upgrade .
cd .. cd ..
sudo systemctl daemon-reload sudo systemctl daemon-reload
sudo systemctl --state=not-found --all | grep xkeysnail sudo systemctl disable xkeysnail
if [ "$distro" == "fedora" ];then # sudo systemctl --state=not-found --all | grep xkeysnail
systemctl enable xkeysnail.service # if [ "$distro" == "fedora" ];then
else # systemctl enable xkeysnail.service
sudo systemctl enable xkeysnail.service # else
fi # sudo systemctl enable xkeysnail.service
# fi
sudo systemctl restart xkeysnail sudo systemctl restart xkeysnail
echo -e "Adding xhost fix...\n" echo -e "Adding xhost fix...\n"
@@ -381,6 +414,9 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1
if $rightalt ; then if $rightalt ; then
echo -e "\e[1m\e[32mEnabled\e[0m mutli-language support." echo -e "\e[1m\e[32mEnabled\e[0m mutli-language support."
fi fi
trayApp
elif [[ $1 == "5" || $1 == "uninstall" || $1 == "Uninstall" ]]; then elif [[ $1 == "5" || $1 == "uninstall" || $1 == "Uninstall" ]]; then
echo "Uninstalling Kinto - xkeysnail (udev)" echo "Uninstalling Kinto - xkeysnail (udev)"
uninstall uninstall
@@ -397,7 +433,7 @@ elif [[ $1 == "5" || $1 == "uninstall" || $1 == "Uninstall" ]]; then
sudo systemctl --state=not-found --all | grep xkeysnail sudo systemctl --state=not-found --all | grep xkeysnail
budgieUninstall budgieUninstall
exit 0 exit 0
elif [[ $1 == "5" || $1 == "budgieUpdate" ]]; then elif [[ $1 == "budgieUpdate" ]]; then
budgieUpdate budgieUpdate
else else
echo "Expected argument was not provided" echo "Expected argument was not provided"