- Install changes, debug fixes, refinements

- Added setup fixes for gui

- Fixed debug issues & updated copyright

- Uninstaller update, init setup improvements, added open kinto to tray

- Fixed order of operations for args parsing

- Fixed initial radio value of keyboard type in main gui app, removed comments, fixed sys tray default for DE

- File cleanup, relocations and faster setup file

- Do not clobber initkb if it already exists
This commit is contained in:
Ryan Reaves
2020-10-20 02:42:15 -05:00
committed by Ben Reaves
parent aff4d46abc
commit 437a2141ff
26 changed files with 1456 additions and 2350 deletions

631
kinto_old/setup.py Normal file
View File

@@ -0,0 +1,631 @@
#!/usr/bin/env python3
import json, time, os, sys, subprocess, shlex, platform
from shutil import copyfile
from subprocess import PIPE, Popen
from prekinto import *
homedir = os.path.expanduser("~")
kintotype = 0
def windows_setup():
keymaps = ["Apple keyboard standard", "Windows keyboard standard","Chromebook","IBM - No Super/Win","Uninstall"]
for index, item in enumerate(keymaps):
print(" %i. %s" % (index+1, item))
default = 0
while not int(default) in range(1,len(keymaps)+1):
default = int(input("\nPlease enter your desired keymap (1 - " + str(len(keymaps)) + ") : "))
print("")
# Short DOS path notation
path= cmdline('echo ''%cd%''')[:-1]
if default > 0 and default < 5:
print("Will now install chocolatey and autohotkey with elevated privileges...")
print("This install will fail if you are not running with elevated privileges")
os.system('powershell -executionpolicy bypass ".\\windows\\autohotkey.ps1"')
print("Copying autohotkey combinations for Terminals & Editors...")
os.system('copy /Y "' + path + '\\windows\\kinto.ahk" "' + path + '\\windows\\kinto-new.ahk"')
if default < 3:
os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; Default)(?!( - ST2CODE))(.*)/$2$3$5/g" .\\windows\\kinto-new.ahk')
if default == 1:
kbtype = "mac"
os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; MacModifiers)/$2$3/g" .\\windows\\kinto-new.ahk')
elif default == 2:
kbtype = "win"
os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; WinModifiers)/$2$3/g" .\\windows\\kinto-new.ahk')
elif default == 5:
print("Removing any old registry keys from prior versions...")
p = subprocess.Popen(['powershell.exe', "Remove-ItemProperty -Path HKLM:'SYSTEM\CurrentControlSet\Control\Keyboard Layout' -Name 'Scancode Map' -ErrorAction SilentlyContinue"], stdout=sys.stdout)
print("Removing Kinto from Startup folder...")
os.system("(del \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\kinto.ahk\") 2> nul")
os.system('(del "%userprofile%\\AppData\\Roaming\\Microsoft\\Windows\\STARTM~1\\Programs\\Startup\\kinto-start.vbs") 2> nul')
print("Ending any running Kinto tasks...")
os.system("(taskkill /IM autohotkey.exe) 2> nul")
print("Removing Kinto from users profile directory...")
os.system('(rd /s /q "%userprofile%\\.kinto") 2> nul')
print("")
print("Uninstall of Kinto is Complete.")
if default == 3:
kbtype = "chrome"
os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; Chromebook)/$2$3/g" .\\windows\\kinto-new.ahk')
os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; WinModifiers/CB)/$2$3/g" .\\windows\\kinto-new.ahk')
if default == 3 or default == 4:
os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; CB/IBM)/$2$3/g" .\\windows\\kinto-new.ahk')
if default == 4:
kbtype = "ibm"
os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; IBM)/$2$3/g" .\\windows\\kinto-new.ahk')
os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; WinModifiers/CB/IBM)/$2$3/g" .\\windows\\kinto-new.ahk')
if default > 0 and default < 5:
stvscode = yn_choice(bcolors.CYELLOW2 + "Would you like to use Sublime Text 3 keymaps in VS Code?\n" + bcolors.ENDC)
print("\nWill now install Ubuntu Termimnal Theme as default...")
os.system('regedit "' + path + '\\windows\\theme_ubuntu.reg"')
os.system('robocopy "'+ path + '\\assets" "%userprofile%\\.kinto\\assets" /E')
if (stvscode and (default > 0 or default < 3)):
os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; Default - ST2CODE)/$2$3/g" .\\windows\\kinto-new.ahk')
elif (stvscode and (default == 3 or default == 4 )):
os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; CB/IBM - ST2CODE)/$2$3/g" .\\windows\\kinto-new.ahk')
os.system('copy /Y "' + path + '\\windows\\kinto-start.vbs" "%userprofile%\\.kinto\\kinto-start.vbs"')
os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/{kbtype}/' + kbtype + '/g" "%userprofile%\\.kinto\\kinto-start.vbs"')
os.system('copy /Y "' + path + '\\windows\\usb.vbs" "%userprofile%\\.kinto\\usb.vbs"')
os.system('copy /Y "' + path + '\\windows\\detectUSB.ahk" "%userprofile%\\.kinto\\detectUSB.ahk"')
os.system('mklink "%userprofile%\\Start Menu\\Programs\\Startup\\kinto-start.vbs" "%userprofile%\\.kinto\\kinto-start.vbs"')
os.system('copy /Y "'+ path + '\\windows\\NoShell.vbs" "%userprofile%\\.kinto\\NoShell.vbs"')
os.system('copy /Y "'+ path + '\\windows\\toggle_kb.bat" "%userprofile%\\.kinto\\toggle_kb.bat"')
os.system('copy /Y "'+ path + '\\windows\\kinto-new.ahk" "%userprofile%\\.kinto\\kinto.ahk"')
os.system("del /f .\\windows\\kinto-new.ahk")
os.system("del \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\kinto.ahk\" 2> nul")
userpath = cmdline('cmd /c for %A in ("%userprofile%") do @echo %~sA')[:-1]
print('Starting... "' + userpath + '\\AppData\\Roaming\\Microsoft\\Windows\\STARTM~1\\Programs\\Startup\\kinto-start.vbs"')
os.system('"' + userpath + '\\AppData\\Roaming\\Microsoft\\Windows\\STARTM~1\\Programs\\Startup\\kinto-start.vbs"')
# # print("\nPlease log off and back on for changes to take full effect.")
print("If using WSL then please remember to right click on title bar -> Properties -> Edit Options -> Use Ctrl+Shift+C/V as Copy/Paste and enable it.")
else:
os.system("(del \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\kinto.ahk\") 2> nul")
def cmdline(command):
process = Popen(
args=command,
stdout=PIPE,
universal_newlines=True,
shell=True
)
return process.communicate()[0]
if platform.system() == 'Windows':
print("\nYou are detected as running Windows.")
windows_setup()
sys.exit()
check_x11 = cmdline("(env | grep -i x11 || loginctl show-session \"$XDG_SESSION_ID\" -p Type) | awk -F= '{print $2}'").strip()
if len(check_x11) == 0:
if os.name != 'nt':
print("You are not using x11, please logout and back in using x11/Xorg")
sys.exit()
else:
print("\nYou are detected as running Windows.")
windows_setup()
sys.exit()
distro = cmdline("awk -F= '$1==\"NAME\" { print $2 ;}' /etc/os-release").replace('"','').strip().split(" ")[0]
dename = cmdline("./system-config/dename.sh").replace('"','').strip().split(" ")[0].lower()
run_pkg = ""
def requirements(pkgm):
print(bcolors.CYELLOW2 + "You need to install some packages, " +run_pkg+ ", for Kinto to fully remap browsers during input focus.\n" + bcolors.ENDC)
print("sudo " + pkgm + " " + run_pkg + "\n")
run_install = yn_choice(bcolors.CYELLOW2 + "Would you like to run it now? (Will require sudo privileges.)\n" + bcolors.ENDC)
if(run_install):
os.system("sudo " + pkgm + run_pkg)
print("\n")
def install_ibus():
global distro
print(bcolors.CYELLOW2 + "You need to set IBus as the default Input Method for full word-wise support and re-run this installer.\n" + bcolors.ENDC)
print(bcolors.CYELLOW2 + "Confirm the IBus Setup by saying Yes and then closing the window.\n" + bcolors.ENDC)
print("ibus-setup\n")
print("im-config -n ibus or im-chooser\n")
run_install = yn_choice(bcolors.CYELLOW2 + "Would you like to run it now? (Will require logoff and logon.)\n" + bcolors.ENDC)
if(run_install):
if distro=="fedora":
os.system("ibus-setup")
os.system("im-chooser")
print("\n")
print("IBus needs to have Input Method set to your language.")
print("im-chooser needs IBus to be selected & closed.")
input("Will need to log off and back on for it take effect...")
else:
os.system("ibus-setup")
os.system("im-config -n ibus")
print("\n")
input("IBus has been set as the default Input Method.\nPress any key to exit and re-run after logoff & logon...")
sys.exit()
def setShortcuts():
global distro
distroVersion = cmdline("awk -F= '$1==\"VERSION_ID\" { print $2 ;}' /etc/os-release").replace('"','').strip()
print("\nIf Kinto is already running it will be stopped...")
print("If you cancel the installer you can re-run Kinto via\n systemctl --user start keyswap")
cmdline("systemctl --user stop keyswap")
print("\nDetected " + distro + " " + distroVersion.strip() + " DE: " + dename + "\n")
addhotkeys = yn_choice("\nDo you want to apply system level shortcuts?")
if(addhotkeys):
distro = distro.lower()
if dename == "gnome" or dename == "mate" or dename == "budgie":
cmdline('dconf dump /org/gnome/desktop/wm/keybindings/ > keybindings_`date +"%Y.%m.%d-%s"`.conf')
cmdline('dconf dump /org/gnome/mutter/keybindings/ > mutter_`date +"%Y.%m.%d-%s"`.conf')
if(kintotype == 1):
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-applications \"['<Primary>Tools','<Alt>Tab']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-applications-backward \"['<Primary><Shift>Tools','<Alt><Shift>Tab']\"")
else:
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-applications \"['<Primary>F13','<Primary><Shift>F13','<Alt>Tab']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-applications-backward \"['<Primary>F14','<Primary><Shift>F14','<Alt><Shift>Tab']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings minimize \"['<Super>h','<Alt>F9']\"")
#
# Leaving run dialog disabled for now
# Too slow on appearing, compared to the app menu
#
# if dename != "budgie":
cmdline("gsettings reset org.gnome.desktop.wm.keybindings panel-main-menu")
# cmdline("gsettings set org.gnome.desktop.wm.keybindings panel-main-menu \"['<Primary><Shift>Space','<Primary>Space']\"")
# else:
# cmdline("gsettings set org.gnome.desktop.wm.keybindings panel-main-menu \"['<Alt>F1']\"")
# cmdline("gsettings set org.gnome.desktop.wm.keybindings panel-run-dialog \"['<Primary><Shift>Space','<Primary>Space']\"")
cmdline("gsettings set org.gnome.shell.keybindings toggle-application-view \"['LaunchB']\"")
if dename != "mate":
cmdline("gsettings set org.gnome.mutter overlay-key ''")
if (distro == "ubuntu" and dename == "gnome") or (distro == "ubuntu" and dename == "budgie") or (distro == "linux" and dename == "mate") or (distro == "ubuntu" and dename == "mate"):
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-up \"['<Super>Up','<Super>Left']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-down \"['<Super>Down','<Super>Right']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left ['']")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-right ['']")
cmdline("gsettings set org.gnome.desktop.wm.keybindings minimize \"['<Super>h','<Alt>F9']\"")
cmdline("gsettings reset org.gnome.desktop.wm.keybindings panel-main-menu")
# cmdline("gsettings set org.gnome.desktop.wm.keybindings panel-main-menu \"['<Primary><Shift>Space','<Primary>Space']\"")
elif distro == "pop!_os" and dename == "gnome":
cmdline("gsettings set org.gnome.desktop.wm.keybindings close \"['<Alt>F4','<Super>w']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings toggle-maximized \"['<Alt>F10','<Primary><Super>Up']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings minimize \"['<Super>h','<Alt>F9']\"")
cmdline("gsettings reset org.gnome.desktop.wm.keybindings panel-main-menu")
# cmdline("gsettings set org.gnome.desktop.wm.keybindings panel-main-menu \"['<Primary><Shift>Space','<Primary>Space']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-up \"['<Super>Up','<Super>Left']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-down \"['<Super>Down','<Super>Right']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left ['']")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-right ['']")
elif distro == "elementary" and dename == "gnome":
if(kintotype == 1):
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-applications \"['<Primary>Tools','<Alt>Tab']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-applications-backward \"['<Primary><Shift>Tools','<Alt><Shift>Tab']\"")
else:
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-applications \"['<Primary>F13','<Primary><Shift>F13','<Alt>Tab']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-applications-backward \"['<Primary>F14','<Primary><Shift>F14','<Alt><Shift>Tab']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings show-desktop \"['<Super>d','<Super>Down']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings toggle-maximized \"['<Alt>F10','<Super>Up']\"")
cmdline("gsettings reset org.gnome.desktop.wm.keybindings panel-main-menu")
# cmdline("gsettings set org.gnome.desktop.wm.keybindings panel-main-menu \"['<Control><Shift>Space','<Super>Space']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings minimize \"['<Super>h','<Alt>F9']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings panel-main-menu \"['<Super>Space','<Primary>Space']\"")
if(kintotype == 2):
cmdline('perl -pi -e "s/(\/\/ )(.*)(\/\/ Elementary cmdtab)/\$2\$3/g" ~/.xkb/symbols/mac_term')
cmdline('perl -pi -e "s/(\w.*)(\/\/ Default cmdtab)/\/\/ \$1\$2/g" ~/.xkb/symbols/mac_term')
cmdline('perl -pi -e "s/(\/\/ )(.*)(\/\/ Elementary cmdtab)/\$2\$3/g" ~/.xkb/symbols/mac_gui')
cmdline('perl -pi -e "s/(\w.*)(\/\/ Default cmdtab)/\/\/ \$1\$2/g" ~/.xkb/symbols/mac_gui')
# elif distro == "budgie" and dename == "gnome":
# print("Apply budgie shortcuts here")
elif (dename == "xfce"):
print("Applying xfce shortcuts...")
cmdline('cp ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml ./xfce4-keyboard-shortcuts_`date +"%Y.%m.%d-%s"`.xml')
# Reset Show desktop
cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Primary><Alt>d" --reset')
cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Super>d" --create --type string --set "show_desktop_key"')
# Reset App Cycle
cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Alt>Tab" --reset')
cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Alt><Shift>Tab" --reset')
cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Primary>backslash" --create --type string --set "cycle_windows_key"')
cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Primary><Shift>backslash" --create --type string --set "cycle_reverse_windows_key"')
# cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Super>h" --create --type string --set "hide_window_key"')
# Don't need to undo other maps for menu
# cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/commands/custom/<Primary>space" --create --type string --set "xfce4-popup-whiskermenu"')
# cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/commands/custom/<Primary><Shift>space" --create --type string --set "xfce4-popup-whiskermenu"')
cmdline('xfconf-query --reset --channel xfce4-keyboard-shortcuts --property "/commands/custom/<Primary>space"')
cmdline('xfconf-query --reset --channel xfce4-keyboard-shortcuts --property "/commands/custom/<Primary><Shift>space"')
cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/commands/default/<Primary>Escape" --create --type string --set "xfce4-popup-whiskermenu"')
# Reset move to desktop shortcuts
cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Primary><Alt>Home" --reset')
cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Primary><Alt>End" --reset')
cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Primary><Alt>Left" --reset')
cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Primary><Alt>Right" --reset')
os.system('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Primary><Alt>Left" --create --type string --set "move_window_prev_workspace_key"')
os.system('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Primary><Alt>Right" --create --type string --set "move_window_next_workspace_key"')
# Reset Change Workspace
cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Primary><Alt>Left" --reset')
cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Primary><Alt>Right" --reset')
cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Super>Left" --create --type string --set "left_workspace_key"')
cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Super>Right" --create --type string --set "right_workspace_key"')
print("\nYou may need to run these commands manually to make sure they are set, if you want to move windows between desktops.\n")
print(' xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Primary><Alt>Left" --create --type string --set "move_window_prev_workspace_key"')
print(' xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Primary><Alt>Right" --create --type string --set "move_window_next_workspace_key"\n')
elif distro == "fedora" and dename == "gnome":
cmdline("gsettings set org.gnome.desktop.wm.keybindings show-desktop \"['<Super>d']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-up \"['<Super>Up','<Super>Left']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-down \"['<Super>Down','<Super>Right']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left ['']")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-right ['']")
cmdline("gsettings set org.gnome.desktop.wm.keybindings minimize \"['<Super>h','<Alt>F9']\"")
# cmdline("gsettings set org.gnome.desktop.wm.keybindings panel-main-menu \"['<Primary><Shift>Space','<Primary>Space']\"")
cmdline("gsettings reset org.gnome.desktop.wm.keybindings panel-main-menu")
cmdline("gsettings set org.gnome.mutter.keybindings toggle-tiled-right \"['<Super><Alt>Right']\"")
cmdline("gsettings set org.gnome.mutter.keybindings toggle-tiled-left \"['<Super><Alt>Left']\"")
# org.gnome.mutter.keybindings toggle-tiled-right ['<Super>Right']
# org.gnome.mutter.keybindings toggle-tiled-left ['<Super>Left']
elif dename == "kde":
# cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "krunner.desktop" --key "_launch","Alt+Space\tAlt+F2\tSearch,Alt+Space\tAlt+F2\tSearch,KRunner"')
# Remove Alt+F3 Operations Menu - Sublimetext Select-All
cmdline('cp ~/.config/kwinrc ./kwinrc_`date +"%Y.%m.%d-%s"`')
cmdline('cp ~/.config/kglobalshortcutsrc ./kde_kglobalshortcutsrc_`date +"%Y.%m.%d-%s"`')
cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Switch to Previous Desktop" "Meta+Left,Meta+Left,Switch to Previous Desktop"')
cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Window Operations Menu" "none,Alt+F3,Window Operations Menu"')
if(kintotype == 1):
cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Walk Through Windows" "Ctrl+Tools,Alt+Tab,Walk Through Windows"')
cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Walk Through Windows (Reverse)" "Ctrl+Shift+Tools,Alt+Shift+Backtab,Walk Through Windows (Reverse)"')
cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Walk Through Windows of Current Application" "Alt+F6,none,Walk Through Windows of Current Application"')
cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Walk Through Windows of Current Application (Reverse)" "Alt+Shift+F6,none,Walk Through Windows of Current Application (Reverse)"')
else:
cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Walk Through Windows" "Ctrl+F13,Alt+Tab,Walk Through Windows"')
cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Walk Through Windows (Reverse)" "Ctrl+Shift+F14,Alt+Shift+Backtab,Walk Through Windows (Reverse)"')
cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Walk Through Windows Alternative" "none,none,Walk Through Windows"')
cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Maximize Window" "none,Meta+PgUp,Maximize Window"')
cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Window Maximize" "Meta+Ctrl+F,Alt+F10,Maximize Window"')
cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Minimize Window" "Meta+h,Meta+PgDown,Minimize Window"')
cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Switch to Next Desktop" "Meta+Right,Meta+Right,Switch to Next Desktop"')
os.system('kquitapp5 kglobalaccel && sleep 2s && kglobalaccel5 &')
else:
print('distro: ' + distro + ' de: ' + dename)
print(bcolors.CRED2 + "A supported OS and DE was not found, you may not have full system level shortcuts installed." + bcolors.ENDC)
print(bcolors.CRED2 + "You may want to find your DE or Window Manager settings and manually set Alt-Tab & other OS related shortcuts." + bcolors.ENDC)
if dename == "gnome" or dename == "mate" or dename == "budgie":
# Apply dconf update to make updates survive reboots
cmdline('dconf dump /org/gnome/desktop/wm/keybindings/ > tempkb.conf')
cmdline('dconf dump /org/gnome/mutter/keybindings/ > tempmt.conf')
cmdline('dconf load /org/gnome/desktop/wm/keybindings/ < tempkb.conf')
cmdline('dconf load /org/gnome/mutter/keybindings/ < tempmt.conf')
cmdline('sleep 1 && rm -f ./tempkb.conf;rm -f ./tempmt.conf')
if dename == "budgie":
print('** Make sure to open Keyboard settings & reset "switch applications" to cmd+tab **')
# cmdline('dconf update')
def Uninstall():
print("You selected to Uninstall Kinto.\n")
restore = yn_choice("\nYour DE is " + dename + ".\n\nY: Restore hotkeys from backup\nN: Reset OS/DE hotkeys\nWhich option would you prefer?")
print("")
if(restore):
if dename == "gnome":
print("Restoring DE hotkeys...")
wmkeys = cmdline('ls | grep -m1 "keybinding"')
mutterkeys = cmdline('ls | grep -m1 "mutter_"')
if len(wmkeys) > 0:
print('dconf load /org/gnome/desktop/wm/keybindings/ < ' + wmkeys)
cmdline('dconf load /org/gnome/desktop/wm/keybindings/ < ' + wmkeys)
else:
print('Gnome Desktop keybindings backup not found...')
if len(mutterkeys) > 0:
print('dconf load /org/gnome/mutter/keybindings/ < ' + mutterkeys)
cmdline('dconf load /org/gnome/mutter/keybindings/ < ' + mutterkeys)
if len(wmkeys) > 0 or len(mutterkeys) > 0:
print("Gnome hotkeys have been successfully restored.")
elif dename == "kde":
print("Restoring DE hotkeys...")
kwinkeys = cmdline('ls | grep -m1 "kwinrc"').strip()
kdekeys = cmdline('ls | grep -m1 "kglobalshortcutsrc"').strip()
cmdline('cp ./' + kdekeys + ' ~/.config/kglobalshortcutsrc')
cmdline('cp ./' + kwinkeys + ' ~/.config/kwinrc')
elif dename == "xfce":
print("Restoring DE hotkeys...")
xfcekeys = cmdline('ls | grep -m1 "xfce4-keyboard"').strip()
cmdline('cp ./' + xfcekeys + ' ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml')
if dename == "gnome" or dename == "kde" or dename == "xfce":
print("./uninstall.sh\n")
subprocess.check_call(shlex.split("./uninstall.sh"))
print("Done.")
if dename == "kde" or dename == "xfce":
print("Please log off and back on for your original hotkeys to take effect.")
else:
if dename == "gnome":
print("Resetting DE hotkeys...\n")
print("gsettings reset-recursively org.gnome.desktop.wm.keybindings")
cmdline("gsettings reset-recursively org.gnome.desktop.wm.keybindings")
print("gsettings reset-recursively org.gnome.mutter.keybindings")
cmdline("gsettings reset-recursively org.gnome.mutter.keybindings")
print("gsettings set org.gnome.mutter overlay-key 'super'")
cmdline("gsettings set org.gnome.mutter overlay-key 'super'")
cmdline('dconf dump /org/gnome/mutter/ > mutter.conf')
cmdline('dconf load /org/gnome/mutter/ < mutter.conf')
elif dename == "kde":
print("Resetting DE hotkeys...\n")
cmdline('mv ~/.config/kwinrc ~/.config/kwinrc.kinto')
cmdline('mv ~/.config/kglobalshortcutsrc ~/.config/kglobalshortcutsrc.kinto')
elif dename == "xfce":
print("Resetting DE hotkeys...\n")
cmdline('cp /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml')
if dename == "gnome" or dename == "kde" or dename == "xfce":
print("./uninstall.sh\n")
subprocess.check_call(shlex.split("./uninstall.sh"))
print("Done.")
if dename == "kde" or dename == "xfce":
print("Please log off and back on for your original DE hotkeys to take effect.")
def kintoImpOne():
check_xbind = cmdline("\\which xbindkeys 2>/dev/null").strip()
check_xdotool = cmdline("\\which xdotool 2>/dev/null").strip()
check_ibus = cmdline("\\which ibus-setup 2>/dev/null").strip()
pkgm = cmdline("\\which apt-get 2>/dev/null").strip()
if len(pkgm) == 0:
pkgm = cmdline("\\which dnf 2>/dev/null").strip()
if len(pkgm) > 0:
pkgm += " check-update;sudo dnf install -y "
else:
pkgm += " install -y "
pkgm += " update; sudo apt-get install -y "
if len(pkgm) == 0:
pkgm = cmdline("\\which pacman 2>/dev/null").strip()
if len(pkgm) > 0:
pkgm += " -Syy; sudo pacman -S "
if len(pkgm) == 0:
print("No supported package manager found. Exiting...")
sys.exit()
runpkg = 0
global run_pkg
if len(check_xbind) > 0 and len(check_xdotool) > 0 and len(check_ibus) > 0:
print("Xbindkeys, xdotool and IBus requirement is installed.")
if len(check_xbind) == 0:
run_pkg = "xbindkeys"
runpkg = 1
if len(check_xdotool) == 0:
run_pkg += " xdotool"
runpkg = 1
if len(check_ibus) == 0:
# may differ with distro, but for now
run_pkg += " ibus"
runpkg = 1
if runpkg != 0:
print(runpkg)
requirements(pkgm)
if not os.path.exists(homedir + '/.config/ibus/bus') and cmdline("ls ~/.config/ibus/bus -1rt") == "":
install_ibus()
try:
f = open("defaults.json")
except IOError:
print("defaults.json file is missing. Will exit.\n")
exit()
f.close()
try:
f = open("defaults.json")
except IOError:
print("defaults.json file is missing. Will exit.\n")
exit()
f.close()
try:
f = open("user_config.json")
except IOError:
print("user_config.json file is missing. Will exit.\n")
exit()
f.close()
if os.path.isdir(homedir + "/.config/kinto") == False:
os.mkdir(homedir + "/.config/kinto")
time.sleep(0.5)
with open('defaults.json') as json_file:
data = json.load(json_file)
color_arr = [bcolors.CBEIGE,bcolors.CRED2,bcolors.CGREEN,bcolors.CYELLOW ]
print("\nKinto - Type in Linux like it's a Mac.\n")
kintotype = int(input(color_arr[2] +
"1) Kinto - xkeysnail (udev/x11) - Recommended\n" + color_arr[0] +
"2) Kinto - Original xkb/x11 implementation\n" + color_arr[3] +
"3) Uninstall Kinto - xkeysnail\n" +
"4) Uninstall Kinto - Original xkb\n\n"
+ bcolors.ENDC))
print("")
if(kintotype == 1):
subprocess.check_call(shlex.split("./xkeysnail_service.sh"))
if os.path.isdir(homedir + "/.config/kinto") == True:
setShortcuts()
subprocess.check_call(shlex.split("./xkeysnail_service.sh budgieUpdate"))
exit()
if(kintotype == 3):
subprocess.check_call(shlex.split("./xkeysnail_service.sh uninstall"))
exit()
if(kintotype == 4):
Uninstall()
exit()
kintoImpOne()
for index, item in enumerate(data['defaulttypes']):
ossym = ""
if item == "windows":
ossym = u'\u2756'
elif item == "mac":
ossym = u'\u2318'
elif item == "chromebook":
ossym = u'\u2707'
print("%s %i. %s %s %s" % (color_arr[index], index+1, ossym, item.capitalize(), bcolors.ENDC))
print("%s %i. Uninstall %s" % (color_arr[3], len(data['defaulttypes'])+1, bcolors.ENDC))
default = 0
while not int(default) in range(1,len(data['defaulttypes'])+2):
default = int(input(bcolors.CYELLOW2 + "\nPlease enter your keyboard type (1 - " + str(len(data['defaulttypes'])) + ") : " + bcolors.ENDC))
print("")
if default == len(data['defaulttypes'])+1:
Uninstall()
exit()
try:
f = open(homedir + "/.config/kinto/user_config.json")
rewrite = yn_choice("~/.config/kinto/user_config.json already exists. Do you want to overwrite it with a new config?")
print("")
if(rewrite):
copyfile("user_config.json", homedir + "/.config/kinto/user_config.json")
else:
exit()
except IOError:
pass
copyfile("user_config.json", homedir + "/.config/kinto/user_config.json")
finally:
f.close()
keyboardconfigs = [obj for obj in data['defaults'] if(obj['type'] == data['defaulttypes'][default-1])]
# for k in keyboardconfigs:
for index, k in enumerate(keyboardconfigs):
print(color_arr[default-1] + bcolors.BOLD + str(index+1) + '. ' + k['name'] + bcolors.ENDC)
print(bcolors.CYELLOW2 + 'Description: ' + k['description'] + bcolors.ENDC)
print("")
defaultkb = 0
while not int(defaultkb) in range(1,len(keyboardconfigs)+1):
defaultkb = int(input(bcolors.CYELLOW2 + "Please enter your keyboard config (1 - " + str(len(keyboardconfigs)) + ") : " + bcolors.ENDC))
print("")
if 'hack' in keyboardconfigs[defaultkb-1]:
print(bcolors.CYELLOW2 + "You have selected a keyboard config that needs the following command to be ran.\n" + bcolors.ENDC)
print(keyboardconfigs[defaultkb-1]['hack'].replace(";", "\n") + "\n")
runhack = yn_choice(bcolors.CYELLOW2 + "Would you like to run it now? (Will require sudo privileges. Will exit on No.)" + bcolors.ENDC)
if(runhack):
os.system(keyboardconfigs[defaultkb-1]['hack'])
# Setup the selected keyboards config
os.system("cp -TRv ./.xkb ~/.xkb/")
if os.path.isdir(homedir + "/.xkb/keymap") == False:
os.mkdir(homedir + "/.xkb/keymap")
time.sleep(0.5)
os.system('setxkbmap -option')
os.system('setxkbmap -print > ~/.xkb/keymap/kbd.mac.gui')
os.system('setxkbmap -print > ~/.xkb/keymap/kbd.mac.gui.chrome')
os.system('setxkbmap -print > ~/.xkb/keymap/kbd.mac.gui.browsers')
os.system('setxkbmap -print > ~/.xkb/keymap/kbd.mac.term')
time.sleep(0.5)
symbols_line = cmdline("cat ~/.xkb/keymap/kbd.mac.gui | grep -n 'xkb_symbols' | cut -f1 -d:").strip()
types_line = cmdline("cat ~/.xkb/keymap/kbd.mac.gui | grep -n 'xkb_types' | cut -f1 -d:").strip()
cmdline('sed -i '' -e "' + symbols_line + 's/\\"/' + keyboardconfigs[defaultkb-1]['xkb_symbols_gui'] + '\\"/2" ~/.xkb/keymap/kbd.mac.gui')
cmdline('sed -i '' -e "' + types_line + 's/\\"/' + keyboardconfigs[defaultkb-1]['xkb_types_gui'] + '\\"/2" ~/.xkb/keymap/kbd.mac.gui')
cmdline('sed -i '' -e "' + symbols_line + 's/\\"/' + keyboardconfigs[defaultkb-1]['xkb_symbols_term'] + '\\"/2" ~/.xkb/keymap/kbd.mac.term')
cmdline('sed -i '' -e "' + types_line + 's/\\"/' + keyboardconfigs[defaultkb-1]['xkb_types_term'] + '\\"/2" ~/.xkb/keymap/kbd.mac.term')
# Set chrome file accordingly for chromebooks or normal
if default != 3:
cmdline('sed -i '' -e "' + symbols_line + 's/\\"/' + keyboardconfigs[defaultkb-1]['xkb_symbols_gui'].replace("+mac_gui(mac_levelssym)+mac_gui(mac_appcycle)","+mac_gui(mac_levelssym)+mac_gui(mac_browsers)") + '\\"/2" ~/.xkb/keymap/kbd.mac.gui.browsers')
cmdline('sed -i '' -e "' + symbols_line + 's/\\"/' + keyboardconfigs[defaultkb-1]['xkb_symbols_gui'].replace("+mac_gui(mac_levelssym)+mac_gui(mac_appcycle)","+mac_gui(mac_browsers)+mac_gui(mac_chrome)") + '\\"/2" ~/.xkb/keymap/kbd.mac.gui.chrome')
else:
# Fix multicursor in mac_gui
cmdline('perl -pi -e "s/(\/\/ )(.*)(\/\/ Chromebook multicursor)/\$2\$3/g" ~/.xkb/symbols/mac_gui')
cmdline('perl -pi -e "s/(\w.*)(\/\/ Default multicursor)/\/\/ \$1\$2/g" ~/.xkb/symbols/mac_gui')
# Fix browsers
cmdline('sed -i '' -e "' + symbols_line + 's/\\"/' + keyboardconfigs[defaultkb-1]['xkb_symbols_gui'].replace("+mac_gui(mac_levelssym)+mac_gui(mac_appcycle_chromebook)","+mac_gui(mac_levelssym)+mac_gui(mac_browsers_chromebook)") + '\\"/2" ~/.xkb/keymap/kbd.mac.gui.browsers')
cmdline('sed -i '' -e "' + symbols_line + 's/\\"/' + keyboardconfigs[defaultkb-1]['xkb_symbols_gui'].replace("+mac_gui(mac_levelssym)+mac_gui(mac_appcycle_chromebook)","+mac_gui(mac_browsers_chromebook)+mac_gui(mac_chrome)") + '\\"/2" ~/.xkb/keymap/kbd.mac.gui.chrome')
if dename == "kde":
# Fix maximize shortcut
cmdline('perl -pi -e "s/(\/\/ )(.*)(\/\/ KDE maximize)/\$2\$3/g" ~/.xkb/symbols/mac_gui')
# term app switching
cmdline('perl -pi -e "s/(\/\/ )(.*)(\/\/ KDE cmdtab)/\$2\$3/g" ~/.xkb/symbols/mac_term')
else:
# Fix maximize shortcut
cmdline('perl -pi -e "s/(\/\/ )(.*)(\/\/ Default maximize)/\$2\$3/g" ~/.xkb/symbols/mac_gui')
# term app switching
cmdline('perl -pi -e "s/(\/\/ )(.*)(\/\/ Default cmdtab)/\$2\$3/g" ~/.xkb/symbols/mac_term')
cmdline('sed -i '' -e "' + types_line + 's/\\"/' + keyboardconfigs[defaultkb-1]['xkb_types_gui'] + '\\"/2" ~/.xkb/keymap/kbd.mac.gui.browsers')
cmdline('sed -i '' -e "' + types_line + 's/\\"/' + keyboardconfigs[defaultkb-1]['xkb_types_gui'] + '\\"/2" ~/.xkb/keymap/kbd.mac.gui.chrome')
setShortcuts()
user_file = homedir + '/.config/kinto/user_config.json'
with open(user_file, 'r') as f:
user_config = json.load(f)
onetime = yn_choice("\nOne time initialization tweaks are available. Would you like to view them?")
print("")
if(onetime):
intents = [obj for obj in user_config['de'] if(obj['intent'] == "init")]
for index, k in enumerate(intents):
print(color_arr[default-1] + bcolors.BOLD + str(index+1) + '. ' + k['name'] + bcolors.ENDC)
print(bcolors.CYELLOW2 + 'Description: ' + k['description'] + bcolors.ENDC)
print(bcolors.CYELLOW2 + 'run: ' + k['run'].replace(";", "\n") + bcolors.ENDC + '\n')
print(bcolors.CYELLOW2 + "Please enter your init tweak(s) (eg 1 or 1 2 3 - leave blank to skip): " + bcolors.ENDC)
defaultinit = [int(i) for i in input().split()]
if len(defaultinit) != 0:
user_config['init'] = [intents[defaultinit[0]-1]['id']]
print("\nDynamic shortcut tweaks\n")
intents = [obj for obj in user_config['de'] if(obj['intent'] == "gui_term")]
tweaks = []
tweaks_selected = []
for index, k in enumerate(intents):
print(color_arr[default-1] + bcolors.BOLD + str(index+1) + '. ' + k['name'] + bcolors.ENDC)
print(bcolors.CYELLOW2 + 'Description: ' + k['description'] + bcolors.ENDC)
print(bcolors.CYELLOW2 + 'run in gui mode: ' + k['run_gui'].replace(";", "\n") + bcolors.ENDC)
print(bcolors.CYELLOW2 + 'run in terminal mode: ' + k['run_term'].replace(";", "\n") + bcolors.ENDC + '\n')
tweaks.append(k['id'])
print(bcolors.CYELLOW2 + "Please enter your dynamic shortcut tweak(s) (eg 1 or 1 2 3 - leave blank to skip): " + bcolors.ENDC)
defaultde = [int(i) for i in input().split()]
for d in defaultde:
user_config['de'][tweaks[d-1]]['active'] = True
tweaks_selected.append(tweaks[d-1])
if len(defaultde) != 0:
# gui
user_config['config'][0]['de'] = tweaks_selected
# term
user_config['config'][1]['de'] = tweaks_selected
# firefox
user_config['config'][2]['de'] = tweaks_selected
# chrome
user_config['config'][3]['de'] = tweaks_selected
user_config['config'][0]['run'] = keyboardconfigs[defaultkb-1]['gui']
user_config['config'][1]['run'] = keyboardconfigs[defaultkb-1]['term']
user_config['config'][2]['run'] = keyboardconfigs[defaultkb-1]['gui'].replace("kbd.mac.gui","kbd.mac.gui.browsers")
user_config['config'][3]['run'] = keyboardconfigs[defaultkb-1]['gui'].replace("kbd.mac.gui","kbd.mac.gui.chrome")
os.remove(user_file)
with open(user_file, 'w') as f:
json.dump(user_config, f, indent=4)
print("Saved configuration to ~/.config/kinto/user_config.json\n")
print("Now running keyswap_service.sh to setup the keyswap service...")
print("Keyswap will be configured to run on user login\n")
print("You may start, stop, restart or view the status of the service with following commands\n")
print("systemctl --user start keyswap")
print("systemctl --user stop keyswap")
print("systemctl --user restart keyswap")
print("systemctl --user status keyswap")
os.system("./keyswap_service.sh")

508
kinto_old/xkeysnail_service.sh Executable file
View File

@@ -0,0 +1,508 @@
#!/bin/bash
# set about:config?filter=ui.key.menuAccessKeyFocuses
# to false for wordwise to work in Firefox
typeset -l distro
distro=$(awk -F= '$1=="NAME" { print $2 ;}' /etc/os-release)
typeset -l dename
dename=$(./system-config/dename.sh | cut -d " " -f1)
function uninstall {
while true; do
read -rep $'\nPress R to restore your original shortcuts.\nPress F to reset to factory shortcuts. (f/r)\n' yn
case $yn in
[Ff]* ) yn="f"; break;;
[Rr]* ) yn="r";break;;
* ) echo "Please answer yes or no.";;
esac
done
if [ "$yn" == "f" ];then
echo "Reset to factory shortcuts"
if [ "$dename" == "gnome" ];then
echo "Resetting DE hotkeys..."
echo "gsettings reset-recursively org.gnome.desktop.wm.keybindings"
gsettings reset-recursively org.gnome.desktop.wm.keybindings
echo "gsettings reset-recursively org.gnome.mutter.keybindings"
gsettings reset-recursively org.gnome.mutter.keybindings
echo "gsettings set org.gnome.mutter overlay-key 'super'"
gsettings set org.gnome.mutter overlay-key 'super'
dconf dump /org/gnome/mutter/ > mutter.conf
dconf load /org/gnome/mutter/ < mutter.conf
elif [ "$dename" == "kde" ];then
echo "Resetting DE hotkeys..."
mv ~/.config/kwinrc ~/.config/kwinrc.kinto
mv ~/.config/kglobalshortcutsrc ~/.config/kglobalshortcutsrc.kinto
elif [ "$dename" == "xfce" ];then
echo "Resetting DE hotkeys..."
cp /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml
fi
elif [ "$yn" == "r" ]; then
echo "Restore original user shortcuts"
if [ "$dename" == "gnome" ]; then
echo "Restoring DE hotkeys..."
wmkeys=$(ls | grep -m1 "keybinding")
mutterkeys=$(ls | grep -m1 "mutter_")
if [[ ${#wmkeys} > 0 ]]; then
echo "dconf load /org/gnome/desktop/wm/keybindings/ < $wmkeys"
dconf load /org/gnome/desktop/wm/keybindings/ < "$wmkeys"
else
echo "Gnome Desktop keybindings backup not found..."
fi
if [[ ${#mutterkeys} > 0 ]]; then
echo "dconf load /org/gnome/mutter/keybindings/ < $mutterkeys"
dconf load /org/gnome/mutter/keybindings/ <"$mutterkeys"
fi
if [[ ${#wmkeys} > 0 ]] || [[ ${#mutterkeys} > 0 ]]; then
echo "Gnome hotkeys have been successfully restored."
fi
elif [ "$dename" == "kde" ]; then
echo "Restoring DE hotkeys..."
kwinkeys=$(ls | grep -m1 "kwinrc")
kdekeys=$(ls | grep -m1 "kglobalshortcutsrc")
cp ./"$kdekeys" ~/.config/kglobalshortcutsrc
cp ./"$kwinkeys" ~/.config/kwinrc
elif [ "$dename" == "xfce" ]; then
echo "Restoring DE hotkeys..."
xfcekeys=$(ls | grep -m1 "xfce4-keyboard")
cp ./"$xfcekeys" ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml
fi
fi
}
function removeAppleKB {
# Undo Apple keyboard cmd & alt swap
if test -f "/sys/module/hid_apple/parameters/swap_opt_cmd" && [ `cat /sys/module/hid_apple/parameters/swap_opt_cmd` == "1" ]; then
echo '0' | sudo tee /sys/module/hid_apple/parameters/swap_opt_cmd
echo 'options hid_apple swap_opt_cmd=0' | sudo tee /etc/modprobe.d/hid_apple.conf
sudo update-initramfs -u -k all
fi
if test -f "/sys/module/applespi/parameters/swap_opt_cmd" && [ `cat /sys/module/applespi/parameters/swap_opt_cmd` == "1" ]; then
echo '0' | sudo tee /sys/module/applespi/parameters/swap_opt_cmd
echo 'options applespi swap_opt_cmd=0' | sudo tee /etc/modprobe.d/applespi.conf
sudo update-initramfs -u -k all
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."
sudo /usr/local/bin/logoff.sh $USER $DISPLAY&
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 {
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..."
bdmd5="$(md5sum /usr/bin/budgie-daemon | awk '{ print $1 }')"
oldbdmd5=$(md5sum ./budgie-daemon_10.5.1.bak | awk '{ print $1 }')
if [ "$bdmd5" != "$oldbdmd5" ]; then
echo -e "\nReplacing budgie-daemon with backup..."
sudo pkill budgie-daemon && sudo cp ./budgie-daemon_10.5.1.bak /usr/bin/budgie-daemon
else
echo -e "\nBudgie-daemon is already an original."
fi
fi
}
function budgieUpdate {
# Check for budgie and install App Switching hack
if [ -f /usr/bin/budgie-desktop ];then
while true; do
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
[Yy]* ) yn="y"; break;;
[Nn]* ) yn="n";break;;
* ) echo "Please answer yes or no.";;
esac
done
if [ "$yn" == "y" ]; then
budgieVersion="$(/usr/bin/budgie-desktop --version | awk '{ print $2; }' | head -n1)"
if [ "$budgieVersion" == "10.5.1" ]; then
if ! [ -f ./system-config/budgie-daemon_10.5.1 ]; then
wget https://github.com/rbreaves/budgie-desktop/blob/binaries/binaries/budgie-daemon_10.5.1?raw=true -O ./system-config/budgie-daemon_10.5.1
fi
bdmd5=$(md5sum /usr/bin/budgie-daemon | awk '{ print $1 }')
newbdmd5=$(md5sum ./system-config/budgie-daemon_10.5.1 | awk '{ print $1 }')
if [ "$bdmd5" != "$newbdmd5" ]; then
cp /usr/bin/budgie-daemon ./budgie-daemon_"$budgieVersion".bak
sudo pkill budgie-daemon && sudo cp ./system-config/budgie-daemon_10.5.1 /usr/bin/budgie-daemon
echo "Updated Budgie to use App Switching Patch"
else
echo "Budgie-daemon already patched, skipping replacement."
fi
else
echo "Your Budgie version was $budgieVersion and the patch is for 10.5.1."
while true; do
read -rep $'Would you like to replace it any ways? (y/n)\n(A backup will be made)\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
if ! [ -f ./system-config/budgie-daemon_10.5.1 ]; then
wget https://github.com/rbreaves/budgie-desktop/raw/43d3b44243b0bcaee3262a79818024a651475b58/binaries/budgie-daemon_10.5.1 -O ./system-config/budgie-daemon_10.5.1
fi
cp /usr/bin/budgie-daemon ./budgie-daemon_"$budgieVersion".bak
sudo pkill budgie-daemon && sudo cp ./system-config/budgie-daemon_10.5.1 /usr/bin/budgie-daemon
echo "Updated Budgie to use App Switching Patch"
fi
fi
fi
fi
}
if [ $# -eq 0 ]; then
echo "Install Kinto - xkeysnail (udev)"
echo " 1) Windows & Mac (HID driver) - Most Standard keyboards (& 1st party usb/bt Apple keyboards)"
echo " 2) Mac Only & VMs on Macbooks - 3rd & 1st party Apple keyboards"
echo " 3) Chromebook - Chromebook running Linux"
echo " 4) IBM M - Keyboards w/o Super/Win keys"
# echo " 5) Uninstall"
read n
set "$n"
fi
# Kinto tray
installtray=false
# multi-language
rightalt=false
# VS code remap
vssublime=false
if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "4" || $1 == "winmac" || $1 == "mac" || $1 == "chromebook" || $1 == "ibm" ]]; then
if [[ $dename == "gnome" || $dename == "budgie" || $dename == "mate" || $dename == "xfce" ]];then
installtray=true
while true; do
read -rep $'\nWould you like to install the Kinto System Tray (AppInidcator)? (Y/n)\n' yn
case $yn in
[Nn]* ) installtray=false; break;;
* ) break;;
esac
done
if [[ $dename == "gnome" ]]; then
echo "Please install KStatusNotifierItem for AppIndicators to show up."
echo "https://extensions.gnome.org/extension/615/appindicator-support/"
echo "Note: This may still fail. If so use the Kinto gui app instead."
read -p "Press enter to continue"
fi
fi
while true; do
read -rep $'\nDo you want multi-language on Right Alt key? (y/N)\naka Left side remaps, right side doesn\'t\n' yn
case $yn in
[Yy]* ) rightalt=true; break;;
* ) break;;
esac
done
while true; do
read -rep $'\nWould you like to give VS Code Sublime Text keymaps? (y/N)\n' yn
case $yn in
[Yy]* ) vssublime=true; break;;
* ) break;;
esac
done
# branch=$(git rev-parse --abbrev-ref HEAD)
# if [ "$branch" == "dev" ] || [ "$branch" == "alpha" ];then
# while true; do
# read -rep $'\nExperimental Support for Firefox/Chrome Back/Forward hotkeys (Cmd+Left/Right)?\n(Keys could get stuck, switch windows or press ctrl &/or super to release) (y/n)\n' yn
# case $yn in
# [Yy]* ) exp='/sbin/runuser -l {username} -c "export DISPLAY={displayid};{homedir}/.config/kinto/caret_status_xkey.sh\&";'; expsh='"{homedir}/.config/kinto/caret_status_xkey.sh"'; break;;
# [Nn]* ) exp=" "; expsh=" " break;;
# # * ) echo "Please answer yes or no.";;
# esac
# done
# else
# echo -e "\nSupport for Firefox/Chrome Back/Forward hotkeys (Cmd+Left/Right) disabled on $branch w/ xkeysnail \n"
exp=" "
expsh=" "
# fi
sudo systemctl enable xkeysnail >/dev/null 2>&1
# 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
if ! [ -x "$(command -v pip3)" ]; then
echo "Will need to install python3-pip..."
sudo ./system-config/unipkg.sh python3-pip
fi
if ! [ -x "$(command -v python3-config)" ]; then
if [ "$distro" == "ubuntu" ] || [ "$distro" == "debian" ] || [ "$distro" == '"linux mint"' ]; then
pydev="python3-dev"
elif [ "$distro" == "fedora" ]; then
pydev="python3-devel"
fi
if [ "$distro" == "gnome" ] || [ "$distro" == "fedora" ] || [ "$distro" == "debian" ] || [ "$distro" == '"linux mint"' ]; then
echo "Will need to install $pydev..."
sudo ./system-config/unipkg.sh "$pydev"
fi
fi
if ! [ -x "$(command -v xhost)" ] || ! [ -x "$(command -v gcc)" ]; then
if [ "$distro" == "\"manjaro linux\"" ]; then
sudo ./system-config/unipkg.sh "xorg-xhost gcc"
fi
fi
if [ "$distro" == '"linux mint"' ]; then
pip3 install setuptools
fi
# echo "Transferring files..."
mkdir -p ~/.config/kinto
# KDE xhost fix
# mkdir -p ~/.kde/Autostart
# echo -e '#!/bin/sh\rxhost +SI:localuser:root' > ~/.kde/Autostart/kintohost.sh
# chmod +x ~/.kde/Autostart/kintohost.sh
# KDE startup - xhost fix
mkdir -p ~/.config/autostart
yes | cp -rf ./xkeysnail-config/xkeysnail.desktop ~/.config/autostart/xkeysnail.desktop
# yes | cp -rf ./xkeysnail-config/xkeystart.sh ~/.config/kinto/xkeystart.sh
# *** More testing needing, universal way of killing kinto on user log out? ***
# yes | sudo cp -rf xkeysnail-config/root_logoff.sh /usr/local/bin/logoff.sh
# sudo chown root:root /usr/local/bin/logoff.sh
# sudo chmod u+rwx /usr/local/bin/logoff.sh
# sudo chmod go-w+rx /usr/local/bin/logoff.sh
# *** End universal killing of kinto
if $installtray ; then
yes | sudo cp -rf xkeysnail-config/gnome_logoff.sh ~/.config/kinto/logoff.sh
fi
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/killdups.sh ~/.config/kinto/killdups.sh
yes | cp -rf ./xkeysnail-config/appleKB.sh ~/.config/kinto/appleKB.sh
yes | cp -rf ./xkeysnail-config/trayapps/appindicator/kintotray.py ~/.config/kinto/kintotray.py
yes | cp -rf ./xkeysnail-config/trayapps/appindicator/kintotray.desktop ~/.config/kinto/kintotray.desktop
yes | cp -rf ./xkeysnail-config/trayapps/BudgieApplet/icons/kinto-color-16.svg ~/.config/kinto/kinto-color.svg
yes | cp -rf ./xkeysnail-config/trayapps/BudgieApplet/icons/kinto-invert-16.svg ~/.config/kinto/kinto-invert.svg
yes | cp -rf ./xkeysnail-config/trayapps/BudgieApplet/icons/kinto-solid-16.svg ~/.config/kinto/kinto-solid.svg
# 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.timer ~/.config/systemd/user/xkeysnail.timer
sed -i "s#{experimental-caret}#$exp#g" ./xkeysnail-config/xkeysnail.service.new
if [ "$expsh" != " " ];then
sed -i "s#{kill-caret}#/usr/bin/pkill -f $expsh#g" ./xkeysnail-config/xkeysnail.service.new
else
sed -i "s#{kill-caret}#$expsh#g" ./xkeysnail-config/xkeysnail.service.new
fi
sed -i "s/{username}/`whoami`/g" ./xkeysnail-config/xkeysnail.service.new
sed -i "s#{homedir}#`echo "$HOME"`#g" ./xkeysnail-config/xkeysnail.service.new
sed -i "s#{homedir}#`echo "$HOME"`#g" ~/.config/kinto/kintotray.desktop
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#{systemctl}#`\\which systemctl`#g" ./xkeysnail-config/limitedadmins.new
sed -i "s#{pkill}#`\\which pkill`#g" ./xkeysnail-config/limitedadmins.new
sed -i "s#{xkeysnail}#/usr/local/bin/xkeysnail#g" ./xkeysnail-config/limitedadmins.new
sudo chown root:root ./xkeysnail-config/limitedadmins.new
sudo mv ./xkeysnail-config/limitedadmins.new /etc/sudoers.d/limitedadmins
sed -i "s#{systemctl}#`\\which systemctl`#g" ~/.config/autostart/xkeysnail.desktop
yes | cp -rf ~/.config/kinto/kintotray.desktop ~/.config/autostart/kintotray.desktop
if $installtray ; then
sed -i "s#-c \"grep#-c \"python3 {homedir}/.config/kinto/kintotray.py;grep#g" ~/.config/autostart/xkeysnail.desktop
sed -i "s#xkeysnail\"#xkeysnail;{homedir}/.config/kinto/logoff.sh\"#g" ~/.config/autostart/xkeysnail.desktop
fi
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/kinto/prexk.sh
sed -i "s/{displayid}/`echo "$DISPLAY"`/g" ./xkeysnail-config/xkeysnail.service.new
# sed -i "s/{displayid}/`echo "$DISPLAY"`/g" ~/.config/kinto/prexk.sh
if $vssublime ; then
perl -pi -e "s/(# )(.*)(- Sublime)/\$2\$3/g" ./xkeysnail-config/kinto.py.new >/dev/null 2>&1
fi
fi
if [[ $dename == "gnome" || dename == "budgie" ]]; then
perl -pi -e "s/(# )(.*)(# gnome)/\$2\$3/g" ./xkeysnail-config/kinto.py.new >/dev/null 2>&1
fi
if [[ $dename == "kde" ]]; then
echo "Applying Cmd-Space to open App Launcher for KDE..."
perl -pi -e "s/(# )(.*)(#.*kde)/\$2\$3/g" ./xkeysnail-config/kinto.py.new >/dev/null 2>&1
fi
if [[ $1 == "1" || $1 == "winmac" ]]; then
if ls /sys/module | grep hid_apple >/dev/null 2>&1 ; then
echo '1' | sudo tee /sys/module/hid_apple/parameters/swap_opt_cmd;echo 'options hid_apple swap_opt_cmd=1' | sudo tee /etc/modprobe.d/hid_apple.conf;sudo update-initramfs -u -k all
fi
if ls /sys/module | grep applespi >/dev/null 2>&1 ; then
echo '1' | sudo tee /sys/module/applespi/parameters/swap_opt_cmd;echo 'options applespi swap_opt_cmd=1' | sudo tee /etc/modprobe.d/applespi.conf;sudo update-initramfs -u -k all
fi
if ! ls /sys/module | grep apple ; then
removeAppleKB
fi
perl -pi -e "s/(# )(.*)(# WinMac)/\$2\$3/g" ./xkeysnail-config/kinto.py.new
if [[ $dename == "xfce" ]]; then
perl -pi -e "s/(# )(.*)(# xfce4)/\$2\$3/g" ./xkeysnail-config/kinto.py.new
perl -pi -e "s/(\w.*)(# Default not-xfce4)/# \$1\$2/g" ./xkeysnail-config/kinto.py.new
fi
elif [[ $1 == "2" || $1 == "mac" ]]; then
removeAppleKB
perl -pi -e "s/(# )(.*)(# Mac)/\$2\$3/g" ./xkeysnail-config/kinto.py.new
if [[ $dename == "xfce" ]]; then
perl -pi -e "s/(# )(.*)(# xfce4)/\$2\$3/g" ./xkeysnail-config/kinto.py.new
perl -pi -e "s/(\w.*)(# Default not-xfce4)/# \$1\$2/g" ./xkeysnail-config/kinto.py.new
fi
elif [[ $1 == "3" || $1 == "chromebook" ]]; then
perl -pi -e "s/(# )(.*)(# Chromebook)/\$2\$3/g" ./xkeysnail-config/kinto.py.new
perl -pi -e "s/(# )(.*)(# xfce4)/\$2\$3/g" ./xkeysnail-config/kinto.py.new
perl -pi -e "s/(\w.*)(# Default)/# \$1\$2/g" ./xkeysnail-config/kinto.py.new
elif [[ $1 == "4" || $1 == "ibm" ]]; then
perl -pi -e "s/(# )(.*)(# IBM)/\$2\$3/g" ./xkeysnail-config/kinto.py.new
perl -pi -e "s=(# )(.*)(# Chromebook/IBM)=\$2\$3=g" ./xkeysnail-config/kinto.py.new
# perl -pi -e "s/(# )(.*)(# xfce4)/\$2\$3/g" ./xkeysnail-config/kinto.py.new
perl -pi -e "s/(\w.*)(# Default)/# \$1\$2/g" ./xkeysnail-config/kinto.py.new
fi
if [[ $dename == "xfce" ]] && ls /etc/apt/sources.list.d/enso* 1> /dev/null 2>&1; then
echo "enso OS detected, applying Cmd-Space for Launchy..."
perl -pi -e "s/(K\(\"RC-Space)(.*)(# )(xfce4)/\$3\$1\$2\$3\$4/g" ./xkeysnail-config/kinto.py.new >/dev/null 2>&1
xfconf-query --channel xfce4-keyboard-shortcuts --property "/commands/custom/<Primary>space" --create --type string --set "launchy"
fi
if $rightalt ; then
perl -pi -e "s/(\w.*)(Multi-language)/# \$1\$2/g" ./xkeysnail-config/kinto.py.new >/dev/null 2>&1
fi
if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1 == "chromebook" ]]; then
mv ./xkeysnail-config/kinto.py.new ~/.config/kinto/kinto.py
git describe --tags | perl -ne "print \"\$1 build `git rev-parse --short HEAD`\n\" for m/\b(.*)-\w+-\w{8}/" > ~/.config/kinto/version
# if [ "$distro" == "fedora" ];then
sudo rm /etc/systemd/system/xkeysnail.service
if [ -d /usr/lib/systemd/system ];then
xkeypath="/usr/lib/systemd/system/"
elif [ -d /lib/systemd/system ];then
xkeypath="/lib/systemd/system/"
fi
sudo mv ./xkeysnail-config/xkeysnail.service.new "$xkeypath"xkeysnail.service && echo "Service file added to "$xkeypath"xkeysnail.service"
sudo chown -R root:root "$xkeypath"xkeysnail.service && echo "Ownership set for root..." || echo "Failed to set ownership..."
sudo chmod 644 "$xkeypath"xkeysnail.service && echo "Permissions set to 644..." || echo "Failed to set permissions..."
sudo ln -s "$xkeypath"xkeysnail.service /etc/systemd/system/xkeysnail.service && echo "Created soft symlink..." || echo "Failed to create soft symlink..."
sudo ln -s "$xkeypath"xkeysnail.service /etc/systemd/system/graphical.target.wants/xkeysnail.service && echo "Created soft symlink for graphical target..." || echo "Failed to create soft symlink for graphical target..."
xhost +SI:localuser:root
git clone --depth 10 https://github.com/rbreaves/xkeysnail.git || git pull --depth 10
cd xkeysnail
git checkout 51c369084e0045a8410d227bab52411bf84fb65b
giturl=$(git ls-remote --get-url)
if [ "$giturl" != "https://github.com/rbreaves/xkeysnail.git" ];then
echo -e "\nreplacing xkeysnail with fork...\n"
cd ..
rm -rf ./xkeysnail
git clone --depth 10 https://github.com/rbreaves/xkeysnail.git
cd xkeysnail
git checkout 51c369084e0045a8410d227bab52411bf84fb65b
fi
sudo pip3 install --upgrade .
cd ..
sudo systemctl daemon-reload
sudo systemctl disable xkeysnail
# sudo systemctl --state=not-found --all | grep xkeysnail
# if [ "$distro" == "fedora" ];then
# systemctl enable xkeysnail.service
# else
# sudo systemctl enable xkeysnail.service
# fi
sudo systemctl restart xkeysnail
sudo pkill -f kintotray >/dev/null 2>&1
nohup python3 ~/.config/kinto/kintotray.py& >/dev/null 2>&1
echo -e "Adding xhost fix...\n"
LINE='xhost +SI:localuser:root'
if [ ! -e "~/.xprofile" ]; then
# Ubuntu xhost fix
echo "$LINE" > ~/.xprofile
# echo "$LINE" > ~/.xinitrc
fi
# Ubuntu xhost fix
grep -qF -- "$LINE" ~/.xprofile || echo "$LINE" >> ~/.xprofile
# KDE xhost fix
# grep -qF -- "$LINE" ~/.bashrc || echo "$LINE" >> ~/.bashrc
# grep -qF -- "$LINE" ~/.xinitrc || echo "$LINE" >> ~/.xinitrc
# remove kintox11 login startup
if test -f "~/.config/autostart/kinto.desktop"; then
rm ~/.config/autostart/kinto.desktop
fi
echo -e "Kinto install is \e[1m\e[32mcomplete\e[0m.\n"
if `sudo systemctl is-active --quiet xkeysnail`;then
echo -e "Kinto \e[1m\e[32mxkeysnail service is running\e[0m.\n"
echo "Commands for controlling Kinto's xkeysnail service"
echo "sudo systemctl restart xkeysnail"
echo "sudo systemctl stop xkeysnail"
echo "sudo systemctl start xkeysnail"
echo "sudo systemctl status xkeysnail"
else
echo -e "Kinto \e[1m\e[91mxkeysnail service has failed.\e[0m"
echo "You can run 'sudo systemctl status xkeysnail' for more info"
echo "You can also run 'sudo journalctl -u xkeysnail'"
fi
echo ""
if $vssublime ; then
echo -e "\e[1m\e[32mEnabled\e[0m VS Code Sublime Text remap."
fi
if $rightalt ; then
echo -e "\e[1m\e[32mEnabled\e[0m mutli-language support."
fi
# trayApp
elif [[ $1 == "5" || $1 == "uninstall" || $1 == "Uninstall" ]]; then
echo "Uninstalling Kinto - xkeysnail (udev)"
uninstall
removeAppleKB
pkill -f kintotray >/dev/null 2>&1
sudo systemctl stop xkeysnail >/dev/null 2>&1
sudo systemctl disable xkeysnail >/dev/null 2>&1
sudo rm /etc/sudoers.d/limitedadmins
rm ~/.config/autostart/xkeysnail.desktop
rm -rf ~/.config/kinto
sudo rm /etc/systemd/system/xkeysnail.service >/dev/null 2>&1
sudo rm /etc/systemd/system/graphical.target.wants/xkeysnail.service >/dev/null 2>&1
sudo rm /usr/lib/systemd/system/xkeysnail.service >/dev/null 2>&1
if [ -f /usr/local/bin/logoff.sh ];then
sudo rm /usr/local/bin/logoff.sh
fi
sudo systemctl daemon-reload
sudo systemctl --state=not-found --all | grep xkeysnail
budgieUninstall
exit 0
elif [[ $1 == "budgieUpdate" ]]; then
budgieUpdate
else
echo "Expected argument was not provided"
fi

529
setup.py
View File

@@ -1,9 +1,16 @@
#!/usr/bin/env python3
import json, time, os, sys, subprocess, shlex, platform
import json, time, os, sys, subprocess, shlex, platform,argparse
from shutil import copyfile
from subprocess import PIPE, Popen
from prekinto import *
parser = argparse.ArgumentParser()
parser.add_argument('-r', dest='uninstall', action='store_true', help="uninstall kinto")
parser.add_argument('--remove', dest='uninstall', action='store_true', help="uninstall kinto")
args = parser.parse_args()
homedir = os.path.expanduser("~")
kintotype = 0
@@ -110,522 +117,32 @@ dename = cmdline("./system-config/dename.sh").replace('"','').strip().split(" ")
run_pkg = ""
def requirements(pkgm):
print(bcolors.CYELLOW2 + "You need to install some packages, " +run_pkg+ ", for Kinto to fully remap browsers during input focus.\n" + bcolors.ENDC)
print("sudo " + pkgm + " " + run_pkg + "\n")
run_install = yn_choice(bcolors.CYELLOW2 + "Would you like to run it now? (Will require sudo privileges.)\n" + bcolors.ENDC)
if(run_install):
os.system("sudo " + pkgm + run_pkg)
print("\n")
def install_ibus():
global distro
print(bcolors.CYELLOW2 + "You need to set IBus as the default Input Method for full word-wise support and re-run this installer.\n" + bcolors.ENDC)
print(bcolors.CYELLOW2 + "Confirm the IBus Setup by saying Yes and then closing the window.\n" + bcolors.ENDC)
print("ibus-setup\n")
print("im-config -n ibus or im-chooser\n")
run_install = yn_choice(bcolors.CYELLOW2 + "Would you like to run it now? (Will require logoff and logon.)\n" + bcolors.ENDC)
if(run_install):
if distro=="fedora":
os.system("ibus-setup")
os.system("im-chooser")
print("\n")
print("IBus needs to have Input Method set to your language.")
print("im-chooser needs IBus to be selected & closed.")
input("Will need to log off and back on for it take effect...")
else:
os.system("ibus-setup")
os.system("im-config -n ibus")
print("\n")
input("IBus has been set as the default Input Method.\nPress any key to exit and re-run after logoff & logon...")
sys.exit()
def setShortcuts():
global distro
distroVersion = cmdline("awk -F= '$1==\"VERSION_ID\" { print $2 ;}' /etc/os-release").replace('"','').strip()
print("\nIf Kinto is already running it will be stopped...")
print("If you cancel the installer you can re-run Kinto via\n systemctl --user start keyswap")
cmdline("systemctl --user stop keyswap")
print("\nDetected " + distro + " " + distroVersion.strip() + " DE: " + dename + "\n")
addhotkeys = yn_choice("\nDo you want to apply system level shortcuts?")
if(addhotkeys):
distro = distro.lower()
if dename == "gnome" or dename == "mate" or dename == "budgie":
cmdline('dconf dump /org/gnome/desktop/wm/keybindings/ > keybindings_`date +"%Y.%m.%d-%s"`.conf')
cmdline('dconf dump /org/gnome/mutter/keybindings/ > mutter_`date +"%Y.%m.%d-%s"`.conf')
if(kintotype == 1):
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-applications \"['<Primary>Tools','<Alt>Tab']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-applications-backward \"['<Primary><Shift>Tools','<Alt><Shift>Tab']\"")
else:
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-applications \"['<Primary>F13','<Primary><Shift>F13','<Alt>Tab']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-applications-backward \"['<Primary>F14','<Primary><Shift>F14','<Alt><Shift>Tab']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings minimize \"['<Super>h','<Alt>F9']\"")
#
# Leaving run dialog disabled for now
# Too slow on appearing, compared to the app menu
#
# if dename != "budgie":
cmdline("gsettings reset org.gnome.desktop.wm.keybindings panel-main-menu")
# cmdline("gsettings set org.gnome.desktop.wm.keybindings panel-main-menu \"['<Primary><Shift>Space','<Primary>Space']\"")
# else:
# cmdline("gsettings set org.gnome.desktop.wm.keybindings panel-main-menu \"['<Alt>F1']\"")
# cmdline("gsettings set org.gnome.desktop.wm.keybindings panel-run-dialog \"['<Primary><Shift>Space','<Primary>Space']\"")
cmdline("gsettings set org.gnome.shell.keybindings toggle-application-view \"['LaunchB']\"")
if dename != "mate":
cmdline("gsettings set org.gnome.mutter overlay-key ''")
if (distro == "ubuntu" and dename == "gnome") or (distro == "ubuntu" and dename == "budgie") or (distro == "linux" and dename == "mate") or (distro == "ubuntu" and dename == "mate"):
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-up \"['<Super>Up','<Super>Left']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-down \"['<Super>Down','<Super>Right']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left ['']")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-right ['']")
cmdline("gsettings set org.gnome.desktop.wm.keybindings minimize \"['<Super>h','<Alt>F9']\"")
cmdline("gsettings reset org.gnome.desktop.wm.keybindings panel-main-menu")
# cmdline("gsettings set org.gnome.desktop.wm.keybindings panel-main-menu \"['<Primary><Shift>Space','<Primary>Space']\"")
elif distro == "pop!_os" and dename == "gnome":
cmdline("gsettings set org.gnome.desktop.wm.keybindings close \"['<Alt>F4','<Super>w']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings toggle-maximized \"['<Alt>F10','<Primary><Super>Up']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings minimize \"['<Super>h','<Alt>F9']\"")
cmdline("gsettings reset org.gnome.desktop.wm.keybindings panel-main-menu")
# cmdline("gsettings set org.gnome.desktop.wm.keybindings panel-main-menu \"['<Primary><Shift>Space','<Primary>Space']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-up \"['<Super>Up','<Super>Left']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-down \"['<Super>Down','<Super>Right']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left ['']")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-right ['']")
elif distro == "elementary" and dename == "gnome":
if(kintotype == 1):
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-applications \"['<Primary>Tools','<Alt>Tab']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-applications-backward \"['<Primary><Shift>Tools','<Alt><Shift>Tab']\"")
else:
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-applications \"['<Primary>F13','<Primary><Shift>F13','<Alt>Tab']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-applications-backward \"['<Primary>F14','<Primary><Shift>F14','<Alt><Shift>Tab']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings show-desktop \"['<Super>d','<Super>Down']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings toggle-maximized \"['<Alt>F10','<Super>Up']\"")
cmdline("gsettings reset org.gnome.desktop.wm.keybindings panel-main-menu")
# cmdline("gsettings set org.gnome.desktop.wm.keybindings panel-main-menu \"['<Control><Shift>Space','<Super>Space']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings minimize \"['<Super>h','<Alt>F9']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings panel-main-menu \"['<Super>Space','<Primary>Space']\"")
if(kintotype == 2):
cmdline('perl -pi -e "s/(\/\/ )(.*)(\/\/ Elementary cmdtab)/\$2\$3/g" ~/.xkb/symbols/mac_term')
cmdline('perl -pi -e "s/(\w.*)(\/\/ Default cmdtab)/\/\/ \$1\$2/g" ~/.xkb/symbols/mac_term')
cmdline('perl -pi -e "s/(\/\/ )(.*)(\/\/ Elementary cmdtab)/\$2\$3/g" ~/.xkb/symbols/mac_gui')
cmdline('perl -pi -e "s/(\w.*)(\/\/ Default cmdtab)/\/\/ \$1\$2/g" ~/.xkb/symbols/mac_gui')
# elif distro == "budgie" and dename == "gnome":
# print("Apply budgie shortcuts here")
elif (dename == "xfce"):
print("Applying xfce shortcuts...")
cmdline('cp ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml ./xfce4-keyboard-shortcuts_`date +"%Y.%m.%d-%s"`.xml')
# Reset Show desktop
cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Primary><Alt>d" --reset')
cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Super>d" --create --type string --set "show_desktop_key"')
# Reset App Cycle
cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Alt>Tab" --reset')
cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Alt><Shift>Tab" --reset')
cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Primary>backslash" --create --type string --set "cycle_windows_key"')
cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Primary><Shift>backslash" --create --type string --set "cycle_reverse_windows_key"')
# cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Super>h" --create --type string --set "hide_window_key"')
# Don't need to undo other maps for menu
# cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/commands/custom/<Primary>space" --create --type string --set "xfce4-popup-whiskermenu"')
# cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/commands/custom/<Primary><Shift>space" --create --type string --set "xfce4-popup-whiskermenu"')
cmdline('xfconf-query --reset --channel xfce4-keyboard-shortcuts --property "/commands/custom/<Primary>space"')
cmdline('xfconf-query --reset --channel xfce4-keyboard-shortcuts --property "/commands/custom/<Primary><Shift>space"')
cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/commands/default/<Primary>Escape" --create --type string --set "xfce4-popup-whiskermenu"')
# Reset move to desktop shortcuts
cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Primary><Alt>Home" --reset')
cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Primary><Alt>End" --reset')
cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Primary><Alt>Left" --reset')
cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Primary><Alt>Right" --reset')
os.system('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Primary><Alt>Left" --create --type string --set "move_window_prev_workspace_key"')
os.system('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Primary><Alt>Right" --create --type string --set "move_window_next_workspace_key"')
# Reset Change Workspace
cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Primary><Alt>Left" --reset')
cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Primary><Alt>Right" --reset')
cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Super>Left" --create --type string --set "left_workspace_key"')
cmdline('xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Super>Right" --create --type string --set "right_workspace_key"')
print("\nYou may need to run these commands manually to make sure they are set, if you want to move windows between desktops.\n")
print(' xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Primary><Alt>Left" --create --type string --set "move_window_prev_workspace_key"')
print(' xfconf-query --channel xfce4-keyboard-shortcuts --property "/xfwm4/custom/<Primary><Alt>Right" --create --type string --set "move_window_next_workspace_key"\n')
elif distro == "fedora" and dename == "gnome":
cmdline("gsettings set org.gnome.desktop.wm.keybindings show-desktop \"['<Super>d']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-up \"['<Super>Up','<Super>Left']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-down \"['<Super>Down','<Super>Right']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left ['']")
cmdline("gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-right ['']")
cmdline("gsettings set org.gnome.desktop.wm.keybindings minimize \"['<Super>h','<Alt>F9']\"")
# cmdline("gsettings set org.gnome.desktop.wm.keybindings panel-main-menu \"['<Primary><Shift>Space','<Primary>Space']\"")
cmdline("gsettings reset org.gnome.desktop.wm.keybindings panel-main-menu")
cmdline("gsettings set org.gnome.mutter.keybindings toggle-tiled-right \"['<Super><Alt>Right']\"")
cmdline("gsettings set org.gnome.mutter.keybindings toggle-tiled-left \"['<Super><Alt>Left']\"")
# org.gnome.mutter.keybindings toggle-tiled-right ['<Super>Right']
# org.gnome.mutter.keybindings toggle-tiled-left ['<Super>Left']
elif dename == "kde":
# cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "krunner.desktop" --key "_launch","Alt+Space\tAlt+F2\tSearch,Alt+Space\tAlt+F2\tSearch,KRunner"')
# Remove Alt+F3 Operations Menu - Sublimetext Select-All
cmdline('cp ~/.config/kwinrc ./kwinrc_`date +"%Y.%m.%d-%s"`')
cmdline('cp ~/.config/kglobalshortcutsrc ./kde_kglobalshortcutsrc_`date +"%Y.%m.%d-%s"`')
cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Switch to Previous Desktop" "Meta+Left,Meta+Left,Switch to Previous Desktop"')
cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Window Operations Menu" "none,Alt+F3,Window Operations Menu"')
if(kintotype == 1):
cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Walk Through Windows" "Ctrl+Tools,Alt+Tab,Walk Through Windows"')
cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Walk Through Windows (Reverse)" "Ctrl+Shift+Tools,Alt+Shift+Backtab,Walk Through Windows (Reverse)"')
cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Walk Through Windows of Current Application" "Alt+F6,none,Walk Through Windows of Current Application"')
cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Walk Through Windows of Current Application (Reverse)" "Alt+Shift+F6,none,Walk Through Windows of Current Application (Reverse)"')
else:
cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Walk Through Windows" "Ctrl+F13,Alt+Tab,Walk Through Windows"')
cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Walk Through Windows (Reverse)" "Ctrl+Shift+F14,Alt+Shift+Backtab,Walk Through Windows (Reverse)"')
cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Walk Through Windows Alternative" "none,none,Walk Through Windows"')
cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Maximize Window" "none,Meta+PgUp,Maximize Window"')
cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Window Maximize" "Meta+Ctrl+F,Alt+F10,Maximize Window"')
cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Minimize Window" "Meta+h,Meta+PgDown,Minimize Window"')
cmdline('kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Switch to Next Desktop" "Meta+Right,Meta+Right,Switch to Next Desktop"')
os.system('kquitapp5 kglobalaccel && sleep 2s && kglobalaccel5 &')
else:
print('distro: ' + distro + ' de: ' + dename)
print(bcolors.CRED2 + "A supported OS and DE was not found, you may not have full system level shortcuts installed." + bcolors.ENDC)
print(bcolors.CRED2 + "You may want to find your DE or Window Manager settings and manually set Alt-Tab & other OS related shortcuts." + bcolors.ENDC)
if dename == "gnome" or dename == "mate" or dename == "budgie":
# Apply dconf update to make updates survive reboots
cmdline('dconf dump /org/gnome/desktop/wm/keybindings/ > tempkb.conf')
cmdline('dconf dump /org/gnome/mutter/keybindings/ > tempmt.conf')
cmdline('dconf load /org/gnome/desktop/wm/keybindings/ < tempkb.conf')
cmdline('dconf load /org/gnome/mutter/keybindings/ < tempmt.conf')
cmdline('sleep 1 && rm -f ./tempkb.conf;rm -f ./tempmt.conf')
if dename == "budgie":
print('** Make sure to open Keyboard settings & reset "switch applications" to cmd+tab **')
# cmdline('dconf update')
def Uninstall():
print("You selected to Uninstall Kinto.\n")
restore = yn_choice("\nYour DE is " + dename + ".\n\nY: Restore hotkeys from backup\nN: Reset OS/DE hotkeys\nWhich option would you prefer?")
print("")
if(restore):
if dename == "gnome":
print("Restoring DE hotkeys...")
wmkeys = cmdline('ls | grep -m1 "keybinding"')
mutterkeys = cmdline('ls | grep -m1 "mutter_"')
if len(wmkeys) > 0:
print('dconf load /org/gnome/desktop/wm/keybindings/ < ' + wmkeys)
cmdline('dconf load /org/gnome/desktop/wm/keybindings/ < ' + wmkeys)
else:
print('Gnome Desktop keybindings backup not found...')
if len(mutterkeys) > 0:
print('dconf load /org/gnome/mutter/keybindings/ < ' + mutterkeys)
cmdline('dconf load /org/gnome/mutter/keybindings/ < ' + mutterkeys)
if len(wmkeys) > 0 or len(mutterkeys) > 0:
print("Gnome hotkeys have been successfully restored.")
elif dename == "kde":
print("Restoring DE hotkeys...")
kwinkeys = cmdline('ls | grep -m1 "kwinrc"').strip()
kdekeys = cmdline('ls | grep -m1 "kglobalshortcutsrc"').strip()
cmdline('cp ./' + kdekeys + ' ~/.config/kglobalshortcutsrc')
cmdline('cp ./' + kwinkeys + ' ~/.config/kwinrc')
elif dename == "xfce":
print("Restoring DE hotkeys...")
xfcekeys = cmdline('ls | grep -m1 "xfce4-keyboard"').strip()
cmdline('cp ./' + xfcekeys + ' ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml')
if dename == "gnome" or dename == "kde" or dename == "xfce":
print("./uninstall.sh\n")
subprocess.check_call(shlex.split("./uninstall.sh"))
print("Done.")
if dename == "kde" or dename == "xfce":
print("Please log off and back on for your original hotkeys to take effect.")
else:
if dename == "gnome":
print("Resetting DE hotkeys...\n")
print("gsettings reset-recursively org.gnome.desktop.wm.keybindings")
cmdline("gsettings reset-recursively org.gnome.desktop.wm.keybindings")
print("gsettings reset-recursively org.gnome.mutter.keybindings")
cmdline("gsettings reset-recursively org.gnome.mutter.keybindings")
print("gsettings set org.gnome.mutter overlay-key 'super'")
cmdline("gsettings set org.gnome.mutter overlay-key 'super'")
cmdline('dconf dump /org/gnome/mutter/ > mutter.conf')
cmdline('dconf load /org/gnome/mutter/ < mutter.conf')
elif dename == "kde":
print("Resetting DE hotkeys...\n")
cmdline('mv ~/.config/kwinrc ~/.config/kwinrc.kinto')
cmdline('mv ~/.config/kglobalshortcutsrc ~/.config/kglobalshortcutsrc.kinto')
elif dename == "xfce":
print("Resetting DE hotkeys...\n")
cmdline('cp /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml')
if dename == "gnome" or dename == "kde" or dename == "xfce":
print("./uninstall.sh\n")
subprocess.check_call(shlex.split("./uninstall.sh"))
print("Done.")
if dename == "kde" or dename == "xfce":
print("Please log off and back on for your original DE hotkeys to take effect.")
def kintoImpOne():
check_xbind = cmdline("\\which xbindkeys 2>/dev/null").strip()
check_xdotool = cmdline("\\which xdotool 2>/dev/null").strip()
check_ibus = cmdline("\\which ibus-setup 2>/dev/null").strip()
pkgm = cmdline("\\which apt-get 2>/dev/null").strip()
if len(pkgm) == 0:
pkgm = cmdline("\\which dnf 2>/dev/null").strip()
if len(pkgm) > 0:
pkgm += " check-update;sudo dnf install -y "
else:
pkgm += " install -y "
pkgm += " update; sudo apt-get install -y "
if len(pkgm) == 0:
pkgm = cmdline("\\which pacman 2>/dev/null").strip()
if len(pkgm) > 0:
pkgm += " -Syy; sudo pacman -S "
if len(pkgm) == 0:
print("No supported package manager found. Exiting...")
sys.exit()
runpkg = 0
global run_pkg
if len(check_xbind) > 0 and len(check_xdotool) > 0 and len(check_ibus) > 0:
print("Xbindkeys, xdotool and IBus requirement is installed.")
if len(check_xbind) == 0:
run_pkg = "xbindkeys"
runpkg = 1
if len(check_xdotool) == 0:
run_pkg += " xdotool"
runpkg = 1
if len(check_ibus) == 0:
# may differ with distro, but for now
run_pkg += " ibus"
runpkg = 1
if runpkg != 0:
print(runpkg)
requirements(pkgm)
if not os.path.exists(homedir + '/.config/ibus/bus') and cmdline("ls ~/.config/ibus/bus -1rt") == "":
install_ibus()
try:
f = open("defaults.json")
except IOError:
print("defaults.json file is missing. Will exit.\n")
exit()
f.close()
try:
f = open("defaults.json")
except IOError:
print("defaults.json file is missing. Will exit.\n")
exit()
f.close()
try:
f = open("user_config.json")
except IOError:
print("user_config.json file is missing. Will exit.\n")
exit()
f.close()
if os.path.isdir(homedir + "/.config/kinto") == False:
os.mkdir(homedir + "/.config/kinto")
time.sleep(0.5)
with open('defaults.json') as json_file:
data = json.load(json_file)
color_arr = [bcolors.CBEIGE,bcolors.CRED2,bcolors.CGREEN,bcolors.CYELLOW ]
print("\nKinto - Type in Linux like it's a Mac.\n")
kintotype = int(input(color_arr[2] +
"1) Kinto - xkeysnail (udev/x11) - Recommended\n" + color_arr[0] +
"2) Kinto - Original xkb/x11 implementation\n" + color_arr[3] +
"3) Uninstall Kinto - xkeysnail\n" +
"4) Uninstall Kinto - Original xkb\n\n"
+ bcolors.ENDC))
print("")
if(kintotype == 1):
subprocess.check_call(shlex.split("./xkeysnail_service.sh"))
if os.path.isdir(homedir + "/.config/kinto") == True:
setShortcuts()
subprocess.check_call(shlex.split("./xkeysnail_service.sh budgieUpdate"))
exit()
if(kintotype == 3):
if args.uninstall:
subprocess.check_call(shlex.split("./xkeysnail_service.sh uninstall"))
exit()
if(kintotype == 4):
Uninstall()
exit()
subprocess.check_call(shlex.split("./xkeysnail_service.sh"))
kintoImpOne()
# kintotype = int(input(color_arr[2] +
# "1) Kinto \n" + color_arr[0] +
# "2) Uninstall Kinto \n"
# + bcolors.ENDC))
# print("")
# if(kintotype == 1):
# subprocess.check_call(shlex.split("./xkeysnail_service.sh"))
# # if os.path.isdir(homedir + "/.config/kinto") == True:
# # subprocess.check_call(shlex.split("./xkeysnail_service.sh budgieUpdate"))
# # exit()
for index, item in enumerate(data['defaulttypes']):
ossym = ""
if item == "windows":
ossym = u'\u2756'
elif item == "mac":
ossym = u'\u2318'
elif item == "chromebook":
ossym = u'\u2707'
print("%s %i. %s %s %s" % (color_arr[index], index+1, ossym, item.capitalize(), bcolors.ENDC))
# if(kintotype == 2):
# subprocess.check_call(shlex.split("./xkeysnail_service.sh uninstall"))
# exit()
print("%s %i. Uninstall %s" % (color_arr[3], len(data['defaulttypes'])+1, bcolors.ENDC))
default = 0
while not int(default) in range(1,len(data['defaulttypes'])+2):
default = int(input(bcolors.CYELLOW2 + "\nPlease enter your keyboard type (1 - " + str(len(data['defaulttypes'])) + ") : " + bcolors.ENDC))
print("")
if default == len(data['defaulttypes'])+1:
Uninstall()
exit()
try:
f = open(homedir + "/.config/kinto/user_config.json")
rewrite = yn_choice("~/.config/kinto/user_config.json already exists. Do you want to overwrite it with a new config?")
print("")
if(rewrite):
copyfile("user_config.json", homedir + "/.config/kinto/user_config.json")
else:
exit()
except IOError:
pass
copyfile("user_config.json", homedir + "/.config/kinto/user_config.json")
finally:
f.close()
keyboardconfigs = [obj for obj in data['defaults'] if(obj['type'] == data['defaulttypes'][default-1])]
# for k in keyboardconfigs:
for index, k in enumerate(keyboardconfigs):
print(color_arr[default-1] + bcolors.BOLD + str(index+1) + '. ' + k['name'] + bcolors.ENDC)
print(bcolors.CYELLOW2 + 'Description: ' + k['description'] + bcolors.ENDC)
print("")
defaultkb = 0
while not int(defaultkb) in range(1,len(keyboardconfigs)+1):
defaultkb = int(input(bcolors.CYELLOW2 + "Please enter your keyboard config (1 - " + str(len(keyboardconfigs)) + ") : " + bcolors.ENDC))
print("")
if 'hack' in keyboardconfigs[defaultkb-1]:
print(bcolors.CYELLOW2 + "You have selected a keyboard config that needs the following command to be ran.\n" + bcolors.ENDC)
print(keyboardconfigs[defaultkb-1]['hack'].replace(";", "\n") + "\n")
runhack = yn_choice(bcolors.CYELLOW2 + "Would you like to run it now? (Will require sudo privileges. Will exit on No.)" + bcolors.ENDC)
if(runhack):
os.system(keyboardconfigs[defaultkb-1]['hack'])
# Setup the selected keyboards config
os.system("cp -TRv ./.xkb ~/.xkb/")
if os.path.isdir(homedir + "/.xkb/keymap") == False:
os.mkdir(homedir + "/.xkb/keymap")
time.sleep(0.5)
os.system('setxkbmap -option')
os.system('setxkbmap -print > ~/.xkb/keymap/kbd.mac.gui')
os.system('setxkbmap -print > ~/.xkb/keymap/kbd.mac.gui.chrome')
os.system('setxkbmap -print > ~/.xkb/keymap/kbd.mac.gui.browsers')
os.system('setxkbmap -print > ~/.xkb/keymap/kbd.mac.term')
time.sleep(0.5)
symbols_line = cmdline("cat ~/.xkb/keymap/kbd.mac.gui | grep -n 'xkb_symbols' | cut -f1 -d:").strip()
types_line = cmdline("cat ~/.xkb/keymap/kbd.mac.gui | grep -n 'xkb_types' | cut -f1 -d:").strip()
cmdline('sed -i '' -e "' + symbols_line + 's/\\"/' + keyboardconfigs[defaultkb-1]['xkb_symbols_gui'] + '\\"/2" ~/.xkb/keymap/kbd.mac.gui')
cmdline('sed -i '' -e "' + types_line + 's/\\"/' + keyboardconfigs[defaultkb-1]['xkb_types_gui'] + '\\"/2" ~/.xkb/keymap/kbd.mac.gui')
cmdline('sed -i '' -e "' + symbols_line + 's/\\"/' + keyboardconfigs[defaultkb-1]['xkb_symbols_term'] + '\\"/2" ~/.xkb/keymap/kbd.mac.term')
cmdline('sed -i '' -e "' + types_line + 's/\\"/' + keyboardconfigs[defaultkb-1]['xkb_types_term'] + '\\"/2" ~/.xkb/keymap/kbd.mac.term')
# Set chrome file accordingly for chromebooks or normal
if default != 3:
cmdline('sed -i '' -e "' + symbols_line + 's/\\"/' + keyboardconfigs[defaultkb-1]['xkb_symbols_gui'].replace("+mac_gui(mac_levelssym)+mac_gui(mac_appcycle)","+mac_gui(mac_levelssym)+mac_gui(mac_browsers)") + '\\"/2" ~/.xkb/keymap/kbd.mac.gui.browsers')
cmdline('sed -i '' -e "' + symbols_line + 's/\\"/' + keyboardconfigs[defaultkb-1]['xkb_symbols_gui'].replace("+mac_gui(mac_levelssym)+mac_gui(mac_appcycle)","+mac_gui(mac_browsers)+mac_gui(mac_chrome)") + '\\"/2" ~/.xkb/keymap/kbd.mac.gui.chrome')
else:
# Fix multicursor in mac_gui
cmdline('perl -pi -e "s/(\/\/ )(.*)(\/\/ Chromebook multicursor)/\$2\$3/g" ~/.xkb/symbols/mac_gui')
cmdline('perl -pi -e "s/(\w.*)(\/\/ Default multicursor)/\/\/ \$1\$2/g" ~/.xkb/symbols/mac_gui')
# Fix browsers
cmdline('sed -i '' -e "' + symbols_line + 's/\\"/' + keyboardconfigs[defaultkb-1]['xkb_symbols_gui'].replace("+mac_gui(mac_levelssym)+mac_gui(mac_appcycle_chromebook)","+mac_gui(mac_levelssym)+mac_gui(mac_browsers_chromebook)") + '\\"/2" ~/.xkb/keymap/kbd.mac.gui.browsers')
cmdline('sed -i '' -e "' + symbols_line + 's/\\"/' + keyboardconfigs[defaultkb-1]['xkb_symbols_gui'].replace("+mac_gui(mac_levelssym)+mac_gui(mac_appcycle_chromebook)","+mac_gui(mac_browsers_chromebook)+mac_gui(mac_chrome)") + '\\"/2" ~/.xkb/keymap/kbd.mac.gui.chrome')
if dename == "kde":
# Fix maximize shortcut
cmdline('perl -pi -e "s/(\/\/ )(.*)(\/\/ KDE maximize)/\$2\$3/g" ~/.xkb/symbols/mac_gui')
# term app switching
cmdline('perl -pi -e "s/(\/\/ )(.*)(\/\/ KDE cmdtab)/\$2\$3/g" ~/.xkb/symbols/mac_term')
else:
# Fix maximize shortcut
cmdline('perl -pi -e "s/(\/\/ )(.*)(\/\/ Default maximize)/\$2\$3/g" ~/.xkb/symbols/mac_gui')
# term app switching
cmdline('perl -pi -e "s/(\/\/ )(.*)(\/\/ Default cmdtab)/\$2\$3/g" ~/.xkb/symbols/mac_term')
cmdline('sed -i '' -e "' + types_line + 's/\\"/' + keyboardconfigs[defaultkb-1]['xkb_types_gui'] + '\\"/2" ~/.xkb/keymap/kbd.mac.gui.browsers')
cmdline('sed -i '' -e "' + types_line + 's/\\"/' + keyboardconfigs[defaultkb-1]['xkb_types_gui'] + '\\"/2" ~/.xkb/keymap/kbd.mac.gui.chrome')
setShortcuts()
user_file = homedir + '/.config/kinto/user_config.json'
with open(user_file, 'r') as f:
user_config = json.load(f)
onetime = yn_choice("\nOne time initialization tweaks are available. Would you like to view them?")
print("")
if(onetime):
intents = [obj for obj in user_config['de'] if(obj['intent'] == "init")]
for index, k in enumerate(intents):
print(color_arr[default-1] + bcolors.BOLD + str(index+1) + '. ' + k['name'] + bcolors.ENDC)
print(bcolors.CYELLOW2 + 'Description: ' + k['description'] + bcolors.ENDC)
print(bcolors.CYELLOW2 + 'run: ' + k['run'].replace(";", "\n") + bcolors.ENDC + '\n')
print(bcolors.CYELLOW2 + "Please enter your init tweak(s) (eg 1 or 1 2 3 - leave blank to skip): " + bcolors.ENDC)
defaultinit = [int(i) for i in input().split()]
if len(defaultinit) != 0:
user_config['init'] = [intents[defaultinit[0]-1]['id']]
print("\nDynamic shortcut tweaks\n")
intents = [obj for obj in user_config['de'] if(obj['intent'] == "gui_term")]
tweaks = []
tweaks_selected = []
for index, k in enumerate(intents):
print(color_arr[default-1] + bcolors.BOLD + str(index+1) + '. ' + k['name'] + bcolors.ENDC)
print(bcolors.CYELLOW2 + 'Description: ' + k['description'] + bcolors.ENDC)
print(bcolors.CYELLOW2 + 'run in gui mode: ' + k['run_gui'].replace(";", "\n") + bcolors.ENDC)
print(bcolors.CYELLOW2 + 'run in terminal mode: ' + k['run_term'].replace(";", "\n") + bcolors.ENDC + '\n')
tweaks.append(k['id'])
print(bcolors.CYELLOW2 + "Please enter your dynamic shortcut tweak(s) (eg 1 or 1 2 3 - leave blank to skip): " + bcolors.ENDC)
defaultde = [int(i) for i in input().split()]
for d in defaultde:
user_config['de'][tweaks[d-1]]['active'] = True
tweaks_selected.append(tweaks[d-1])
if len(defaultde) != 0:
# gui
user_config['config'][0]['de'] = tweaks_selected
# term
user_config['config'][1]['de'] = tweaks_selected
# firefox
user_config['config'][2]['de'] = tweaks_selected
# chrome
user_config['config'][3]['de'] = tweaks_selected
user_config['config'][0]['run'] = keyboardconfigs[defaultkb-1]['gui']
user_config['config'][1]['run'] = keyboardconfigs[defaultkb-1]['term']
user_config['config'][2]['run'] = keyboardconfigs[defaultkb-1]['gui'].replace("kbd.mac.gui","kbd.mac.gui.browsers")
user_config['config'][3]['run'] = keyboardconfigs[defaultkb-1]['gui'].replace("kbd.mac.gui","kbd.mac.gui.chrome")
os.remove(user_file)
with open(user_file, 'w') as f:
json.dump(user_config, f, indent=4)
print("Saved configuration to ~/.config/kinto/user_config.json\n")
print("Now running keyswap_service.sh to setup the keyswap service...")
print("Keyswap will be configured to run on user login\n")
print("You may start, stop, restart or view the status of the service with following commands\n")
print("systemctl --user start keyswap")
print("systemctl --user stop keyswap")
print("systemctl --user restart keyswap")
print("systemctl --user status keyswap")
os.system("./keyswap_service.sh")

View File

@@ -42,6 +42,7 @@ class MyWindow(Gtk.Window):
bgsuccess4 = Gtk.Image()
bgerror = Gtk.Image()
bguninstall = Gtk.Image()
last_onward = Gtk.Button()
label = Gtk.Label()
label.set_alignment(1, 0)
@@ -75,12 +76,8 @@ class MyWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="Kinto.sh")
# self.set_icon_from_file(os.environ['HOME']+'/.config/kinto/kinto-color.svg')
# self.set_gravity(Gdk.Gravity.NORTH_WEST)
self.set_size_request(600, 360)
self.initSetup()
homedir = os.path.expanduser("~")
self.kconfig = homedir+"/.config/kinto/kinto.py"
@@ -90,29 +87,18 @@ class MyWindow(Gtk.Window):
preserve_aspect_ratio = True
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(path, width, height, preserve_aspect_ratio)
# image = Gtk.Image()
# image.set_from_pixbuf(pixbuf)
self.set_default_icon_list([pixbuf])
# self.button = Gtk.Button("Do The Command")
# self.button2 = Gtk.Button("End Command")
# self.InputToTerm(self.cmdbytes)
# self.command2 = "send \003; echo 'hello'\n"
# # expect -c "send \003;"
# self.cmdbytes2 = str.encode(self.command2)
# self.button.connect("clicked", self.InputToTerm, self.cmdbytes)
# self.button2.connect("clicked", self.InputToTerm, self.cmdbytes2)
parser = argparse.ArgumentParser()
# parser.add_argument('-b', type=int, required=False, help="")
# parser.add_argument('-e', type=int, default=2, help="")
parser.add_argument('-d', dest='debug', action='store_true', help="runs kinto in debug mode")
parser.add_argument('--debug', dest='debug', action='store_true', help="runs kinto in debug mode")
parser.add_argument('-s', dest='setup', action='store_true', help="first time setup")
parser.add_argument('--setup', dest='setup', action='store_true', help="first time setup")
args = parser.parse_args()
self.args = parser.parse_args()
self.initSetup()
global terminal
terminal = Vte.Terminal()
@@ -125,8 +111,8 @@ class MyWindow(Gtk.Window):
None,
None,
)
if args.debug:
self.command = "sudo systemctl stop xkeysnail && sudo xkeysnail ~/.config/kinto/kinto.py\n"
if self.args.debug:
self.command = 'sudo systemctl stop xkeysnail && sudo pkill -f bin/xkeysnail && sudo xkeysnail ~/.config/kinto/kinto.py\n'
else:
self.command = "journalctl -f --unit=xkeysnail.service -b\n"
@@ -137,61 +123,14 @@ class MyWindow(Gtk.Window):
self.add(grid)
menubar = Gtk.MenuBar()
# menubar.set_hexpand(True)
grid.attach(menubar, 0, 0, 1, 1)
# grid.add(menubar)
# grid.add(self.button)
# grid.add(self.button2)
# grid.add(self.status)
# grid.attach(self.button, 0, 1, 1, 1)
# grid.attach(self.button2, 1, 1, 1, 1)
scroller = Gtk.ScrolledWindow()
# scroller.set_size_request(200,100)
scroller.set_hexpand(True)
scroller.set_vexpand(True)
scroller.add(terminal)
grid.attach(scroller, 0, 1, 1, 1)
# grid.add(scroller)
# grid.attach(scroller, 0, 0, 2, 2)
grid.attach_next_to(self.label, scroller, Gtk.PositionType.BOTTOM, 2, 1)
# grid.attach_next_to(self.label2, self.label, Gtk.PositionType.RIGHT, 2, 1)
# three labels
label_top_left = Gtk.Label(label="Top left")
another = Gtk.Label(label="another")
# label_top_right = Gtk.Label(label="This is Top Right")
# label_bottom = Gtk.Label(label="This is Bottom")
# some space between the columns of the grid
# grid.set_column_spacing(20)
# in the grid:
# attach the first label in the top left corner
# grid.add(label_top_left)
# grid.attach(label_top_left, 0, 0, 1, 1)
# attach the second label
# grid.attach(label_top_right, 1, 0, 1, 1)
# attach the third label below the first label
# grid.attach_next_to(label_bottom, label_top_left, Gtk.PositionType.BOTTOM, 2, 1)
# grid.attach_next_to(menubar, label_top_left, Gtk.PositionType.BOTTOM, 2, 1)
# sw = Gtk.ScrolledWindow()
# self.label.set_alignment(0, 0)
# self.label.set_selectable(True)
# self.label.set_line_wrap(True)
# self.label.set_max_width_chars(150)
# # sw.set_size_request(400,300)
# sw.set_hexpand(True)
# sw.set_vexpand(True)
# sw.add_with_viewport(self.label)
# # self.add(sw)
# # grid.add(sw)
# # grid.add(self.status)
# grid.attach(sw, 0, 0, 2, 2)
# # sub_proc = Popen("journalctl -f --unit=xkeysnail.service -b", stdout=PIPE, shell=True)
# # sub_outp = ""
with open(self.kconfig) as configfile:
autostart_line = configfile.read().split('\n')[1]
@@ -201,7 +140,6 @@ class MyWindow(Gtk.Window):
autostart_bool = True
if autostart_bool:
# Popen(['sudo', 'systemctl','restart','xkeysnail'])
self.menuitem_auto.set_active(True)
self.menuitem_auto.signal_id = self.menuitem_auto.connect('activate',self.setAutostart,False)
else:
@@ -223,7 +161,6 @@ class MyWindow(Gtk.Window):
self.menuitem_systray.signal_id = self.menuitem_systray.connect('activate',self.checkTray,True)
menuitem_file.connect('activate',self.refreshFile)
submenu_file.append(self.menuitem_systray)
# self.menuitem_enable.connect('activate', self.setEnable)
menuitem_restart = Gtk.MenuItem(label="Restart")
menuitem_restart.connect('activate',self.runRestart)
submenu_file.append(menuitem_restart)
@@ -256,19 +193,6 @@ class MyWindow(Gtk.Window):
keyboards.connect('activate',self.refresh)
menubar.append(keyboards)
# tweaks = Gtk.MenuItem(label="Tweaks")
# menubar.append(tweaks)
# submenu_tweaks = Gtk.Menu()
# tweaks.set_submenu(submenu_tweaks)
# tweakitem_rightmod = Gtk.CheckMenuItem("AltGr on Right Cmd")
# submenu_tweaks.append(tweakitem_rightmod)
# tweakitem_vsc2st3 = Gtk.CheckMenuItem("ST3 hotkeys for VS Code")
# submenu_tweaks.append(tweakitem_vsc2st3)
# tweakitem_caps2esc = Gtk.CheckMenuItem("Capslock is Escape when tapped, Cmd when held")
# submenu_tweaks.append(tweakitem_caps2esc)
# tweakitem_caps2cmd = Gtk.CheckMenuItem("Capslock is Cmd")
# submenu_tweaks.append(tweakitem_caps2cmd)
menuitem_help = Gtk.MenuItem(label="Help")
menubar.append(menuitem_help)
submenu_help = Gtk.Menu()
@@ -300,79 +224,135 @@ class MyWindow(Gtk.Window):
menu.append(self.ibmkb)
menu.append(self.winmackb)
# grid.add(another)
GLib.timeout_add(2000, self.update_terminal)
# self.show_all()
# radiomenuitem1 = Gtk.RadioMenuItem(label="Windows")
# radiomenuitem1.set_active(True)
# menu.append(radiomenuitem1)
# radiomenuitem2 = Gtk.RadioMenuItem(label="Apple", group=radiomenuitem1)
# menu.append(radiomenuitem2)
def setKinto(self):
global restartsvc
if self.options["kbtype"] == "mac":
print("setup mac")
if os.path.isfile('/sys/module/hid_apple/parameters/swap_opt_cmd'):
with open('/sys/module/hid_apple/parameters/swap_opt_cmd', 'r') as ocval:
optcmd = ocval.read().replace('\n', '')
if optcmd == '1':
# print("found hid_apple - remove")
self.queryConfig("echo '0' | sudo tee /sys/module/hid_apple/parameters/swap_opt_cmd;echo 'options hid_apple swap_opt_cmd=0' | sudo tee /etc/modprobe.d/hid_apple.conf;sudo update-initramfs -u -k all")
if os.path.isfile('/sys/module/applespi/parameters/swap_opt_cmd'):
with open('/sys/module/applespi/parameters/swap_opt_cmd', 'r') as ocval:
optcmd = ocval.read().replace('\n', '')
if optcmd == '1':
# print("found applespi - remove")
self.queryConfig("echo '0' | sudo tee /sys/module/applespi/parameters/swap_opt_cmd;echo 'options applespi swap_opt_cmd=0' | sudo tee /etc/modprobe.d/applespi.conf;sudo update-initramfs -u -k all")
setkb = 's/^(\s{3})(\s{1}#)(.*# Mac\n|.*# Mac -)|^(?!\s{4}#)(\s{3})(\s{1})(.*)( # )(WinMac.*)|^(?!\s{4}#)(\s{3})(\s{1})(.*)( # )(IBM.*)|^(?!\s{4}#)(\s{3})(\s{1})(.*)( # )(Chromebook.*)|^(\s{3})(\s{1}# )(-)(- Default (Win|Mac.*))/ $3$7$6$7$8$12$11$12$13$17$16$17$18$20$22/g'
self.mackb.disconnect(self.mackb.signal_id)
self.mackb.set_active(True)
self.mackb.signal_id = self.mackb.connect('activate',self.setKB,"mac")
elif self.options["kbtype"] == "win":
print("setup win")
setkb = 's/^(\s{3})(\s{1}#)(.*# WinMac.*)|^(?!\s{4}#)(\s{3})(\s{1})(.*)( # )(Mac.*)|^(?!\s{4}#)(\s{3})(\s{1})(.*)( # )(IBM.*)|^(?!\s{4}#)(\s{3})(\s{1})(.*)( # )(Chromebook.*)|^(\s{3})(\s{1}# )(-)( Default Win)|^(\s{3})(\s{1}# )(-)(- Default Mac*)/ $3$7$6$7$8$12$11$12$13$17$16$17$18$20$21$21$22$24$26/g'
self.winkb.disconnect(self.winkb.signal_id)
self.winkb.set_active(True)
self.winkb.signal_id = self.winkb.connect('activate',self.setKB,"win")
elif self.options["kbtype"] == "ibm":
print("setup ibm")
setkb ='s/^(\s{3})(\s{1}#)(.*# IBM.*)|^(?!\s{4}#)(\s{3})(\s{1})(.*)( # )(WinMac.*)|^(?!\s{4}#)(\s{3})(\s{1})(.*)( # )(Mac.*)|^(?!\s{4}#)(\s{3})(\s{1})(.*)( # )(Chromebook.*)|^(\s{3})(\s{1}# )(-)(- Default (Win|Mac.*))/ $3$7$6$7$8$12$11$12$13$17$16$17$18$20$22/g'
self.ibmkb.disconnect(self.ibmkb.signal_id)
self.ibmkb.set_active(True)
self.ibmkb.signal_id = self.ibmkb.connect('activate',self.setKB,"ibm")
elif self.options["kbtype"] == "cbk":
print("setup chromebook")
setkb = 's/^(\s{3})(\s{1}#)(.*# Chromebook.*)|^(?!\s{4}#)(\s{3})(\s{1})(.*)( # )(WinMac.*)|^(?!\s{4}#)(\s{3})(\s{1})(.*)( # )(Mac.*)|^(?!\s{4}#)(\s{3})(\s{1})(.*)( # )(IBM.*)|^(\s{3})(\s{1}# )(-)(- Default (Win|Mac.*))/ $3$7$6$7$8$12$11$12$13$17$16$17$18$20$22/g'
# Really an xfce4 check needs to occur before setting this
self.queryConfig('perl -pi -e "s/(# )(.*)(# xfce4)/\$2\$3/g" ~/.config/kinto/kinto.py')
self.queryConfig('perl -pi -e "s/(\w.*)(# Default)/# \$1\$2/g" ~/.config/kinto/kinto.py')
self.chromekb.disconnect(self.chromekb.signal_id)
self.chromekb.set_active(True)
self.chromekb.signal_id = self.chromekb.connect('activate',self.setKB,"chrome")
elif self.options["kbtype"] == "wmk":
print("setup winmac")
setkb = 's/^(\s{3})(\s{1}#)(.*# WinMac.*)|^(?!\s{4}#)(\s{3})(\s{1})(.*)( # )(Mac.*)|^(?!\s{4}#)(\s{3})(\s{1})(.*)( # )(IBM.*)|^(?!\s{4}#)(\s{3})(\s{1})(.*)( # )(Chromebook.*)|^(\s{3})(\s{1}# )(-)( Default Mac.*)|^(\s{3})(\s{1}# )(-)(- Default Win)/ $3$7$6$7$8$12$11$12$13$17$16$17$18$20$21$21$22$24$26/g'
if os.path.isfile('/sys/module/hid_apple/parameters/swap_opt_cmd'):
with open('/sys/module/applespi/parameters/swap_opt_cmd', 'r') as ocval:
optcmd = ocval.read().replace('\n', '')
if optcmd == '0':
# print("found hid_apple")
self.queryConfig("echo '1' | sudo tee /sys/module/hid_apple/parameters/swap_opt_cmd;echo 'options hid_apple swap_opt_cmd=1' | sudo tee /etc/modprobe.d/hid_apple.conf;sudo update-initramfs -u -k all")
if os.path.isfile('/sys/module/applespi/parameters/swap_opt_cmd'):
with open('/sys/module/applespi/parameters/swap_opt_cmd', 'r') as ocval:
optcmd = ocval.read().replace('\n', '')
if optcmd == '0':
# print("found applespi")
self.queryConfig("echo '1' | sudo tee /sys/module/applespi/parameters/swap_opt_cmd;echo 'options applespi swap_opt_cmd=1' | sudo tee /etc/modprobe.d/applespi.conf;sudo update-initramfs -u -k all")
self.winmackb.disconnect(self.winmackb.signal_id)
self.winmackb.set_active(True)
self.winmackb.signal_id = self.winmackb.connect('activate',self.setKB,"winmac")
## These can only be set if the kbtype is known
cmds = ['perl','-pi','-e',setkb,os.environ['HOME']+'/.config/kinto/kinto.py']
cmdsTerm = Popen(cmds)
cmdsTerm.wait()
if self.options["rightmod"]:
print("Right mod true - don't do a thing")
if not self.options["rightmod"]:
if self.options["kbtype"] == "win" or self.options["kbtype"] == "wmk":
setmod = 's/^(\s{4})((# )(.*)(# )(WinMac - Multi-language.*)|(K)(.*)(# )(WinMac - Multi-language.*))/ $4$5$6$9$7$8$9$10/g'
if self.options["kbtype"] == "mac":
setmod = 's/^(\s{4})((# )(.*)(# )(Mac - Multi-language.*)|(K)(.*)(# )(Mac - Multi-language.*))/ $4$5$6$9$7$8$9$10/g'
if self.options["kbtype"] == "cbk":
setmod = 's/^(\s{4})((# )(.*)(# )(Chromebook - Multi-language.*)|(K)(.*)(# )(Chromebook - Multi-language.*))/ $4$5$6$9$7$8$9$10/g'
if self.options["kbtype"] == "ibm":
setmod = 's/^(\s{4})((# )(.*)(# )(IBM - Multi-language.*)|(K)(.*)(# )(IBM - Multi-language.*))/ $4$5$6$9$7$8$9$10/g'
cmdmod = ['perl','-pi','-e',setmod,os.environ['HOME']+'/.config/kinto/kinto.py']
cmdsTerm = Popen(cmdmod)
cmdsTerm.wait()
else:
print("Right mod false - do stuff")
print("Right mod true - don't do a thing")
if self.options["vsc2st3"]:
print('Setup ST3 maps on VSCode')
setvsc = 's/^(\s{4})(\w.*)(# )(Default - Sublime)|^(\s{4})(# )(\w.*)(# Default - Sublime)/$5$7$8$1$3$2$3$4/g'
cmdvsc = ['perl','-pi','-e',setvsc,os.environ['HOME']+'/.config/kinto/kinto.py']
cmdsTerm = Popen(cmdvsc)
cmdsTerm.wait()
if self.options["capslock"] == "esc_cmd":
print("remap capslock to esc_cmd")
setcaps = 's/^(\s{4})((# )(\{\w.*)(# Caps2Esc - Chrome.*)|(\{\w.*)(# )(Caps2Esc\n)|(\{.*)(# )(Caps2Esc - Chrome.*|Placeholder)|(\w.*)(# )(Caps2Cmd.*)|(# )(\{.*)(# )(Placeholder))/ $4$5$7$6$7$8$10$9$10$11$13$12$13$14$16$17$18/g'
elif self.options["capslock"] == "cmd":
print("remap capslock to cmd only")
if self.options["systray"]:
# Run Check to make sure the OS is not using Gnome3 or KDE
print("Enable system tray, copy autostart file and execute")
setcaps = 's/^(\s{4})((\w.*)(# )(Caps2Cmd - Chrome.*)|(\w.*)(# )(Caps2Cmd\n)|(# )(\w.*)(# )(Caps2Cmd - Chrome.*)|(\{\w.*)(# )(Caps2Esc.*)|(# )(\{.*)(# )(Placeholder))/ $4$3$4$5$7$6$7$8$10$11$12$14$13$14$15$17$18$19/g'
if self.options["capslock"] == "esc_cmd" or self.options["capslock"] == "cmd":
cmdcaps = ['perl','-pi','-e',setcaps,os.environ['HOME']+'/.config/kinto/kinto.py']
cmdsTerm = Popen(cmdcaps)
cmdsTerm.wait()
if self.options["autostart"]:
print("Enable autostart, copy autostart file")
self.queryConfig('cp '+os.environ['HOME']+'/.config/kinto/xkeysnail.desktop '+os.environ['HOME']+'/.config/autostart/xkeysnail.desktop')
if self.options["systray"]:
self.queryConfig('cp '+os.environ['HOME']+'/.config/kinto/kintotray.desktop '+os.environ['HOME']+'/.config/autostart/kintotray.desktop')
self.queryConfig("nohup python3 ~/.config/kinto/kintotray.py >/dev/null 2>&1 &")
self.menuitem_systray.disconnect(self.menuitem_systray.signal_id)
self.menuitem_systray.set_active(True)
self.menuitem_systray.signal_id = self.menuitem_systray.connect('activate',self.checkTray,False)
restartsvc = True
def initSetup(self):
global win,openWin,restartsvc
parser = argparse.ArgumentParser()
parser.add_argument('-s', dest='setup', action='store_true', help="first time setup")
parser.add_argument('--setup', dest='setup', action='store_true', help="first time setup")
args = parser.parse_args()
checkkb = "perl -ne 'print if /^\s+K.*# (Mac|WinMac|Chromebook|IBM)/' ~/.config/kinto/kinto.py | wc -l"
checkkb = "perl -ne 'print if /^\s+K.*# (Mac|WinMac|(Chromebook |Chromebook\n)|IBM)/' ~/.config/kinto/kinto.py | wc -l"
checkkb_result = int(self.queryConfig(checkkb))
if checkkb_result == 0:
print('keyboard is not set')
if os.path.exists(os.environ['HOME']+'/.config/kinto/initkb'):
print('initkb')
else:
if not os.path.exists(os.environ['HOME']+'/.config/kinto/initkb'):
Popen(['cp','/opt/kinto/initkb',os.environ['HOME']+'/.config/kinto/initkb'])
with open(os.environ['HOME']+'/.config/kinto/initkb', 'r') as file:
initkb_file = file.read()
# Don't be clever - the single characters simply match the word options
# below, makes the line shorter, but less understandable.
tokenValue = re.findall(r'(e|d|3|k|y|t)\s=\s(\w+)', initkb_file,re.MULTILINE)
try:
@@ -384,9 +364,10 @@ class MyWindow(Gtk.Window):
self.options["autostart"] = bool(strtobool(tokenValue[5][1]))
except IndexError:
pass
else:
if not args.setup:
# If keyboard is already set and a setup argument is not being passed
# Then load up the normal window.
if not self.args.setup:
openWin = True
return
@@ -413,25 +394,13 @@ class MyWindow(Gtk.Window):
self.setupwin.set_resizable(False)
self.setupwin.set_position(Gtk.WindowPosition.CENTER)
# vbox = Gtk.VBox()
# # self.lbl = Gtk.Label()
# container = Gtk.Box()
# container.override_background_color(Gtk.StateType.NORMAL, Gdk.RGBA(.5,.5,.5,.5))
self.setupwin.add(self.overlay)
# background = Gtk.Image.new_from_file(os.environ['HOME']+'/Documents/git-projects/kinto/xkeysnail-config/gui/tuxonblack.png')
# try:
# from PIL import Image
# except ImportError:
# import Image
from PIL import Image
img1 = Image.open(os.environ['HOME']+'/Documents/git-projects/kinto/xkeysnail-config/gui/tuxbg.png')
img2 = Image.open(os.environ['HOME']+'/Documents/git-projects/kinto/xkeysnail-config/gui/capslock_1200x720.png')
img3 = Image.open(os.environ['HOME']+'/Documents/git-projects/kinto/xkeysnail-config/gui/keys_1200x720.png')
img1 = Image.open(os.environ['HOME']+'/.config/kinto/gui/tuxbg.png')
img2 = Image.open(os.environ['HOME']+'/.config/kinto/gui/capslock_1200x720.png')
img3 = Image.open(os.environ['HOME']+'/.config/kinto/gui/keys_1200x720.png')
pixbuf2 = self.image2pixbuf(Image.alpha_composite(img1, img2))
pixbuf2 = pixbuf2.scale_simple(600, 360, GdkPixbuf.InterpType.BILINEAR)
@@ -439,38 +408,17 @@ class MyWindow(Gtk.Window):
pixbuf3 = self.image2pixbuf(Image.alpha_composite(img1, img3))
pixbuf3 = pixbuf3.scale_simple(600, 360, GdkPixbuf.InterpType.BILINEAR)
# pixbuf = GdkPixbuf.Pixbuf.new_from_file(os.environ['HOME']+'/Documents/git-projects/kinto/xkeysnail-config/gui/tuxcry1.png')
# pixbuf = pixbuf.scale_simple(600, 360, GdkPixbuf.InterpType.BILINEAR)
# self.bgsuccess1 = self.background.new_from_pixbuf(pixbuf)
# self.bgsuccess1.set_alignment(0, 1)
# pixbuf = GdkPixbuf.Pixbuf.new_from_file(os.environ['HOME']+'/Documents/git-projects/kinto/xkeysnail-config/gui/tuxcry2.png')
# pixbuf = pixbuf.scale_simple(600, 360, GdkPixbuf.InterpType.BILINEAR)
# self.bgsuccess2 = self.background.new_from_pixbuf(pixbuf)
# self.bgsuccess2.set_alignment(0, 1)
# pixbuf = GdkPixbuf.Pixbuf.new_from_file(os.environ['HOME']+'/Documents/git-projects/kinto/xkeysnail-config/gui/tuxcry3.png')
# pixbuf = pixbuf.scale_simple(600, 360, GdkPixbuf.InterpType.BILINEAR)
# self.bgsuccess3 = self.background.new_from_pixbuf(pixbuf)
# self.bgsuccess3.set_alignment(0, 1)
pixbuf = GdkPixbuf.Pixbuf.new_from_file(os.environ['HOME']+'/Documents/git-projects/kinto/xkeysnail-config/gui/tuxcry4.png')
pixbuf = GdkPixbuf.Pixbuf.new_from_file(os.environ['HOME']+'/.config/kinto/gui/tuxcry4.png')
pixbuf = pixbuf.scale_simple(600, 360, GdkPixbuf.InterpType.BILINEAR)
self.bgsuccess4 = self.bgsuccess4.new_from_pixbuf(pixbuf)
self.bgsuccess4.set_alignment(0, 1)
pixbuf = GdkPixbuf.Pixbuf.new_from_file(os.environ['HOME']+'/Documents/git-projects/kinto/xkeysnail-config/gui/tuxuninstall.png')
pixbuf = GdkPixbuf.Pixbuf.new_from_file(os.environ['HOME']+'/.config/kinto/gui/tuxuninstall.png')
pixbuf = pixbuf.scale_simple(600, 360, GdkPixbuf.InterpType.BILINEAR)
self.bguninstall = self.bguninstall.new_from_pixbuf(pixbuf)
self.bguninstall.set_alignment(0, 1)
# pixbuf = GdkPixbuf.Pixbuf.new_from_file(os.environ['HOME']+'/Documents/git-projects/kinto/xkeysnail-config/gui/tuxerror.png')
# pixbuf = pixbuf.scale_simple(600, 360, GdkPixbuf.InterpType.BILINEAR)
# self.bgerror = self.background.new_from_pixbuf(pixbuf)
# self.bgerror.set_alignment(0, 1)
# screen = self.get_screen()
pixbuf = GdkPixbuf.Pixbuf.new_from_file(os.environ['HOME']+'/Documents/git-projects/kinto/xkeysnail-config/gui/tuxbg.png')
pixbuf = GdkPixbuf.Pixbuf.new_from_file(os.environ['HOME']+'/.config/kinto/gui/tuxbg.png')
pixbuf = pixbuf.scale_simple(600, 360, GdkPixbuf.InterpType.BILINEAR)
self.background = self.background.new_from_pixbuf(pixbuf)
self.background.set_alignment(0, 1)
@@ -478,49 +426,20 @@ class MyWindow(Gtk.Window):
self.bgcaps.set_alignment(0, 1)
self.bgspace = self.bgspace.new_from_pixbuf(pixbuf3)
self.bgspace.set_alignment(0, 1)
# background.set_padding(60,40)
self.overlay.add(self.background)
# self.overlay.add(self.bgcaps)
# self.overlay.add(self.bgspace)
self.overlay.add_overlay(self.container)
self.setupwin.add(self.container)
# self.container.show()
# for grandkid in overlay.get_children():
# overlay.remove(grandkid)
# overlay.add(bgcaps)
# overlay.add_overlay(container)
self.main = Main(self)
self.container.add(self.main)
self.uninstall_page = UninstallPage(self)
self.first_page = FirstPage(self)
self.container.add(self.first_page)
self.second_page = SecondPage(self)
self.caps_page = CapsPage(self)
self.success_page = SuccessPage(self)
# # vbox.add(self.rightmod)
# self.setupwin.add(vbox)
# self.setupwin.add(container)
self.setupwin.show_all()
# for grandkid in self.overlay.get_children():
# self.overlay.remove(grandkid)
# self.overlay.add(self.bgcaps)
# self.overlay.add_overlay(self.container)
# self.setupwin.hide()
# self.overlay.add(self.bgcaps)
# self.setupwin.show_all()
# self.first_page = FirstPage(self)
# container.add(self.first_page)
self.setupwin.connect('delete-event', self.on_delete_event)
return
@@ -580,7 +499,7 @@ class MyWindow(Gtk.Window):
self.winmackb.set_active(True)
countkb += 1
if ibm_result:
ibmkb.set_active(True)
self.ibmkb.set_active(True)
countkb += 1
if countkb > 1:
@@ -589,9 +508,7 @@ class MyWindow(Gtk.Window):
return
def runDebug(self,button):
# self.InputToTerm(self.cmdbytes)
# self.command2 = "send \003; echo 'hello'\n"
command = "send \003 sudo systemctl stop xkeysnail && sudo xkeysnail ~/.config/kinto/kinto.py\n"
command = 'send \003 sudo systemctl stop xkeysnail && sudo pkill -f bin/xkeysnail && sudo xkeysnail ~/.config/kinto/kinto.py\n'
self.InputToTerm(command)
def openSupport(self,button):
@@ -616,6 +533,7 @@ class MyWindow(Gtk.Window):
context = win.get_style_context()
default_background = str(context.get_background_color(Gtk.StateType.NORMAL))
# Checking if the user is using a light or dark theme
tokenValue = re.search('red=(\d.\d+), green=(\d.\d+), blue=(\d.\d+), alpha=(\d.\d+)', default_background)
red = float(tokenValue.group(1))
green = float(tokenValue.group(2))
@@ -628,9 +546,7 @@ class MyWindow(Gtk.Window):
theme = "light"
else:
theme = "dark"
vbox = Gtk.VBox()
# innervbox = Gtk.VBox()
if theme == "dark":
path = os.environ['HOME']+'/.config/kinto/kinto-invert.svg'
@@ -651,9 +567,8 @@ class MyWindow(Gtk.Window):
credits = Gtk.Label("Author: Ben Reaves")
spacer = Gtk.Label(" ")
copy = Gtk.Label("Copyrighted 2019, 2020 - GPLv2")
url = Gtk.LinkButton("http://kinto.sh", label="http://kinto.sh")
url2 = Gtk.Label("http://kinto.sh")
copy = Gtk.Label("© 2019, 2020 - GPLv2")
url = Gtk.LinkButton("http://kinto.sh", label="kinto.sh")
vbox.add(image)
vbox.add(version)
@@ -672,7 +587,6 @@ class MyWindow(Gtk.Window):
def checkTray(self,button,tray_bool):
kintotray = int(self.queryConfig('ps -aux | grep [k]intotray >/dev/null 2>&1 && echo "1" || echo "0"'))
# path.exists('.config/autostart/kintotray.py')
if tray_bool:
Popen(['cp',os.environ['HOME']+'/.config/kinto/kintotray.desktop',os.environ['HOME']+'/.config/autostart/kintotray.desktop'])
if not kintotray:
@@ -689,7 +603,6 @@ class MyWindow(Gtk.Window):
global child_pid
self.kinto_status = Popen("while :; do clear; systemctl is-active xkeysnail; sleep 2; done", stdout=PIPE, shell=True)
child_pid = self.kinto_status.pid
# Popen(['pkill','-f','kintotray.py'])
self.menuitem_systray.disconnect(self.menuitem_systray.signal_id)
self.menuitem_systray.set_active(False)
self.menuitem_systray.signal_id = self.menuitem_systray.connect('activate',self.checkTray,True)
@@ -838,7 +751,6 @@ class MyWindow(Gtk.Window):
openWin = False
win.show_all()
else:
# openWin = False
Gtk.main_quit()
self.hide()
@@ -973,7 +885,6 @@ class MyWindow(Gtk.Window):
print(res.returncode)
if res.returncode == 0:
# Popen(['notify-send','Kinto: Err in debug mode?','-i','budgie-desktop-symbolic'])
pkillxkey = Popen(['sudo', 'pkill','-f','bin/xkeysnail'])
pkillxkey.wait()
@@ -1050,11 +961,6 @@ class MyWindow(Gtk.Window):
def non_block_read(self):
''' even in a thread, a normal read with block until the buffer is full '''
output = self.kinto_status.stdout
# with open('goodlines.txt') as f:
# mylist = list(f)
# output = '\n'.join(self.kinto_status.stdout.splitlines()[-1:])
# '\n'.join(stderr.splitlines()[-N:])
# .splitlines()[-1:]
fd = output.fileno()
fl = fcntl.fcntl(fd, fcntl.F_GETFL)
fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK)
@@ -1062,24 +968,21 @@ class MyWindow(Gtk.Window):
if op == None:
return ''
# print(output.read())
# the_encoding = chardet.detect(output)['encoding']
# print(str(the_encoding) + " hello")
# full = self.status.get_text() + op.decode('utf-8')
# newstr = re.sub('[^A-Za-z0-9]+', '', op.decode('utf-8'))
# print(newstr)
status = op.decode('utf-8').rstrip()
if "inactive" in status or "failed" in status or "deactivating" in status:
if "inactive" in status:
if "journalctl" in self.command:
stats = "<span color='red'><b>inactive</b></span>"
else:
stats = "<span color='yellow'><b>Debug Mode</b></span>"
# elif "failed" in op.decode('utf-8').rstrip():
# stats = "<span color='red'><b>failed</b></span>"
else:
elif "active" in status:
stats = "<span color='#66ff00'><b>active</b></span>"
# op.decode('utf-8').rstrip()
else:
# "failed" in status or "deactivating" in status or "activating" in status
if "journalctl" in self.command:
stats = "<span color='red'><b>inactive</b></span>"
else:
stats = "<span color='yellow'><b>Debug Mode</b></span>"
return stats
def remove_tags(self,raw_html):
@@ -1088,11 +991,7 @@ class MyWindow(Gtk.Window):
return cleantext
def update_terminal(self):
# subproc = self.sub_proc
# print(self.another.get_text())
# self.label.set_text(self.non_block_read())
status = self.non_block_read()
# print (self.label.get_text().strip() + ' ' + self.remove_tags(status))
if self.label.get_text().strip() != self.remove_tags(status):
self.label.set_markup(" " + status + " ")
if self.remove_tags(status) == 'active':
@@ -1106,14 +1005,7 @@ class MyWindow(Gtk.Window):
return self.kinto_status.poll() is None
# def update_terminal(self):
# # subproc = self.sub_proc
# # print(self.another.get_text())
# self.label.set_text(self.label.get_text() + self.non_block_read())
# return self.sub_proc.poll() is None
def key_press_event(self, widget, event, page):
# print("key detected")
global openWin
trigger = "None"
keyname = Gdk.keyval_name(event.keyval)
@@ -1157,17 +1049,15 @@ class MyWindow(Gtk.Window):
if trigger == "Half":
self.setupwin.signal_id = self.setupwin.connect("key_press_event", self.key_press_event,2)
self.setupwin.show_all()
# self.hide()
elif trigger == "Done":
self.setKinto()
self.setupwin.show_all()
openWin = True
# self.hide()
self.last_onward.grab_focus()
def InputToTerm(self,cmd):
# Not clearly known which VTE versions
# require which fix
# requires which fix
try:
query = str.encode(cmd)
terminal.feed_child_binary(query)
@@ -1194,39 +1084,6 @@ class Main(Gtk.Box):
super().__init__(spacing=10)
self.__parent_window = parent_window
# f = Gtk.Frame()
# b = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6)
# f.add(b)
# label_start = Gtk.Label(" ")
# label_start = Gtk.Label(" ")
# image=Gtk.Image.new_from_icon_name("image-missing",Gtk.IconSize.DIALOG)
# image.set_size_request(96,96)
# # self.add(image)
# # spacing = Gtk.
# self.pack_start(image, True, True, 0)
# self.start_new_game()
# new_game_button = Gtk.Button("NEW GAME")
# new_game_button.connect("clicked", self.start_new_game)
# new_game_button.set_border_width(20)
# new_game_button.set_valign(Gtk.Align.CENTER)
# self.pack_start(new_game_button, True, True, 0)
# def start_new_game(self, *args):
# # self.__parent_window.first_page.show_all()
# # self.hide()
# for grandkid in self.__parent_window.overlay.get_children():
# self.__parent_window.overlay.remove(grandkid)
# self.__parent_window.overlay.add(self.__parent_window.background)
# self.__parent_window.overlay.add_overlay(self.__parent_window.container)
# self.__parent_window.container.add(self.__parent_window.first_page)
# # self.setupwin.remove(self.FirstPage)
# self.__parent_window.setupwin.show_all()
# # self.set_visible(False)
# # self.hide()
class UninstallPage(Gtk.Box):
def __init__(self, parent_window):
super().__init__(spacing=10)
@@ -1274,13 +1131,6 @@ class UninstallPage(Gtk.Box):
self.add(self.grid)
def goback(self, *args):
# for grandkid in self.__parent_window.overlay.get_children():
# self.__parent_window.overlay.remove(grandkid)
# self.__parent_window.overlay.add(self.__parent_window.bgspace)
# self.__parent_window.overlay.add_overlay(self.__parent_window.container)
# self.__parent_window.container.add(self.__parent_window.second_page)
# self.__parent_window.container.remove(self.__parent_window.caps_page)
# self.__parent_window.setupwin.show_all()
self.hide()
def forward(self, *args):
@@ -1303,8 +1153,6 @@ class FirstPage(Gtk.Box):
vbox_container = Gtk.VBox()
scroller = Gtk.ScrolledWindow()
scroller.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.ALWAYS)
# self.grid.modify_bg(Gtk.StateFlags.NORMAL, Gdk.color_parse("#2d303b"))
# scroller.modify_bg(Gtk.StateFlags.NORMAL, Gdk.color_parse("#aaaaaa"))
label_start = Gtk.Label()
label_start.set_markup("Before we continue please make sure you do not have any other remappers running. Kinto works best when it is the only application remapping your keys.\n\nBy continuing you also agree that Kinto is not held liable for any harm, damage(s) or unexpected behaviors.\nThis software is free, open-source, and provided as-is.\n\n<sup><b>© 2019, 2020 by Ben Reaves ~ Kinto is licensed on GPLv2.</b></sup>")
@@ -1340,15 +1188,10 @@ class FirstPage(Gtk.Box):
self.grid.add(vbox_container)
self.grid.attach_next_to(hbox, vbox_container, Gtk.PositionType.BOTTOM, 2, 1)
self.add(self.grid)
onward.grab_focus()
def goback(self, *args):
for grandkid in self.__parent_window.overlay.get_children():
self.__parent_window.overlay.remove(grandkid)
self.__parent_window.overlay.add(self.__parent_window.bguninstall)
self.__parent_window.overlay.add_overlay(self.__parent_window.container)
self.__parent_window.container.add(self.__parent_window.uninstall_page)
self.__parent_window.container.remove(self.__parent_window.first_page)
self.__parent_window.setupwin.show_all()
Gtk.main_quit()
self.hide()
def forward(self, button):
@@ -1433,7 +1276,7 @@ class SecondPage(Gtk.Box):
def forward(self, *args):
for grandkid in self.__parent_window.overlay.get_children():
self.__parent_window.overlay.remove(grandkid)
self.__parent_window.overlay.add(self.__parent_window.success)
self.__parent_window.overlay.add(self.__parent_window.bgsuccess4)
self.__parent_window.overlay.add_overlay(self.__parent_window.container)
self.__parent_window.container.add(self.__parent_window.success_page)
self.__parent_window.container.remove(self.__parent_window.second_page)
@@ -1515,6 +1358,18 @@ class SuccessPage(Gtk.Box):
super().__init__(spacing=10)
self.__parent_window = parent_window
vbox_container = Gtk.VBox()
self.__parent_window.last_onward.props.relief = Gtk.ReliefStyle.NONE
self.__parent_window.last_onward.connect("clicked", self.forward)
vbox_container.set_margin_top(600)
vbox_container.add(self.__parent_window.last_onward)
self.add(vbox_container)
def forward(self, *args):
self.hide()
self.__parent_window.setupwin.close()
global win,openWin
win = MyWindow()
win.connect("delete-event", Gtk.main_quit)

View File

@@ -4,8 +4,8 @@ Name=Kinto.sh
GenericName=Kinto.sh
Categories=Utility;
Type=Application
Exec={path}/kinto-gui.py
Icon={home}/.config/kinto/kinto-color-48.svg
Exec={homedir}/.config/kinto/gui/kinto-gui.py
Icon={homedir}/.config/kinto/kinto-color-48.svg
# Icon=/usr/share/icons/Pocillo/kinto-color.svg
Terminal=false
NoDisplay=false

BIN
xkeysnail-config/gui/tuxerror.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

View File

@@ -209,8 +209,9 @@ define_keymap(None,{
K("RC-Q"): K("Alt-F4"),
K("RC-H"): K("Alt-F9"),
# Cmd Tab - App Switching Default
K("RC-Tab"): K("RC-F13"), # Default not-xfce4
K("RC-Shift-Tab"): K("RC-Shift-F13"), # Default not-xfce4
K("M-Tab"): pass_through_key, # Default not-xfce4
K("RC-Tab"): K("M-Tab"), # Default not-xfce4
K("RC-Shift-Tab"): K("M-Shift-Tab"), # Default not-xfce4
K("RC-Grave"): K("M-F6"), # Default not-xfce4
K("RC-Shift-Grave"): K("M-Shift-F6"), # Default not-xfce4
# K("RC-Tab"): K("RC-backslash"), # xfce4

View File

@@ -1,9 +0,0 @@
[Plugin]
Loader=python3
Module=kinto
Name=Kinto
Description=Kinto Applet
Authors=Ben Reaves
Copyright=Copyright © 2020 Ben Reaves
Website=github.com/rbreaves
Icon=kinto-solid

View File

@@ -1,321 +0,0 @@
#!/usr/bin/env python3
# Copyright (C) 2017 Gopikrishnan R
"""
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import subprocess,time,os,gi.repository
gi.require_version('Budgie','1.0')
gi.require_version('Gtk','3.0')
from shutil import which
from gi.repository import Budgie, GObject, Gtk
class Kinto(GObject.GObject, Budgie.Plugin):
__gtype_name__ = "Kinto"
def __init__(self):
GObject.Object.__init__(self)
def do_get_panel_widget(self, uuid):
return KintoApplet(uuid)
class KintoApplet(Budgie.Applet):
homedir = os.path.expanduser("~")
kconfig = homedir+"/.config/kinto/kinto.py"
box = Gtk.EventBox()
revealer=Gtk.Revealer() # Contains individual restart actions
button=Gtk.Button() # Restart Button, Restarts both panel & WM
button.set_relief(Gtk.ReliefStyle.NONE)
button_arrow=Gtk.Button() # Down arrow
button_arrow.set_relief(Gtk.ReliefStyle.NONE)
img = Gtk.Image.new_from_icon_name("kinto-invert", Gtk.IconSize.BUTTON)
img_arrow=Gtk.Image.new_from_icon_name('pan-down-symbolic',Gtk.IconSize.BUTTON)
revealed=False # Whether Gtk.Revealer is open or not.
checkbox_autostart = Gtk.CheckButton()
checkbox_suspend = Gtk.CheckButton()
button_region = Gtk.Button()
button_syskb = Gtk.Button()
button_config = Gtk.Button()
button_winmac = Gtk.Button()
button_setscale = Gtk.Button()
button_region.set_relief(Gtk.ReliefStyle.NONE)
button_syskb.set_relief(Gtk.ReliefStyle.NONE)
button_config.set_relief(Gtk.ReliefStyle.NONE)
button_winmac.set_relief(Gtk.ReliefStyle.NONE)
button_setscale.set_relief(Gtk.ReliefStyle.NONE)
suspend_id=0
winmac_id=0
chkautostart_id=0
autostart_bool = False
# subprocess.Popen(['sh',homedir+'/.config/kinto/logoff.sh'])
with open(kconfig) as configfile:
autostart_line = configfile.read().split('\n')[1]
if "autostart = true" in autostart_line.casefold():
autostart_bool = True
def __init__(self,uuid):
Budgie.Applet.__init__(self)
self.initUI()
def initUI(self):
self.popover = Budgie.Popover.new(self.box)
seperator = Gtk.Separator(orientation=Gtk.Orientation.VERTICAL)
self.hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=0) # To store the Reset(Both) button and arrow
self.vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0) # Main VBox
self.vbox_buttons = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0) # Vbox inside revealer
self.box.set_tooltip_text("Kinto")
self.checkbox_autostart.set_label("Autostart")
# self.checkbox_autostart.modify_fg(Gtk.STATE_NORMAL, Gtk.Gdk.color_parse('#366B7E'));
if self.autostart_bool:
subprocess.Popen(['sudo', 'systemctl','restart','xkeysnail'])
self.checkbox_autostart.set_active(True)
self.chkautostart_id = self.checkbox_autostart.connect("clicked",self.setAutostart,False)
else:
# subprocess.Popen(['sudo', 'systemctl','stop','xkeysnail'])
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.vbox.pack_start(self.checkbox_autostart,True,False,5)
self.hbox.pack_end(seperator,True,False,0)
# self.vbox.pack_start(self.hbox,True,False,5)
# self.vbox.pack_start(seperator,True,False,0)
time.sleep(5)
res = subprocess.Popen(['sudo', 'systemctl','is-active','--quiet','xkeysnail'])
res.wait()
self.checkbox_suspend.set_label("Kinto Enabled")
if res.returncode == 0:
self.checkbox_suspend.set_active(True)
self.img.set_from_icon_name("kinto-invert", Gtk.IconSize.BUTTON)
self.suspend_id = self.checkbox_suspend.connect("clicked",self.suspend,True)
else:
self.checkbox_suspend.set_active(False)
self.img.set_from_icon_name("kinto-color", Gtk.IconSize.BUTTON)
self.suspend_id = self.checkbox_suspend.connect("clicked",self.suspend,False)
self.vbox.pack_start(self.checkbox_suspend,True,False,5)
self.hbox.pack_end(seperator,True,False,0)
self.button_config.set_label("Edit Config")
self.button_config.connect("clicked",self.setConfig)
self.vbox.pack_start(self.button_config,True,False,5)
self.hbox.pack_end(seperator,True,False,0)
self.box.add(self.img)
self.box.connect("button-press-event", self.on_press)
self.add(self.box)
command = "perl -ne 'print if /(#.*)(# Mac)\n/' ~/.config/kinto/kinto.py | wc -l"
res = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=None, shell=True)
res.wait()
res = res.communicate()[0]
if res:
self.button_winmac.set_label("Set Win/Mac KB Type")
self.winmac_id = self.button_winmac.connect("clicked",self.setKB,"winmac")
else:
self.button_winmac.set_label("Set Mac Only KB Type")
self.winmac_id = self.button_winmac.connect("clicked",self.setKB,"mac")
self.vbox.pack_start(self.button_winmac,True,False,5)
self.hbox.pack_end(seperator,True,False,0)
self.button_syskb.set_label("System Shortcuts")
self.button_syskb.connect("clicked",self.setSysKB)
self.vbox.pack_start(self.button_syskb,True,False,5)
self.hbox.pack_end(seperator,True,False,0)
self.button_region.set_label("Change Language")
self.button_region.connect("clicked",self.setRegion)
self.vbox.pack_start(self.button_region,True,False,5)
# self.vbox.pack_start(seperator,True,False,0)
# self.hbox.pack_end(self.button_arrow,False,False,5)
# if res.returncode == 0:
# self.button_setscale.set_label("Set 1x DPI Scale")
# self.button_setscale.connect("clicked",self.setScale,1)
# else:
# self.button_setscale.set_label("Set 2x DPI Scale")
# self.button_setscale.connect("clicked",self.setScale,2)
# self.vbox.pack_start(self.button_setscale,True,False,5)
# self.vbox.pack_start(seperator,True,False,0)
self.vbox.pack_start(self.hbox,False,False,5)
self.vbox.pack_start(self.revealer,False,False,0)
self.popover.add(self.vbox)
self.popover.get_child().show_all()
self.box.show_all()
self.show_all()
def on_press(self, box, e):
if e.button != 1:
return Gdk.EVENT_PROPAGATE
if self.popover.get_visible():
self.revealer.set_visible(False)
else:
self.revealer.set_reveal_child(False) # Close Revealer (if open) before showing popover
self.img_arrow.set_from_icon_name('pan-down-symbolic',Gtk.IconSize.BUTTON) # Reset to pan-down icon
self.manager.show_popover(self.box)
def do_update_popovers(self, manager):
self.manager = manager
self.manager.register_popover(self.box, self.popover)
def change_icon(self):
""" Change arrow to down/up """
if not self.revealed:
self.img_arrow.set_from_icon_name('pan-up-symbolic',Gtk.IconSize.BUTTON)
self.revealed=True
else:
self.img_arrow.set_from_icon_name('pan-down-symbolic',Gtk.IconSize.BUTTON)
self.revealed=False
def revealer_show(self,button):
""" Open/Close the revealer """
if self.revealer.get_reveal_child():
self.change_icon()
self.revealer.set_reveal_child(False)
else:
self.change_icon()
self.revealer.set_reveal_child(True)
def suspend(self,button,suspendKinto):
try:
if suspendKinto:
subprocess.Popen(['sudo', 'systemctl','stop','xkeysnail'])
self.checkbox_suspend.set_active(False)
self.img.set_from_icon_name("kinto-color", Gtk.IconSize.BUTTON)
self.checkbox_suspend.disconnect(self.suspend_id)
self.suspend_id = self.checkbox_suspend.connect("clicked",self.suspend,False)
self.box.add(self.img)
else:
subprocess.Popen(['sudo', 'systemctl','restart','xkeysnail'])
self.checkbox_suspend.set_active(True)
self.img.set_from_icon_name("kinto-invert", Gtk.IconSize.BUTTON)
self.checkbox_suspend.disconnect(self.suspend_id)
self.suspend_id = self.checkbox_suspend.connect("clicked",self.suspend,True)
self.box.add(self.img)
except subprocess.CalledProcessError: # Notify user about error on running restart commands.
subprocess.Popen(['notify-send','Kinto: Error Suspending!','-i','budgie-desktop-symbolic'])
def setKB(self,button,kbtype):
try:
if kbtype == "winmac":
label = "Set Mac KB Type"
connect = "mac"
setwinmac = ['s/^(\s{3})(\s{1}#)(.*# WinMac\n|.*# WinMac -)|^(?!\s{4}#)(\s{3})(\s{1})(.*)( # )(Mac\n|Mac -)/ $3$7$6$7$8/g']
else:
label = "Set Win/Mac KB Type"
connect = "winmac"
setwinmac = ['s/^(\s{3})(\s{1}#)(.*# Mac\n|.*# Mac -)|^(?!\s{4}#)(\s{3})(\s{1})(.*)( # )(WinMac)/ $3$7$6$7$8/g']
restart = ['sudo', 'systemctl','restart','xkeysnail']
# restart = "sudo systemctl restart xkeysnail"
# stop = "sudo systemctl stop xkeysnail"
# start = "sudo systemctl start xkeysnail"
cmds = ['perl','-pi','-e']+setwinmac+[self.kconfig]
subprocess.Popen(cmds)
cmdsTerm = subprocess.Popen(cmds)
cmdsTerm.wait()
subprocess.Popen(restart)
# cmdsTerm.kill()
# stopTerm = subprocess.Popen(stop,shell=True)
# stopTerm.wait()
# stopTerm.kill()
# time.sleep(2)
# startTerm = subprocess.Popen(start,shell=True)
# startTerm.wait()
# startTerm.kill()
self.button_winmac.set_label(label)
self.button_winmac.disconnect(self.winmac_id)
self.winmac_id = self.button_winmac.connect("clicked",self.setKB,connect)
except subprocess.CalledProcessError: # Notify user about error on running restart commands.
subprocess.Popen(['notify-send','Kinto: Error Reseting KB Type!','-i','budgie-desktop-symbolic'])
def setAutostart(self,button,autostart):
try:
if autostart == False:
subprocess.Popen(['perl','-pi','-e','s/autostart = true/autostart = false/g',self.homedir+'/.config/kinto/kinto.py'])
self.checkbox_autostart.set_active(False)
self.checkbox_autostart.disconnect(self.chkautostart_id)
self.chkautostart_id = self.checkbox_autostart.connect("clicked",self.setAutostart,True)
else:
subprocess.Popen(['perl','-pi','-e','s/autostart = false/autostart = true/g',self.homedir+'/.config/kinto/kinto.py'])
self.checkbox_autostart.set_active(True)
self.checkbox_autostart.disconnect(self.chkautostart_id)
self.chkautostart_id = self.checkbox_autostart.connect("clicked",self.setAutostart,False)
except subprocess.CalledProcessError: # Notify user about error on running restart commands.
subprocess.Popen(['notify-send','Kinto: Error setting autostart!','-i','budgie-desktop-symbolic'])
def setConfig(self,button):
try:
if os.path.exists('/opt/sublime_text/sublime_text'):
subprocess.Popen(['/opt/sublime_text/sublime_text',self.homedir+'/.config/kinto/kinto.py'])
elif which(gedit) is not None:
subprocess.Popen(['gedit',self.homedir+'/.config/kinto/kinto.py'])
except subprocess.CalledProcessError: # Notify user about error on running restart commands.
subprocess.Popen(['notify-send','Kinto: Error could not open config file!','-i','budgie-desktop-symbolic'])
def setSysKB(self,button):
subprocess.Popen(['gnome-control-center','keyboard'])
def setRegion(self,button):
subprocess.Popen(['gnome-control-center','region'])
def setScale(self,button,scale):
print("scale")
#END

View File

@@ -1,674 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@@ -1,22 +0,0 @@
#Just for building packages. (eopkg for solus)
DESTDIR ?=
INSTALLPATH ?= /usr/lib64/budgie-desktop/plugins
ICONPATH ?= /usr/share/icons/hicolor/scalable/apps
budgie-restart-applet:
echo "Nothing to do"
install: budgie-restart-applet
mkdir -p $(DESTDIR)$(INSTALLPATH)/org.budgie-desktop.applet.budgierestart
mkdir -p $(DESTDIR)$(ICONPATH)
#rm -f $(ICONDIR)/icon-theme.cache
for file in BudgieRestart/*; \
do \
install -m 0755 "$$file" $(DESTDIR)$(INSTALLPATH)/org.budgie-desktop.applet.budgierestart/; \
done
for file in icons/*; \
do \
install -m 0755 "$$file" $(DESTDIR)$(ICONPATH)/; \
done

View File

@@ -1,4 +0,0 @@
# Kinto Applet
Based on the open sourced app Budgie Restart Applet originally written by -Gopikrishnan R (github.com/gkr09)

View File

@@ -1,41 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1"
id="svg5082" inkscape:version="0.92.2 5c3e80d, 2017-08-06" sodipodi:docname="budgie-restart2.svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 18.3 19.8"
style="enable-background:new 0 0 18.3 19.8;" xml:space="preserve">
<style type="text/css">
.st0{fill:#61BB46;}
.st1{fill:#FDB827;}
.st2{fill:#F5821F;}
.st3{fill:#E03A3E;}
.st4{fill:#963D97;}
.st5{fill:#009DDC;}
.st6{fill:#FFFFFF;}
</style>
<title id="title5087">Symbolic Icons</title>
<sodipodi:namedview bordercolor="#000000" borderopacity="0.34509804" fit-margin-bottom="0" fit-margin-left="0" fit-margin-right="0" fit-margin-top="0" id="base" inkscape:current-layer="layer2" inkscape:cx="3.6222888" inkscape:cy="4.1549938" inkscape:document-units="px" inkscape:grid-bbox="true" inkscape:object-nodes="true" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-height="740" inkscape:window-maximized="1" inkscape:window-width="1360" inkscape:window-x="0" inkscape:window-y="0" inkscape:zoom="33.811791" pagecolor="#37474f" showborder="false" showgrid="false">
<inkscape:grid empspacing="4" id="grid5636" originx="-0.28935368" originy="-119.88235" type="xygrid"></inkscape:grid>
</sodipodi:namedview>
<g id="layer4" transform="translate(-0.28935366,-60.349598)" inkscape:groupmode="layer" inkscape:label="status">
</g>
<g id="layer3" transform="translate(-0.28935366,-60.349598)" inkscape:groupmode="layer" inkscape:label="actions">
</g>
<g id="layer2">
<title>kinto-final</title>
<path id="Green" class="st0" d="M13.5,3.6H4.7c-1,0-1.9,0.9-1.9,1.9v0.2h12.6V5.5C15.4,4.5,14.5,3.6,13.5,3.6z"/>
<rect id="Yellow" x="2.8" y="5.7" class="st1" width="12.6" height="2.2"/>
<rect id="Orange" x="2.8" y="7.8" class="st2" width="12.6" height="2.2"/>
<rect id="Red" x="2.8" y="10" class="st3" width="12.6" height="2.2"/>
<path id="Purple" class="st4" d="M2.8,14.3L2.8,14.3h12.6l0,0v-2.1H2.8V14.3z"/>
<path id="Blue" class="st5" d="M4.7,16.2h9c1-0.1,1.7-1,1.7-1.9H2.8C2.8,15.3,3.7,16.2,4.7,16.2z"/>
<g id="Border">
<path class="st6" d="M16.2,2.8c-0.6-0.6-1.4-1-2.2-0.9H4.3c-0.9,0-1.7,0.3-2.2,0.9c-0.6,0.6-1,1.4-1,2.2v9.7c0,0.9,0.3,1.7,1,2.2
c0.5,0.6,1.3,1,2.2,1h2.1l0,0h2.3l0,0h3.5l0,0l0,0H14c1.7,0,3.1-1.4,3.1-3.1V5C17.2,4.2,16.8,3.4,16.2,2.8z M15.4,14.3
c0,1-0.7,1.8-1.7,1.9L11,11.6l2.8-2.9h-2.5l-2.5,3V5.9H6.7v10.3H4.7c-1,0-1.9-0.9-1.9-1.9V5.5c0-1,0.9-1.9,1.9-1.9h8.7
c1,0,1.9,0.9,1.9,1.9L15.4,14.3z M8.7,16.2V14l0.9-0.9l1.7,3.1L8.7,16.2z"/>
</g>
</g>
<g id="layer1">
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.0 KiB

View File

@@ -1,41 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1"
id="svg5082" inkscape:version="0.92.2 5c3e80d, 2017-08-06" sodipodi:docname="budgie-restart2.svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 18.3 19.8"
style="enable-background:new 0 0 18.3 19.8;" xml:space="preserve">
<style type="text/css">
.st0{fill:#61BB46;}
.st1{fill:#FDB827;}
.st2{fill:#F5821F;}
.st3{fill:#E03A3E;}
.st4{fill:#963D97;}
.st5{fill:#009DDC;}
.st6{fill:#FFFFFF;}
</style>
<title id="title5087">Symbolic Icons</title>
<sodipodi:namedview bordercolor="#000000" borderopacity="0.34509804" fit-margin-bottom="0" fit-margin-left="0" fit-margin-right="0" fit-margin-top="0" id="base" inkscape:current-layer="layer2" inkscape:cx="3.6222888" inkscape:cy="4.1549938" inkscape:document-units="px" inkscape:grid-bbox="true" inkscape:object-nodes="true" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-height="740" inkscape:window-maximized="1" inkscape:window-width="1360" inkscape:window-x="0" inkscape:window-y="0" inkscape:zoom="33.811791" pagecolor="#37474f" showborder="false" showgrid="false">
<inkscape:grid empspacing="4" id="grid5636" originx="-0.28935368" originy="-119.88235" type="xygrid"></inkscape:grid>
</sodipodi:namedview>
<g id="layer4" transform="translate(-0.28935366,-60.349598)" inkscape:groupmode="layer" inkscape:label="status">
</g>
<g id="layer3" transform="translate(-0.28935366,-60.349598)" inkscape:groupmode="layer" inkscape:label="actions">
</g>
<g id="layer2">
<title>kinto-final</title>
<path id="Green" class="st0" d="M14.1,2.7h-10c-1.2,0-2.2,1-2.2,2.2v0.2h14.4V4.9C16.3,3.7,15.3,2.7,14.1,2.7z"/>
<rect id="Yellow" x="1.9" y="5.1" class="st1" width="14.4" height="2.5"/>
<rect id="Orange" x="1.9" y="7.5" class="st2" width="14.4" height="2.5"/>
<rect id="Red" x="1.9" y="10" class="st3" width="14.4" height="2.5"/>
<path id="Purple" class="st4" d="M1.9,14.9C1.9,14.9,1.9,14.9,1.9,14.9l14.4,0c0,0,0,0,0,0v-2.4H1.9V14.9z"/>
<path id="Blue" class="st5" d="M4.1,17.1l10.3,0c1.1-0.1,1.9-1.1,1.9-2.2H1.9C1.9,16.1,2.9,17.1,4.1,17.1z"/>
<g id="Border">
<path class="st6" d="M17.2,1.8c-0.7-0.7-1.6-1.1-2.5-1H3.6c-1,0-1.9,0.4-2.5,1C0.4,2.5,0,3.4,0,4.3v11.1c0,1,0.4,1.9,1.1,2.5
C1.7,18.6,2.6,19,3.6,19H6v0h2.6v0h4l0,0l0,0h2.1c2,0,3.6-1.6,3.6-3.6V4.3C18.3,3.4,17.9,2.5,17.2,1.8z M16.3,14.9
c0,1.1-0.8,2.1-1.9,2.2l-3.1-5.3l3.2-3.3h-2.9l-2.9,3.4V5.3H6.3v11.8H4.1c-1.2,0-2.2-1-2.2-2.2v-10c0-1.2,1-2.2,2.2-2.2h10
c1.2,0,2.2,1,2.2,2.2L16.3,14.9z M8.6,17.1v-2.5l1-1l2,3.6L8.6,17.1z"/>
</g>
</g>
<g id="layer1">
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.0 KiB

View File

@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1"
id="svg5082" inkscape:version="0.92.2 5c3e80d, 2017-08-06" sodipodi:docname="budgie-restart2.svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 18.3 19.8"
style="enable-background:new 0 0 18.3 19.8;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<title id="title5087">Symbolic Icons</title>
<sodipodi:namedview bordercolor="#000000" borderopacity="0.34509804" fit-margin-bottom="0" fit-margin-left="0" fit-margin-right="0" fit-margin-top="0" id="base" inkscape:current-layer="layer2" inkscape:cx="3.6222888" inkscape:cy="4.1549938" inkscape:document-units="px" inkscape:grid-bbox="true" inkscape:object-nodes="true" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-height="740" inkscape:window-maximized="1" inkscape:window-width="1360" inkscape:window-x="0" inkscape:window-y="0" inkscape:zoom="33.811791" pagecolor="#37474f" showborder="false" showgrid="false">
<inkscape:grid empspacing="4" id="grid5636" originx="-0.28935368" originy="-119.88235" type="xygrid"></inkscape:grid>
</sodipodi:namedview>
<g id="layer4" transform="translate(-0.28935366,-60.349598)" inkscape:groupmode="layer" inkscape:label="status">
</g>
<g id="layer3" transform="translate(-0.28935366,-60.349598)" inkscape:groupmode="layer" inkscape:label="actions">
</g>
<g id="layer2">
<g id="White_K">
<path class="st0" d="M16.1,2.9c-0.6-0.6-1.4-1-2.2-1H4.2C3.3,2,2.5,2.3,2,2.9S1,4.3,1,5.1v9.7c0,0.9,0.4,1.7,1,2.2
c0.5,0.7,1.3,1,2.2,1h2.1V5.6h2.3V12l2.9-3.3h2.8l-3.2,3.2l3.6,6c0.5-0.2,1.1-0.4,1.4-0.8c0.6-0.6,1-1.4,1-2.2V5.1
C17,4.3,16.7,3.6,16.1,2.9z"/>
<polygon class="st0" points="8.5,14.6 8.5,18 11.9,18 9.4,13.6 "/>
</g>
</g>
<g id="layer1">
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1"
id="svg5082" inkscape:version="0.92.2 5c3e80d, 2017-08-06" sodipodi:docname="budgie-restart2.svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 18.3 19.8"
style="enable-background:new 0 0 18.3 19.8;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<title id="title5087">Symbolic Icons</title>
<sodipodi:namedview bordercolor="#000000" borderopacity="0.34509804" fit-margin-bottom="0" fit-margin-left="0" fit-margin-right="0" fit-margin-top="0" id="base" inkscape:current-layer="layer2" inkscape:cx="3.6222888" inkscape:cy="4.1549938" inkscape:document-units="px" inkscape:grid-bbox="true" inkscape:object-nodes="true" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-height="740" inkscape:window-maximized="1" inkscape:window-width="1360" inkscape:window-x="0" inkscape:window-y="0" inkscape:zoom="33.811791" pagecolor="#37474f" showborder="false" showgrid="false">
<inkscape:grid empspacing="4" id="grid5636" originx="-0.28935368" originy="-119.88235" type="xygrid"></inkscape:grid>
</sodipodi:namedview>
<g id="layer4" transform="translate(-0.28935366,-60.349598)" inkscape:groupmode="layer" inkscape:label="status">
</g>
<g id="layer3" transform="translate(-0.28935366,-60.349598)" inkscape:groupmode="layer" inkscape:label="actions">
</g>
<g id="layer2">
<g id="White_K">
<path class="st0" d="M17.2,1.8c-0.7-0.7-1.6-1.1-2.5-1.1H3.6c-1,0-1.9,0.4-2.5,1.1S0,3.4,0,4.3v11.1c0,1,0.4,1.9,1.1,2.5
C1.7,18.7,2.6,19,3.6,19H6V4.8h2.6v7.3l3.3-3.8h3.2L11.5,12l4.1,6.9c0.6-0.2,1.2-0.5,1.6-0.9c0.7-0.7,1.1-1.6,1.1-2.5V4.3
C18.3,3.4,17.9,2.5,17.2,1.8z"/>
<polygon class="st0" points="8.6,15.1 8.6,19 12.5,19 9.6,14 "/>
</g>
</g>
<g id="layer1">
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1"
id="svg5082" inkscape:version="0.92.2 5c3e80d, 2017-08-06" sodipodi:docname="budgie-restart2.svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 18.3 19.8"
style="enable-background:new 0 0 18.3 19.8;" xml:space="preserve">
<title id="title5087">Symbolic Icons</title>
<sodipodi:namedview bordercolor="#000000" borderopacity="0.34509804" fit-margin-bottom="0" fit-margin-left="0" fit-margin-right="0" fit-margin-top="0" id="base" inkscape:current-layer="layer2" inkscape:cx="3.6222888" inkscape:cy="4.1549938" inkscape:document-units="px" inkscape:grid-bbox="true" inkscape:object-nodes="true" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-height="740" inkscape:window-maximized="1" inkscape:window-width="1360" inkscape:window-x="0" inkscape:window-y="0" inkscape:zoom="33.811791" pagecolor="#37474f" showborder="false" showgrid="false">
<inkscape:grid empspacing="4" id="grid5636" originx="-0.28935368" originy="-119.88235" type="xygrid"></inkscape:grid>
</sodipodi:namedview>
<g id="layer4" transform="translate(-0.28935366,-60.349598)" inkscape:groupmode="layer" inkscape:label="status">
</g>
<g id="layer3" transform="translate(-0.28935366,-60.349598)" inkscape:groupmode="layer" inkscape:label="actions">
</g>
<g id="layer2">
<g id="White_K">
<path d="M16.1,2.9c-0.6-0.6-1.4-1-2.2-1H4.2C3.3,2,2.5,2.3,2,2.9S1,4.3,1,5.1v9.7c0,0.9,0.4,1.7,1,2.2c0.5,0.7,1.3,1,2.2,1h2.1
V5.6h2.3V12l2.9-3.3h2.8l-3.2,3.2l3.6,6c0.5-0.2,1.1-0.4,1.4-0.8c0.6-0.6,1-1.4,1-2.2V5.1C17,4.3,16.7,3.6,16.1,2.9z"/>
<polygon points="8.5,14.6 8.5,18 11.9,18 9.4,13.6 "/>
</g>
</g>
<g id="layer1">
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1"
id="svg5082" inkscape:version="0.92.2 5c3e80d, 2017-08-06" sodipodi:docname="budgie-restart2.svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 18.3 19.8"
style="enable-background:new 0 0 18.3 19.8;" xml:space="preserve">
<title id="title5087">Symbolic Icons</title>
<sodipodi:namedview bordercolor="#000000" borderopacity="0.34509804" fit-margin-bottom="0" fit-margin-left="0" fit-margin-right="0" fit-margin-top="0" id="base" inkscape:current-layer="layer2" inkscape:cx="3.6222888" inkscape:cy="4.1549938" inkscape:document-units="px" inkscape:grid-bbox="true" inkscape:object-nodes="true" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-height="740" inkscape:window-maximized="1" inkscape:window-width="1360" inkscape:window-x="0" inkscape:window-y="0" inkscape:zoom="33.811791" pagecolor="#37474f" showborder="false" showgrid="false">
<inkscape:grid empspacing="4" id="grid5636" originx="-0.28935368" originy="-119.88235" type="xygrid"></inkscape:grid>
</sodipodi:namedview>
<g id="layer4" transform="translate(-0.28935366,-60.349598)" inkscape:groupmode="layer" inkscape:label="status">
</g>
<g id="layer3" transform="translate(-0.28935366,-60.349598)" inkscape:groupmode="layer" inkscape:label="actions">
</g>
<g id="layer2">
<g id="White_K">
<path d="M17.2,1.8c-0.7-0.7-1.6-1.1-2.5-1.1H3.6c-1,0-1.9,0.4-2.5,1.1S0,3.4,0,4.3v11.1c0,1,0.4,1.9,1.1,2.5
C1.7,18.7,2.6,19,3.6,19H6V4.8h2.6v7.3l3.3-3.8h3.2L11.5,12l4.1,6.9c0.6-0.2,1.2-0.5,1.6-0.9c0.7-0.7,1.1-1.6,1.1-2.5V4.3
C18.3,3.4,17.9,2.5,17.2,1.8z"/>
<polygon points="8.6,15.1 8.6,19 12.5,19 9.6,14 "/>
</g>
</g>
<g id="layer1">
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -1,27 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 23.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1"
id="svg5082" inkscape:version="0.92.2 5c3e80d, 2017-08-06" sodipodi:docname="budgie-restart2.svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 18.3 19.8"
style="enable-background:new 0 0 18.3 19.8;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<title id="title5087">Symbolic Icons</title>
<sodipodi:namedview bordercolor="#000000" borderopacity="0.34509804" fit-margin-bottom="0" fit-margin-left="0" fit-margin-right="0" fit-margin-top="0" id="base" inkscape:current-layer="layer2" inkscape:cx="3.6222888" inkscape:cy="4.1549938" inkscape:document-units="px" inkscape:grid-bbox="true" inkscape:object-nodes="true" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-height="740" inkscape:window-maximized="1" inkscape:window-width="1360" inkscape:window-x="0" inkscape:window-y="0" inkscape:zoom="33.811791" pagecolor="#37474f" showborder="false" showgrid="false">
<inkscape:grid empspacing="4" id="grid5636" originx="-0.28935368" originy="-119.88235" type="xygrid"></inkscape:grid>
</sodipodi:namedview>
<g id="layer4" transform="translate(-0.28935366,-60.349598)" inkscape:groupmode="layer" inkscape:label="status">
</g>
<g id="layer3" transform="translate(-0.28935366,-60.349598)" inkscape:groupmode="layer" inkscape:label="actions">
</g>
<g id="layer2">
<path class="st0" d="M17.3,1.8c-0.7-0.7-1.6-1.1-2.5-1.1H3.6C1.6,0.7,0,2.3,0,4.3v11.1c0,2,1.6,3.6,3.6,3.6H6v0h2.6v0h4l0,0l0,0
h2.1c2,0,3.6-1.6,3.6-3.6V4.3C18.3,3.4,17.9,2.5,17.3,1.8z M17.2,15.4C17.2,15.5,17.2,15.5,17.2,15.4c0,1.3-1,2.3-2.2,2.5l-1.4-2.4
L12,12.8L11.5,12l1.9-2l1.6-1.7h-3.2L10.4,10l-1.8,2v-2V7.3V4.8H6v2.5V10v2.8v2.7v2.4H3.6c-1.4,0-2.5-1.1-2.5-2.4c0,0,0,0,0-0.1
v-2.7V10V7.3V4.5V4.3c0-1.4,1.1-2.5,2.5-2.5h11.1c1.4,0,2.5,1.1,2.5,2.5v0.2v2.7V10v2.8V15.4z M8.6,15.5v-0.4L9.6,14l0.9,1.5
l1.4,2.4H8.6V15.5z"/>
</g>
<g id="layer1">
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -1,23 +0,0 @@
#!/bin/bash
#Budgie Kinto Applet
#This script basically just copies the files to approproate directories.
APPLETDIR=/usr/lib/budgie-desktop/plugins
ICONDIR=/usr/share/pixmaps
PROJECT_NAME='org.budgie-desktop.applet.kinto'
echo "Installing Budgie Kinto Applet....."
mkdir -p $APPLETDIR/$PROJECT_NAME
for file in KintoApplet/*;do
install -m 0755 "$file" $APPLETDIR/$PROJECT_NAME/
done
for file in icons/*; do
install -m 0755 "$file" $ICONDIR/
done
echo "Finished Installing Applet. Restart or Re-login to find the applet in Budgie."

View File

@@ -1,26 +0,0 @@
#!/bin/bash
APPLETDIR=/usr/lib/budgie-desktop/plugins
ICONDIR=/usr/share/pixmaps
PROJECT_NAME='org.budgie-desktop.applet.kinto'
echo "Removing Budgie Kinto Applet....."
mkdir -p $APPLETDIR/$PROJECT_NAME
for file in $APPLETDIR/$PROJECT_NAME/*;do
echo "rm $file"
# rm $APPLETDIR/$PROJECT_NAME/$file
done
sudo rm -rf $APPLETDIR/$PROJECT_NAME
for file in icons/*; do
file=${file//icons/}
echo "rm $ICONDIR$file"
sudo rm $ICONDIR/$file
done
echo "Finished Removing Kinto Applet. Restart or Re-login to find the applet in Budgie."

View File

@@ -70,6 +70,7 @@ class Indicator():
help_submenu = Gtk.Menu()
helpm.set_submenu(help_submenu)
debug = Gtk.MenuItem('Debug')
opengui = Gtk.MenuItem('Open Kinto')
support = Gtk.MenuItem("Support")
about = Gtk.MenuItem('About')
global restartsvc
@@ -170,8 +171,10 @@ class Indicator():
self.edit_submenu.append(self.systray)
self.menu.append(self.edit)
self.debug.connect('activate',self.runDebug)
self.debug.connect('activate',self.runDebug,1)
self.help_submenu.append(self.debug)
self.opengui.connect('activate',self.runDebug,0)
self.help_submenu.append(self.opengui)
self.support.connect('activate',self.openSupport)
self.help_submenu.append(self.support)
self.about.connect('activate',self.runAbout)
@@ -285,8 +288,10 @@ class Indicator():
status = op.decode('utf-8').rstrip()
if "inactive" in status or "failed" in status or "deactivating" in status or "activating" in status:
stats = "inactive"
else:
elif "active" in status:
stats = "active"
else:
stats = "inactive"
return stats
def update_terminal(self):
@@ -369,9 +374,8 @@ class Indicator():
credits = Gtk.Label("Author: Ben Reaves")
spacer = Gtk.Label(" ")
copy = Gtk.Label("Copyrighted 2019, 2020 - GPLv2")
url = Gtk.LinkButton("http://kinto.sh", label="http://kinto.sh")
url2 = Gtk.Label("http://kinto.sh")
copy = Gtk.Label("© 2019, 2020 - GPLv2")
url = Gtk.LinkButton("http://kinto.sh", label="kinto.sh")
vbox.add(image)
vbox.add(version)
@@ -601,15 +605,14 @@ class Indicator():
# self.enable_id = self.checkbox_enable.connect('activate',self.setEnable,True)
# self.indicator.set_icon(os.environ['HOME']+'/.config/kinto/kinto-color.svg')
def runDebug(self,button):
def runDebug(self,button,opendebug):
try:
Popen([os.environ['HOME']+'/Documents/git-projects/kinto/xkeysnail-config/gui/kinto-gui.py','-d'])
if opendebug:
Popen([os.environ['HOME']+'/.config/kinto/gui/kinto-gui.py','-d'])
else:
Popen([os.environ['HOME']+'/.config/kinto/gui/kinto-gui.py'])
except:
Popen(['notify-send','Kinto: Error restarting Kinto!','-i','budgie-desktop-symbolic'])
self.checkbox_enable.set_active(False)
self.checkbox_enable.disconnect(self.enable_id)
self.enable_id = self.checkbox_enable.connect('activate',self.setEnable,True)
# self.indicator.set_icon(os.environ['HOME']+'/.config/kinto/kinto-color.svg')
Popen(['notify-send','Kinto: Error opening Kinto!','-i','budgie-desktop-symbolic'])
def queryConfig(self,query):
res = Popen(query, stdout=PIPE, stderr=None, shell=True)
@@ -723,12 +726,11 @@ class Indicator():
elif kbtype == "ibm":
setkb ='s/^(\s{3})(\s{1}#)(.*# IBM.*)|^(?!\s{4}#)(\s{3})(\s{1})(.*)( # )(WinMac.*)|^(?!\s{4}#)(\s{3})(\s{1})(.*)( # )(Mac.*)|^(?!\s{4}#)(\s{3})(\s{1})(.*)( # )(Chromebook.*)|^(\s{3})(\s{1}# )(-)(- Default (Win|Mac.*))/ $3$7$6$7$8$12$11$12$13$17$16$17$18$20$22/g'
restart = ['sudo', 'systemctl','restart','xkeysnail']
cmds = ['perl','-pi','-e',setkb,self.kconfig]
cmdsTerm = Popen(cmds)
cmdsTerm.wait()
restart = ['sudo', 'systemctl','restart','xkeysnail']
Popen(restart)
except CalledProcessError:

View File

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

View File

@@ -86,38 +86,6 @@ function removeAppleKB {
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."
sudo /usr/local/bin/logoff.sh $USER $DISPLAY&
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 {
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..."
@@ -181,170 +149,130 @@ function budgieUpdate {
fi
}
if [ $# -eq 0 ]; then
echo "Install Kinto - xkeysnail (udev)"
echo " 1) Windows & Mac (HID driver) - Most Standard keyboards (& 1st party usb/bt Apple keyboards)"
echo " 2) Mac Only & VMs on Macbooks - 3rd & 1st party Apple keyboards"
echo " 3) Chromebook - Chromebook running Linux"
echo " 4) IBM M - Keyboards w/o Super/Win keys"
# echo " 5) Uninstall"
# if [ $# -eq 0 ]; then
# echo "Install Kinto - xkeysnail (udev)"
# echo " 1) Windows & Mac (HID driver) - Most Standard keyboards (& 1st party usb/bt Apple keyboards)"
# echo " 2) Mac Only & VMs on Macbooks - 3rd & 1st party Apple keyboards"
# echo " 3) Chromebook - Chromebook running Linux"
# echo " 4) IBM M - Keyboards w/o Super/Win keys"
# # echo " 5) Uninstall"
read n
# read n
set "$n"
# set "$n"
# fi
# branch=$(git rev-parse --abbrev-ref HEAD)
# if [ "$branch" == "dev" ] || [ "$branch" == "alpha" ];then
# while true; do
# read -rep $'\nExperimental Support for Firefox/Chrome Back/Forward hotkeys (Cmd+Left/Right)?\n(Keys could get stuck, switch windows or press ctrl &/or super to release) (y/n)\n' yn
# case $yn in
# [Yy]* ) exp='/sbin/runuser -l {username} -c "export DISPLAY={displayid};{homedir}/.config/kinto/caret_status_xkey.sh\&";'; expsh='"{homedir}/.config/kinto/caret_status_xkey.sh"'; break;;
# [Nn]* ) exp=" "; expsh=" " break;;
# # * ) echo "Please answer yes or no.";;
# esac
# done
# else
# echo -e "\nSupport for Firefox/Chrome Back/Forward hotkeys (Cmd+Left/Right) disabled on $branch w/ xkeysnail \n"
exp=" "
expsh=" "
# fi
# sudo systemctl enable xkeysnail >/dev/null 2>&1
# 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
if ! [ -x "$(command -v pip3)" ]; then
echo "Will need to install python3-pip..."
sudo ./system-config/unipkg.sh python3-pip
fi
# Kinto tray
installtray=false
# multi-language
rightalt=false
# VS code remap
vssublime=false
if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "4" || $1 == "winmac" || $1 == "mac" || $1 == "chromebook" || $1 == "ibm" ]]; then
if [[ $dename == "gnome" || $dename == "budgie" || $dename == "mate" || $dename == "xfce" ]];then
installtray=true
while true; do
read -rep $'\nWould you like to install the Kinto System Tray (AppInidcator)? (Y/n)\n' yn
case $yn in
[Nn]* ) installtray=false; break;;
* ) break;;
esac
done
if [[ $dename == "gnome" ]]; then
echo "Please install KStatusNotifierItem for AppIndicators to show up."
echo "https://extensions.gnome.org/extension/615/appindicator-support/"
echo "Note: This may still fail. If so use the Kinto gui app instead."
read -p "Press enter to continue"
fi
if ! [ -x "$(command -v python3-config)" ]; then
if [ "$distro" == "ubuntu" ] || [ "$distro" == "debian" ] || [ "$distro" == '"linux mint"' ]; then
pydev="python3-dev"
elif [ "$distro" == "fedora" ]; then
pydev="python3-devel"
fi
while true; do
read -rep $'\nDo you want multi-language on Right Alt key? (y/N)\naka Left side remaps, right side doesn\'t\n' yn
case $yn in
[Yy]* ) rightalt=true; break;;
* ) break;;
esac
done
while true; do
read -rep $'\nWould you like to give VS Code Sublime Text keymaps? (y/N)\n' yn
case $yn in
[Yy]* ) vssublime=true; break;;
* ) break;;
esac
done
# branch=$(git rev-parse --abbrev-ref HEAD)
# if [ "$branch" == "dev" ] || [ "$branch" == "alpha" ];then
# while true; do
# read -rep $'\nExperimental Support for Firefox/Chrome Back/Forward hotkeys (Cmd+Left/Right)?\n(Keys could get stuck, switch windows or press ctrl &/or super to release) (y/n)\n' yn
# case $yn in
# [Yy]* ) exp='/sbin/runuser -l {username} -c "export DISPLAY={displayid};{homedir}/.config/kinto/caret_status_xkey.sh\&";'; expsh='"{homedir}/.config/kinto/caret_status_xkey.sh"'; break;;
# [Nn]* ) exp=" "; expsh=" " break;;
# # * ) echo "Please answer yes or no.";;
# esac
# done
# else
# echo -e "\nSupport for Firefox/Chrome Back/Forward hotkeys (Cmd+Left/Right) disabled on $branch w/ xkeysnail \n"
exp=" "
expsh=" "
# fi
sudo systemctl enable xkeysnail >/dev/null 2>&1
# 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
if ! [ -x "$(command -v pip3)" ]; then
echo "Will need to install python3-pip..."
sudo ./system-config/unipkg.sh python3-pip
fi
if ! [ -x "$(command -v python3-config)" ]; then
if [ "$distro" == "ubuntu" ] || [ "$distro" == "debian" ] || [ "$distro" == '"linux mint"' ]; then
pydev="python3-dev"
elif [ "$distro" == "fedora" ]; then
pydev="python3-devel"
fi
if [ "$distro" == "gnome" ] || [ "$distro" == "fedora" ] || [ "$distro" == "debian" ] || [ "$distro" == '"linux mint"' ]; then
echo "Will need to install $pydev..."
sudo ./system-config/unipkg.sh "$pydev"
fi
fi
if ! [ -x "$(command -v xhost)" ] || ! [ -x "$(command -v gcc)" ]; then
if [ "$distro" == "\"manjaro linux\"" ]; then
sudo ./system-config/unipkg.sh "xorg-xhost gcc"
fi
fi
if [ "$distro" == '"linux mint"' ]; then
pip3 install setuptools
fi
# echo "Transferring files..."
mkdir -p ~/.config/kinto
# KDE xhost fix
# mkdir -p ~/.kde/Autostart
# echo -e '#!/bin/sh\rxhost +SI:localuser:root' > ~/.kde/Autostart/kintohost.sh
# chmod +x ~/.kde/Autostart/kintohost.sh
# KDE startup - xhost fix
mkdir -p ~/.config/autostart
yes | cp -rf ./xkeysnail-config/xkeysnail.desktop ~/.config/autostart/xkeysnail.desktop
# yes | cp -rf ./xkeysnail-config/xkeystart.sh ~/.config/kinto/xkeystart.sh
# *** More testing needing, universal way of killing kinto on user log out? ***
# yes | sudo cp -rf xkeysnail-config/root_logoff.sh /usr/local/bin/logoff.sh
# sudo chown root:root /usr/local/bin/logoff.sh
# sudo chmod u+rwx /usr/local/bin/logoff.sh
# sudo chmod go-w+rx /usr/local/bin/logoff.sh
# *** End universal killing of kinto
if $installtray ; then
yes | sudo cp -rf xkeysnail-config/gnome_logoff.sh ~/.config/kinto/logoff.sh
fi
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/killdups.sh ~/.config/kinto/killdups.sh
yes | cp -rf ./xkeysnail-config/appleKB.sh ~/.config/kinto/appleKB.sh
yes | cp -rf ./xkeysnail-config/trayapps/appindicator/kintotray.py ~/.config/kinto/kintotray.py
yes | cp -rf ./xkeysnail-config/trayapps/appindicator/kintotray.desktop ~/.config/kinto/kintotray.desktop
yes | cp -rf ./xkeysnail-config/trayapps/BudgieApplet/icons/kinto-color-16.svg ~/.config/kinto/kinto-color.svg
yes | cp -rf ./xkeysnail-config/trayapps/BudgieApplet/icons/kinto-invert-16.svg ~/.config/kinto/kinto-invert.svg
yes | cp -rf ./xkeysnail-config/trayapps/BudgieApplet/icons/kinto-solid-16.svg ~/.config/kinto/kinto-solid.svg
# 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.timer ~/.config/systemd/user/xkeysnail.timer
sed -i "s#{experimental-caret}#$exp#g" ./xkeysnail-config/xkeysnail.service.new
if [ "$expsh" != " " ];then
sed -i "s#{kill-caret}#/usr/bin/pkill -f $expsh#g" ./xkeysnail-config/xkeysnail.service.new
else
sed -i "s#{kill-caret}#$expsh#g" ./xkeysnail-config/xkeysnail.service.new
fi
sed -i "s/{username}/`whoami`/g" ./xkeysnail-config/xkeysnail.service.new
sed -i "s#{homedir}#`echo "$HOME"`#g" ./xkeysnail-config/xkeysnail.service.new
sed -i "s#{homedir}#`echo "$HOME"`#g" ~/.config/kinto/kintotray.desktop
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#{systemctl}#`\\which systemctl`#g" ./xkeysnail-config/limitedadmins.new
sed -i "s#{pkill}#`\\which pkill`#g" ./xkeysnail-config/limitedadmins.new
sed -i "s#{xkeysnail}#/usr/local/bin/xkeysnail#g" ./xkeysnail-config/limitedadmins.new
sudo chown root:root ./xkeysnail-config/limitedadmins.new
sudo mv ./xkeysnail-config/limitedadmins.new /etc/sudoers.d/limitedadmins
sed -i "s#{systemctl}#`\\which systemctl`#g" ~/.config/autostart/xkeysnail.desktop
yes | cp -rf ~/.config/kinto/kintotray.desktop ~/.config/autostart/kintotray.desktop
if $installtray ; then
sed -i "s#-c \"grep#-c \"python3 {homedir}/.config/kinto/kintotray.py;grep#g" ~/.config/autostart/xkeysnail.desktop
sed -i "s#xkeysnail\"#xkeysnail;{homedir}/.config/kinto/logoff.sh\"#g" ~/.config/autostart/xkeysnail.desktop
fi
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/kinto/prexk.sh
sed -i "s/{displayid}/`echo "$DISPLAY"`/g" ./xkeysnail-config/xkeysnail.service.new
# sed -i "s/{displayid}/`echo "$DISPLAY"`/g" ~/.config/kinto/prexk.sh
if $vssublime ; then
perl -pi -e "s/(# )(.*)(- Sublime)/\$2\$3/g" ./xkeysnail-config/kinto.py.new >/dev/null 2>&1
if [ "$distro" == "gnome" ] || [ "$distro" == "fedora" ] || [ "$distro" == "debian" ] || [ "$distro" == '"linux mint"' ]; then
echo "Will need to install $pydev..."
sudo ./system-config/unipkg.sh "$pydev"
fi
fi
if ! [ -x "$(command -v xhost)" ] || ! [ -x "$(command -v gcc)" ]; then
if [ "$distro" == "\"manjaro linux\"" ]; then
sudo ./system-config/unipkg.sh "xorg-xhost gcc"
fi
fi
if [ "$distro" == '"linux mint"' ]; then
pip3 install setuptools
fi
# echo "Transferring files..."
mkdir -p ~/.config/kinto
# KDE xhost fix
# mkdir -p ~/.kde/Autostart
# echo -e '#!/bin/sh\rxhost +SI:localuser:root' > ~/.kde/Autostart/kintohost.sh
# chmod +x ~/.kde/Autostart/kintohost.sh
# KDE startup - xhost fix
mkdir -p ~/.config/autostart
yes | cp -rf ./xkeysnail-config/xkeysnail.desktop ~/.config/kinto/xkeysnail.desktop
# yes | cp -rf ./xkeysnail-config/xkeystart.sh ~/.config/kinto/xkeystart.sh
# *** More testing needing, universal way of killing kinto on user log out? ***
# yes | sudo cp -rf xkeysnail-config/root_logoff.sh /usr/local/bin/logoff.sh
# sudo chown root:root /usr/local/bin/logoff.sh
# sudo chmod u+rwx /usr/local/bin/logoff.sh
# sudo chmod go-w+rx /usr/local/bin/logoff.sh
# *** End universal killing of kinto
# logoff fix - not solid for every os. Prevents missed 1 character input on login
# yes | sudo cp -rf xkeysnail-config/gnome_logoff.sh ~/.config/kinto/logoff.sh
git describe --tags --always origin master | perl -ne "print \"\$1 build `git rev-parse --short HEAD`\n\" for m/\b(.*)-\w+-\w{8}/" | head -n 1 > ~/.config/kinto/version
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/gui/ ~/.config/kinto/
yes | cp -nrf ./xkeysnail-config/initkb ~/.config/kinto/initkb
yes | cp -rf ./xkeysnail-config/killdups.sh ~/.config/kinto/killdups.sh
yes | cp -rf ./xkeysnail-config/appleKB.sh ~/.config/kinto/appleKB.sh
yes | cp -rf ./xkeysnail-config/trayapps/appindicator/kintotray.py ~/.config/kinto/kintotray.py
yes | cp -rf ./xkeysnail-config/trayapps/appindicator/kintotray.desktop ~/.config/kinto/kintotray.desktop
yes | cp -rf ./xkeysnail-config/gui/kinto.desktop ./xkeysnail-config/gui/kinto.desktop.new
yes | cp -rf ./xkeysnail-config/trayapps/appindicator/icons/kinto-color-16.svg ~/.config/kinto/kinto-color.svg
yes | cp -rf ./xkeysnail-config/trayapps/appindicator/icons/kinto-color-16.svg ~/.config/kinto/kinto-color-48.svg
yes | cp -rf ./xkeysnail-config/trayapps/appindicator/icons/kinto-invert-16.svg ~/.config/kinto/kinto-invert.svg
yes | cp -rf ./xkeysnail-config/trayapps/appindicator/icons/kinto-solid-16.svg ~/.config/kinto/kinto-solid.svg
yes | cp -rf ./xkeysnail-config/trayapps/appindicator/icons/kinto.svg ~/.config/kinto/kinto.svg
# 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.timer ~/.config/systemd/user/xkeysnail.timer
sed -i "s#{experimental-caret}#$exp#g" ./xkeysnail-config/xkeysnail.service.new
if [ "$expsh" != " " ];then
sed -i "s#{kill-caret}#/usr/bin/pkill -f $expsh#g" ./xkeysnail-config/xkeysnail.service.new
else
sed -i "s#{kill-caret}#$expsh#g" ./xkeysnail-config/xkeysnail.service.new
fi
sed -i "s/{username}/`whoami`/g" ./xkeysnail-config/xkeysnail.service.new
sed -i "s#{homedir}#`echo "$HOME"`#g" ./xkeysnail-config/xkeysnail.service.new
sed -i "s#{homedir}#`echo "$HOME"`#g" ~/.config/kinto/kintotray.desktop
sed -i "s#{homedir}#`echo "$HOME"`#g" ~/.config/kinto/gui/kinto-gui.py
sed -i "s#{homedir}#`echo "$HOME"`#g" ./xkeysnail-config/gui/kinto.desktop.new
sudo mv ./xkeysnail-config/gui/kinto.desktop.new /usr/share/applications/kinto.desktop
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#{systemctl}#`\\which systemctl`#g" ./xkeysnail-config/limitedadmins.new
sed -i "s#{pkill}#`\\which pkill`#g" ./xkeysnail-config/limitedadmins.new
sed -i "s#{xkeysnail}#/usr/local/bin/xkeysnail#g" ./xkeysnail-config/limitedadmins.new
sudo chown root:root ./xkeysnail-config/limitedadmins.new
sudo mv ./xkeysnail-config/limitedadmins.new /etc/sudoers.d/limitedadmins
sed -i "s#{systemctl}#`\\which systemctl`#g" ~/.config/kinto/xkeysnail.desktop
sed -i "s#{xhost}#`\\which xhost`#g" ~/.config/kinto/xkeysnail.desktop
sed -i "s#{homedir}#`echo "$HOME"`#g" ~/.config/kinto/xkeysnail.desktop
# 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" ~/.config/kinto/prexk.sh
if [[ $dename == "gnome" || dename == "budgie" ]]; then
perl -pi -e "s/(# )(.*)(# gnome)/\$2\$3/g" ./xkeysnail-config/kinto.py.new >/dev/null 2>&1
@@ -354,53 +282,21 @@ if [[ $dename == "kde" ]]; then
perl -pi -e "s/(# )(.*)(#.*kde)/\$2\$3/g" ./xkeysnail-config/kinto.py.new >/dev/null 2>&1
fi
if [[ $1 == "1" || $1 == "winmac" ]]; then
if ls /sys/module | grep hid_apple >/dev/null 2>&1 ; then
echo '1' | sudo tee /sys/module/hid_apple/parameters/swap_opt_cmd;echo 'options hid_apple swap_opt_cmd=1' | sudo tee /etc/modprobe.d/hid_apple.conf;sudo update-initramfs -u -k all
fi
if ls /sys/module | grep applespi >/dev/null 2>&1 ; then
echo '1' | sudo tee /sys/module/applespi/parameters/swap_opt_cmd;echo 'options applespi swap_opt_cmd=1' | sudo tee /etc/modprobe.d/applespi.conf;sudo update-initramfs -u -k all
fi
if ! ls /sys/module | grep apple ; then
removeAppleKB
fi
perl -pi -e "s/(# )(.*)(# WinMac)/\$2\$3/g" ./xkeysnail-config/kinto.py.new
if [[ $dename == "xfce" ]]; then
perl -pi -e "s/(# )(.*)(# xfce4)/\$2\$3/g" ./xkeysnail-config/kinto.py.new
perl -pi -e "s/(\w.*)(# Default not-xfce4)/# \$1\$2/g" ./xkeysnail-config/kinto.py.new
fi
elif [[ $1 == "2" || $1 == "mac" ]]; then
removeAppleKB
perl -pi -e "s/(# )(.*)(# Mac)/\$2\$3/g" ./xkeysnail-config/kinto.py.new
if [[ $dename == "xfce" ]]; then
perl -pi -e "s/(# )(.*)(# xfce4)/\$2\$3/g" ./xkeysnail-config/kinto.py.new
perl -pi -e "s/(\w.*)(# Default not-xfce4)/# \$1\$2/g" ./xkeysnail-config/kinto.py.new
fi
elif [[ $1 == "3" || $1 == "chromebook" ]]; then
perl -pi -e "s/(# )(.*)(# Chromebook)/\$2\$3/g" ./xkeysnail-config/kinto.py.new
if [[ $dename == "xfce" ]]; then
perl -pi -e "s/(# )(.*)(# xfce4)/\$2\$3/g" ./xkeysnail-config/kinto.py.new
perl -pi -e "s/(\w.*)(# Default)/# \$1\$2/g" ./xkeysnail-config/kinto.py.new
elif [[ $1 == "4" || $1 == "ibm" ]]; then
perl -pi -e "s/(# )(.*)(# IBM)/\$2\$3/g" ./xkeysnail-config/kinto.py.new
perl -pi -e "s=(# )(.*)(# Chromebook/IBM)=\$2\$3=g" ./xkeysnail-config/kinto.py.new
# perl -pi -e "s/(# )(.*)(# xfce4)/\$2\$3/g" ./xkeysnail-config/kinto.py.new
perl -pi -e "s/(\w.*)(# Default)/# \$1\$2/g" ./xkeysnail-config/kinto.py.new
perl -pi -e "s/(\w.*)(# Default not-xfce4)/# \$1\$2/g" ./xkeysnail-config/kinto.py.new
fi
if [[ $dename == "xfce" ]] && ls /etc/apt/sources.list.d/enso* 1> /dev/null 2>&1; then
echo "enso OS detected, applying Cmd-Space for Launchy..."
perl -pi -e "s/(K\(\"RC-Space)(.*)(# )(xfce4)/\$3\$1\$2\$3\$4/g" ./xkeysnail-config/kinto.py.new >/dev/null 2>&1
xfconf-query --channel xfce4-keyboard-shortcuts --property "/commands/custom/<Primary>space" --create --type string --set "launchy"
fi
if $rightalt ; then
perl -pi -e "s/(\w.*)(Multi-language)/# \$1\$2/g" ./xkeysnail-config/kinto.py.new >/dev/null 2>&1
fi
if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1 == "chromebook" ]]; then
if ! [[ $1 == "5" || $1 == "uninstall" || $1 == "Uninstall" ]]; then
mv ./xkeysnail-config/kinto.py.new ~/.config/kinto/kinto.py
git describe --tags | perl -ne "print \"\$1 build `git rev-parse --short HEAD`\n\" for m/\b(.*)-\w+-\w{8}/" > ~/.config/kinto/version
# if [ "$distro" == "fedora" ];then
sudo rm /etc/systemd/system/xkeysnail.service
sudo rm /etc/systemd/system/xkeysnail.service >/dev/null 2>&1
if [ -d /usr/lib/systemd/system ];then
xkeypath="/usr/lib/systemd/system/"
elif [ -d /lib/systemd/system ];then
@@ -428,15 +324,20 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1
cd ..
sudo systemctl daemon-reload
sudo systemctl disable xkeysnail
sudo systemctl stop xkeysnail
# sudo systemctl --state=not-found --all | grep xkeysnail
# if [ "$distro" == "fedora" ];then
# systemctl enable xkeysnail.service
# else
# sudo systemctl enable xkeysnail.service
# fi
sudo systemctl restart xkeysnail
sudo pkill -f kintotray >/dev/null 2>&1
nohup python3 ~/.config/kinto/kintotray.py& >/dev/null 2>&1
# sudo systemctl restart xkeysnail
if ! [[ $dename == "gnome" || $dename == "kde" ]];then
sudo pkill -f kintotray >/dev/null 2>&1
else
sed -i "s/systray = true/systray = false/g" ~/.config/kinto/initkb
fi
nohup python3 ~/.config/kinto/gui/kinto-gui.py >/dev/null 2>&1 &
echo -e "Adding xhost fix...\n"
@@ -459,27 +360,6 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1
fi
echo -e "Kinto install is \e[1m\e[32mcomplete\e[0m.\n"
if `sudo systemctl is-active --quiet xkeysnail`;then
echo -e "Kinto \e[1m\e[32mxkeysnail service is running\e[0m.\n"
echo "Commands for controlling Kinto's xkeysnail service"
echo "sudo systemctl restart xkeysnail"
echo "sudo systemctl stop xkeysnail"
echo "sudo systemctl start xkeysnail"
echo "sudo systemctl status xkeysnail"
else
echo -e "Kinto \e[1m\e[91mxkeysnail service has failed.\e[0m"
echo "You can run 'sudo systemctl status xkeysnail' for more info"
echo "You can also run 'sudo journalctl -u xkeysnail'"
fi
echo ""
if $vssublime ; then
echo -e "\e[1m\e[32mEnabled\e[0m VS Code Sublime Text remap."
fi
if $rightalt ; then
echo -e "\e[1m\e[32mEnabled\e[0m mutli-language support."
fi
# trayApp
elif [[ $1 == "5" || $1 == "uninstall" || $1 == "Uninstall" ]]; then
echo "Uninstalling Kinto - xkeysnail (udev)"
@@ -488,12 +368,17 @@ elif [[ $1 == "5" || $1 == "uninstall" || $1 == "Uninstall" ]]; then
pkill -f kintotray >/dev/null 2>&1
sudo systemctl stop xkeysnail >/dev/null 2>&1
sudo systemctl disable xkeysnail >/dev/null 2>&1
sudo rm /etc/sudoers.d/limitedadmins
rm ~/.config/autostart/xkeysnail.desktop
rm -rf ~/.config/kinto
sudo pkill -f bin/xkeysnail >/dev/null 2>&1
sudo pkill -f "is-active xkeysnail" >/dev/null 2>&1
sudo rm /etc/sudoers.d/limitedadmins >/dev/null 2>&1
rm ~/.config/autostart/xkeysnail.desktop >/dev/null 2>&1
rm ~/.config/autostart/kintotray.desktop >/dev/null 2>&1
rm -rf ~/.config/kinto >/dev/null 2>&1
sudo rm /etc/systemd/system/xkeysnail.service >/dev/null 2>&1
sudo rm /usr/share/applications/kinto.desktop >/dev/null 2>&1
sudo rm /etc/systemd/system/graphical.target.wants/xkeysnail.service >/dev/null 2>&1
sudo rm /usr/lib/systemd/system/xkeysnail.service >/dev/null 2>&1
sudo rm /lib/systemd/system/xkeysnail.service >/dev/null 2>&1
if [ -f /usr/local/bin/logoff.sh ];then
sudo rm /usr/local/bin/logoff.sh
fi