Merge branch 'dev' into alpha

This commit is contained in:
Ben Reaves
2020-06-14 15:03:57 -05:00
18 changed files with 526 additions and 285 deletions

View File

@@ -19,21 +19,16 @@ A clear and concise description of what you expected to happen.
**Branch:** master, dev **Branch:** master, dev
**Commit:** git rev-parse --short HEAD **Commit:** git rev-parse --short HEAD
**Kinto Input Caret Status** Logs and status if relevant
```
cat /tmp/kinto/caret
``` ```
# xkeysnail
sudo systemctl status xkeysnail
sudo journalctl --unit=xkeysnail.service -b
**Kinto Standard Log** # xkb
``` systemctl --user status keyswap
journalctl --user-unit=keyswap.service -b journalctl --user-unit=keyswap.service -b
``` ```
**Kinto Debug Log (1.0.6-2+)**
```
systemctl --user stop keyswap
cd ~/.config/kinto
./kintox11 --debug
```
**Screenshots** **Screenshots**
If applicable, add screenshots to help explain your problem. If applicable, add screenshots to help explain your problem.

View File

@@ -1,14 +1,13 @@
# Kinto # Kinto
![kinto_carrot](https://user-images.githubusercontent.com/10969616/77842401-4744b500-7157-11ea-854a-d7dec6f9a250.gif) ![kinto-color-132](https://user-images.githubusercontent.com/10969616/84361571-7d5bd780-ab91-11ea-81bc-4d3a2ca51c4e.png)
![alt text](https://raw.githubusercontent.com/rbreaves/kinto/master/Kinto.png)
[![GitHub release](https://img.shields.io/github/release/rbreaves/kinto.svg)](https://github.com/rbreaves/kinto/releases/latest) [![GitHub release](https://img.shields.io/github/release/rbreaves/kinto.svg)](https://github.com/rbreaves/kinto/releases/latest)
\- Type in Linux & Windows like it's a Mac. \- \- Type in Linux & Windows like it's a Mac. \-
Seamless copy and paste with all apps and terminals. Also the only linux remapper that is aware of your cursor/caret status - meaning it avoids shortcut conflicts within an app versus wordwise shortcuts when a text field is in use. (xkeysnail implementation of Kinto has caret checking disabled in master for now.) Seamless copy and paste with all apps and terminals. The zero effort solution.
## Table of Contents ## Table of Contents
@@ -40,15 +39,23 @@ Seamless copy and paste with all apps and terminals. Also the only linux remappe
## What does this do exactly? ## What does this do exactly?
Kinto works for standard Windows, Apple and Chromebook keyboards. The following however describes the dynamic rebinding based on a standard Windows keyboard. (Alt location is Cmd for Apple keyboards) Kinto works for standard Windows, Apple and Chromebook keyboards. The following however describes the dynamic rebinding based on a standard Windows/Mac keyboard.
- Normal apps - Alt → Ctrl, Win/Super → Alt, Ctrl → Win/Super
- Terminal apps - Alt → Ctrl+Shift, Win/Super → Alt, Ctrl → Ctrl
- Cursor/word-wise shortcut keys have been added to align with macOS keyboard shortcuts. - Cursor/word-wise shortcut keys have been added to align with macOS keyboard shortcuts.
Does Kinto have to have specific keyamps for individual apps? **GUI**
|**Physical**| Ctrl | Win/Alt | Alt/Cmd | Spacebar|
|---|---|---|---|---|
|**Virtual**| Win/Super* | Alt | RCtrl |Spacebar|
*Win/Super will properly remap to LCtrl when needed to fully support expected keymaps.
**Terminal**
|**Physical**| Ctrl | Win/Alt | Alt/Cmd | Spacebar|
|---|---|---|---|---|
|**Virtual**| LCtrl | Alt | RCtrl |Spacebar|
Does Kinto have to have specific keymaps for individual apps?
I'd say 90+% of the time no, but every OS has their default conventions that sometimes run afoul to macs. For this reason you can easily edit kinto.py or kinto.ahk to support the few shortcut keys Kinto may miss. If you do add additional support please consider forking this project and sharing your new keymaps with the rest of us! I'd say 90+% of the time no, but every OS has their default conventions that sometimes run afoul to macs. For this reason you can easily edit kinto.py or kinto.ahk to support the few shortcut keys Kinto may miss. If you do add additional support please consider forking this project and sharing your new keymaps with the rest of us!
@@ -78,7 +85,15 @@ Other programs that will be installed when you run ./setup.py
- Chocolatey - Chocolatey
- Autohotkey - Autohotkey
Does not have complete parity with the Linux edition, but it does work and can be built on and added to as needed. Modify ./windows/kinto.ahk if you want to add more WSL editions or other terminals. Note: Sublime Text users should disable screen rotation hotkeys as they will interfere with multi-cursor and possibly other combos. See https://windowsloop.com/disable-screen-rotation-keyboard-shortcut/ for details.
Does not have complete parity with the Linux edition, but it is getting very close now. Only lacks some Sublime Text 3 remaps at this point.
Users can now hotswap between Apple and Windows based keyboards without having to logoff and back on, and Windows is currently the only implementation with a system tray (but this feature is coming to Budgie, XFCE, Mate, Gnome, and lastly KDE).
<img src="https://user-images.githubusercontent.com/10969616/84471498-100c7d00-ac4b-11ea-972d-60c1907831ec.png" width="50%">
<img src="https://user-images.githubusercontent.com/10969616/84471501-10a51380-ac4b-11ea-9e0e-c19a7ebfad6d.png" width="50%">
## How to install ## How to install
@@ -346,11 +361,6 @@ sudo systemctl start xkeysnail
sudo systemctl status xkeysnail sudo systemctl status xkeysnail
``` ```
## Notes about Windows 10
Sharpkeys was used to create the layout/reg files to swap the Ctrl, Win and Alt keys. Sharpkeys was not required however because the reg keys were extracted. Autohotkey is used to manage keyswaps needed for terminal usage. Autohotkey is also used to add additional mac like keybinds for Sublime text and can be used for other apps as well.
Microsoft is working on a new Powertoy Keyboard Manager that could be used with an easier to use GUI interface, but this approach should be fully sufficient for a mac like experience and autohotkeys appears to be more than capable enough to handle complex rebinding of any or most mac like shortcuts.
## Language Support ## Language Support
I'd appreciate any help from people with non-US based keyboards, to help ensure that these keymaps and keyswap methods work in all or most languages. I'd appreciate any help from people with non-US based keyboards, to help ensure that these keymaps and keyswap methods work in all or most languages.
@@ -363,12 +373,21 @@ https://superuser.com/questions/385748/binding-superc-superv-to-copy-and-paste
Yet another keyboard remapping tool for X environment Yet another keyboard remapping tool for X environment
[mac-precision-touchpad](https://github.com/imbushuo/mac-precision-touchpad) by imbushuo
Windows 10 touchpad to precision touchpad driver
[fusuma](https://github.com/iberianpig/fusuma) by iberianpig [fusuma](https://github.com/iberianpig/fusuma) by iberianpig
Multitouch gestures with libinput driver on Linux Multitouch gestures with libinput driver on Linux
[Facetime HD Camera for Linux](https://github.com/patjak/bcwc_pcie) by patjak
Linux driver for Facetime HD on macbooks
[Fluent Terminal - Windows only](https://github.com/felixse/FluentTerminal) by felixse [Fluent Terminal - Windows only](https://github.com/felixse/FluentTerminal) by felixse
A Terminal Emulator based on UWP and web technologies. A Terminal Emulator based on UWP and web technologies.
[PowerToys - Windows only](https://github.com/microsoft/PowerToys) by microsoft [PowerToys - Windows only](https://github.com/microsoft/PowerToys) by microsoft
@@ -464,7 +483,7 @@ GPL v2
I would just like to thank a few people here directly that have helped me tremendously with completing this project and without their support, direct, indirect or otherwise I would have had difficulty completing this undertaking. I will list these things off in chronological order mostly. I would just like to thank a few people here directly that have helped me tremendously with completing this project and without their support, direct, indirect or otherwise I would have had difficulty completing this undertaking. I will list these things off in chronological order mostly.
First off I'd like to thank the Stackoverflow and Stackexchange community. I have probably rubbed some mods the wrong way over there, but the people from the community in general are extremely helpful and gracious and without their contributions would have made this much more difficult. The person I'd like to thank most though from over there is Glen Whitney. Without his detailed explaining of how to rebind keys in xkb this would not have come together at all, as every other remapping solution were non-starters as complexity increases. First off I'd like to thank the Stackoverflow and Stackexchange community. I have probably rubbed some mods the wrong way over there, but the people from the community in general are extremely helpful and gracious and without their contributions would have made this much more difficult. The person I'd like to thank most though from over there is Glen Whitney. Without his detailed explaining of how to rebind keys in xkb this would not have come together at all, as every other remapping solution were non-starters as complexity increases. *Kinto today no longer uses xkb, but Glen Whitney did provide the basis of a workable method that helped me pursue this method and think it was a worthwhile project to pursue, so for that I thank him.*
Secondarily I'd like to thank Christian Eriksson*, as he provided information that kept me up at night.. literally. Even after I implemented a similar bash script to one he had suggested I knew that fully implementing a c/c++ solution was where Kinto needed to head to and his explaination was better than I remember it being now that I have gone back to read it again. He also never provided a full implementation of a c/c++ solution - he did hit on the pain points pretty well of what one would need to do and watch out for. I am not sure where I got the first example code of implementing a c based solution, but he definitely went over it well. Secondarily I'd like to thank Christian Eriksson*, as he provided information that kept me up at night.. literally. Even after I implemented a similar bash script to one he had suggested I knew that fully implementing a c/c++ solution was where Kinto needed to head to and his explaination was better than I remember it being now that I have gone back to read it again. He also never provided a full implementation of a c/c++ solution - he did hit on the pain points pretty well of what one would need to do and watch out for. I am not sure where I got the first example code of implementing a c based solution, but he definitely went over it well.
@@ -473,6 +492,10 @@ Kui and his gist file** was really the c based solution that I found had the few
Lastly these four people were also very helpful to me as well. @probonopd for being one of the first people to install and use Kinto and gave me the initial feedback to include wordwise support! He also has really great articles*** posted on HackerNews & Medium about UI/UX design. Another person I'd like to thank is @owzim, his feedback allowed me to rapidly iterate and fix several bugs to support additional platforms better. The last two are members of the #ubuntu channel in IRC on freenode, tarzeau ( @alexmyczko ) and sarnold. Alex contributing a proper Makefile, so the project can be packaged properly, and sarnold help me find that IBus could resolve an issue I was having with needing to detect the caret status. Lastly these four people were also very helpful to me as well. @probonopd for being one of the first people to install and use Kinto and gave me the initial feedback to include wordwise support! He also has really great articles*** posted on HackerNews & Medium about UI/UX design. Another person I'd like to thank is @owzim, his feedback allowed me to rapidly iterate and fix several bugs to support additional platforms better. The last two are members of the #ubuntu channel in IRC on freenode, tarzeau ( @alexmyczko ) and sarnold. Alex contributing a proper Makefile, so the project can be packaged properly, and sarnold help me find that IBus could resolve an issue I was having with needing to detect the caret status.
**Updated 6/13/2020**
I would also like to thank Jonathan Chun for his patience in helping me work through a very difficult problem related to Alt-Tab switching, which led to the current xkeysnail iteration of Kinto for Linux that far exceeds the original xkb implementation. There are also several others that have created issue tickets that have contributed greatly.
If I left anyone out then I apologize, that was not intentional. I am happy to say that this project is at a state of completion. Bug fixes will primarily be the only activity happening going forward and possibly a rewrite for Wayland at some point. Contributions as mentioned above are welcomed, and will be merged into master if they help with the goal of making typing on linux more like a mac. If I left anyone out then I apologize, that was not intentional. I am happy to say that this project is at a state of completion. Bug fixes will primarily be the only activity happening going forward and possibly a rewrite for Wayland at some point. Contributions as mentioned above are welcomed, and will be merged into master if they help with the goal of making typing on linux more like a mac.
*https://askubuntu.com/questions/1010276/can-i-act-on-the-event-that-a-window-opens-without-polling *https://askubuntu.com/questions/1010276/can-i-act-on-the-event-that-a-window-opens-without-polling

BIN
assets/kinto-black.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

BIN
assets/kinto-color.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

BIN
assets/kinto-white.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

View File

@@ -7,39 +7,46 @@ from prekinto import *
homedir = os.path.expanduser("~") homedir = os.path.expanduser("~")
def windows_setup(): def windows_setup():
keymaps = ["Apple keyboard standard", "Apple keyboard w/ Caps lock as Esc", "Windows keyboard standard", "Windows keyboard w/ Caps lock as Esc","Uninstall"] keymaps = ["Apple keyboard standard", "Windows keyboard standard","Uninstall"]
for index, item in enumerate(keymaps): for index, item in enumerate(keymaps):
print(" %i. %s" % (index+1, item.capitalize())) print(" %i. %s" % (index+1, item.capitalize()))
default = 0 default = 0
while not int(default) in range(1,len(keymaps)+1): while not int(default) in range(1,len(keymaps)+1):
default = int(input("\nPlease enter your desired keymap (1 - " + str(len(keymaps)) + ") : ")) default = int(input("\nPlease enter your desired keymap (1 - " + str(len(keymaps)) + ") : "))
print("") print("")
# Short DOS path notation
path= cmdline('echo %cd%')[:-1] path= cmdline('echo %cd%')[:-1]
print("Copying autohotkey combinations for Terminals & Editors...")
os.system("copy /Y " + path + "\\windows\\kinto.ahk " + path + "\\windows\\kinto-new.ahk")
if default == 1: if default == 1:
os.system("regedit " + path + "\\windows\\macbook_winctrl_swap.reg") os.system('perl -pi -e "s/(; )(.*)(; MacModifiers)/$2$3/g" ./windows/kinto-new.ahk')
# os.system("regedit " + path + "\\windows\\macbook_winctrl_swap.reg")
elif default == 2: elif default == 2:
os.system("regedit " + path + "\\windows\\macbook_winctrl_capsesc_swap.reg") os.system('perl -pi -e "s/(; )(.*)(; WinModifiers)/$2$3/g" ./windows/kinto-new.ahk')
# os.system("regedit " + path + "\\windows\\standard_ctrlalt_swap.reg")
elif default == 3: elif default == 3:
os.system("regedit " + path + "\\windows\\standard_ctrlalt_swap.reg")
elif default == 4:
os.system("regedit " + path + "\\windows\\standard_ctrlalt_capsesc_swap.reg")
elif default == 5:
os.system("regedit " + path + "\\windows\\remove_keyswap.reg") os.system("regedit " + path + "\\windows\\remove_keyswap.reg")
stvscode = yn_choice(bcolors.CYELLOW2 + "Would you like to use Sublime Text 3 keymaps in VS Code?\n" + bcolors.ENDC) stvscode = yn_choice(bcolors.CYELLOW2 + "Would you like to use Sublime Text 3 keymaps in VS Code?\n" + bcolors.ENDC)
if default > 0 and default < 5: if default > 0 and default < 3:
print("Will now install chocolatey and autohotkey with elevated privileges...") print("Will now install chocolatey and autohotkey with elevated privileges...")
print("This install will fail if you are not running with elevated privileges") print("This install will fail if you are not running with elevated privileges")
os.system('powershell -executionpolicy bypass ".\\windows\\autohotkey.ps1"') os.system('powershell -executionpolicy bypass ".\\windows\\autohotkey.ps1"')
os.system('refreshenv') os.system('refreshenv')
print("\nWill now install Ubuntu Terminal Theme as default...") print("\nWill now install Ubuntu Terminal Theme as default...")
os.system("regedit " + path + "\\windows\\theme_ubuntu.reg") os.system("regedit " + path + "\\windows\\theme_ubuntu.reg")
print("Copying autohotkey combinations for Terminals & Editors...")
os.system("copy /Y " + path + "\\windows\\kinto.ahk " + path + "\\windows\\kinto-new.ahk")
if(stvscode): if(stvscode):
os.system('perl -pi -e "s/(; )(.*)(; ST2CODE)/$2$3/g" ./windows/kinto-new.ahk') os.system('perl -pi -e "s/(; )(.*)(; ST2CODE)/$2$3/g" ./windows/kinto-new.ahk')
os.system("copy /Y " + path + "\\windows\\kinto-new.ahk \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\kinto.ahk\"") os.system('copy /Y ' + path + '\\windows\\kinto-start.vbs "%userprofile%\\.kinto\\kinto-start.vbs"')
os.system('mklink "%userprofile%\\Start Menu\\Programs\\Startup\\kinto-start.vbs" "%userprofile%\\.kinto\\kinto-start.vbs"')
os.system('cp '+ path + '\\windows\\NoShell.vbs "%userprofile%\\.kinto\\NoShell.vbs"')
os.system('cp '+ path + '\\windows\\toggle_kb.bat "%userprofile%\\.kinto\\toggle_kb.bat"')
os.system('cp '+ path + '\\windows\\kinto-new.ahk "%userprofile%\\.kinto\\kinto.ahk"')
os.system('robocopy '+ path + '\\assets "%userprofile%\\.kinto\\assets" /E')
os.system("del /f .\\windows\\kinto-new.ahk") os.system("del /f .\\windows\\kinto-new.ahk")
print("\nPlease log off and back on for changes to take full effect.") os.system("del \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\kinto.ahk\"")
os.system("%userprofile%\\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.") 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: else:
os.system("del \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\kinto.ahk\"") os.system("del \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\kinto.ahk\"")
@@ -112,7 +119,7 @@ def setShortcuts():
addhotkeys = yn_choice("\nDo you want to apply system level shortcuts?") addhotkeys = yn_choice("\nDo you want to apply system level shortcuts?")
if(addhotkeys): if(addhotkeys):
distro = distro.lower() distro = distro.lower()
if dename == "gnome" or dename == "mate": 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/desktop/wm/keybindings/ > keybindings_`date +"%Y.%m.%d-%s"`.conf')
cmdline('dconf dump /org/gnome/mutter/keybindings/ > mutter_`date +"%Y.%m.%d-%s"`.conf') cmdline('dconf dump /org/gnome/mutter/keybindings/ > mutter_`date +"%Y.%m.%d-%s"`.conf')
if(kintotype == 1): if(kintotype == 1):
@@ -122,11 +129,19 @@ def setShortcuts():
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 \"['<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 switch-applications-backward \"['<Primary>F14','<Primary><Shift>F14','<Alt><Shift>Tab']\"")
cmdline("gsettings set org.gnome.desktop.wm.keybindings minimize \"['<Super>h','<Alt>F9']\"") 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 set org.gnome.desktop.wm.keybindings panel-main-menu \"['<Primary><Shift>Space','<Primary>Space']\"") 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']\"") cmdline("gsettings set org.gnome.shell.keybindings toggle-application-view \"['LaunchB']\"")
if dename != "mate": if dename != "mate":
cmdline("gsettings set org.gnome.mutter overlay-key ''") cmdline("gsettings set org.gnome.mutter overlay-key ''")
if (distro == "ubuntu" and dename == "gnome") or (distro == "linux" and dename == "mate") or (distro == "ubuntu" and dename == "mate"): 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-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-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-left ['']")
@@ -160,8 +175,8 @@ def setShortcuts():
cmdline('perl -pi -e "s/(\w.*)(\/\/ Default cmdtab)/\/\/ \$1\$2/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": # elif distro == "budgie" and dename == "gnome":
# print("Apply budgie shortcuts here") # print("Apply budgie shortcuts here")
elif (distro == "galliumos" and dename == "xfce") or (distro == "ubuntu" and dename == "xfce"): elif (dename == "xfce"):
print("Applying GalliumOS (xfce) shortcuts...") 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') cmdline('cp ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml ./xfce4-keyboard-shortcuts_`date +"%Y.%m.%d-%s"`.xml')
# Reset Show desktop # 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/<Primary><Alt>d" --reset')
@@ -225,7 +240,8 @@ def setShortcuts():
os.system('kquitapp5 kglobalaccel && sleep 2s && kglobalaccel5 &') os.system('kquitapp5 kglobalaccel && sleep 2s && kglobalaccel5 &')
else: else:
print('distro: ' + distro + ' de: ' + dename) print('distro: ' + distro + ' de: ' + dename)
print("A supported OS and DE was not found, you may not have full system level shortcuts installed.") 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": if dename == "gnome":
# Apply dconf update to make updates survive reboots # Apply dconf update to make updates survive reboots
cmdline('dconf dump /org/gnome/desktop/wm/keybindings/ > tempkb.conf') cmdline('dconf dump /org/gnome/desktop/wm/keybindings/ > tempkb.conf')

View File

@@ -1,167 +1,182 @@
#!/bin/bash #!/bin/bash
function detect_budgie()
{
ps -e | grep -E '^.* budgie-wm' > /dev/null
if [ $? -ne 0 ];
then
return 0
fi
VERSION=`dpkg-query -l | grep budgie-core | awk '{print $3}'`
DESKTOP="budgie"
return 1
}
function detect_gnome() function detect_gnome()
{ {
ps -e | grep -E '^.* gnome-session' > /dev/null ps -e | grep -E '^.* gnome-session' > /dev/null
if [ $? -ne 0 ]; if [ $? -ne 0 ];
then then
return 0 return 0
fi fi
VERSION=`gnome-session --version | awk '{print $2}'` VERSION=`gnome-session --version | awk '{print $2}'`
DESKTOP="gnome" DESKTOP="gnome"
return 1 return 1
} }
function detect_kde4() function detect_kde4()
{ {
ps -e | grep -E '^.* kded4$' > /dev/null ps -e | grep -E '^.* kded4$' > /dev/null
if [ $? -ne 0 ]; if [ $? -ne 0 ];
then then
return 0 return 0
else else
VERSION=`kded4 --version | grep -m 1 'KDE' | awk -F ':' '{print $2}' | awk '{print $1}'` VERSION=`kded4 --version | grep -m 1 'KDE' | awk -F ':' '{print $2}' | awk '{print $1}'`
DESKTOP="KDE" DESKTOP="KDE"
return 1 return 1
fi fi
} }
function detect_kde() function detect_kde()
{ {
ps -e | grep -E '^.* kded5$' > /dev/null ps -e | grep -E '^.* kded5$' > /dev/null
if [ $? -ne 0 ]; if [ $? -ne 0 ];
then then
return 0 return 0
else else
VERSION=`kded5 --version | grep -m 1 'KDE' | awk -F ':' '{print $2}' | awk '{print $1}'` VERSION=`kded5 --version | grep -m 1 'KDE' | awk -F ':' '{print $2}' | awk '{print $1}'`
DESKTOP="KDE" DESKTOP="KDE"
return 1 return 1
fi fi
} }
function detect_unity() function detect_unity()
{ {
ps -e | grep -E 'unity-panel' > /dev/null ps -e | grep -E 'unity-panel' > /dev/null
if [ $? -ne 0 ]; if [ $? -ne 0 ];
then then
return 0 return 0
fi fi
VERSION=`unity --version | awk '{print $2}'` VERSION=`unity --version | awk '{print $2}'`
DESKTOP="unity" DESKTOP="unity"
return 1 return 1
} }
function detect_xfce() function detect_xfce()
{ {
ps -e | grep -E '^.* xfce4-session$' > /dev/null ps -e | grep -E '^.* xfce4-session$' > /dev/null
if [ $? -ne 0 ]; if [ $? -ne 0 ];
then then
return 0 return 0
fi fi
VERSION=`xfce4-session --version | grep xfce4-session | awk '{print $2}'` VERSION=`xfce4-session --version | grep xfce4-session | awk '{print $2}'`
DESKTOP="xfce" DESKTOP="xfce"
return 1 return 1
} }
function detect_cinnamon() function detect_cinnamon()
{ {
ps -e | grep -E '^.* cinnamon$' > /dev/null ps -e | grep -E '^.* cinnamon$' > /dev/null
if [ $? -ne 0 ]; if [ $? -ne 0 ];
then then
return 0 return 0
fi fi
VERSION=`cinnamon --version | awk '{print $2}'` VERSION=`cinnamon --version | awk '{print $2}'`
DESKTOP="cinnamon" DESKTOP="cinnamon"
return 1 return 1
} }
function detect_mate() function detect_mate()
{ {
ps -e | grep -E '^.* mate-panel$' > /dev/null ps -e | grep -E '^.* mate-panel$' > /dev/null
if [ $? -ne 0 ]; if [ $? -ne 0 ];
then then
return 0 return 0
fi fi
VERSION=`mate-about --version | awk '{print $4}'` VERSION=`mate-about --version | awk '{print $4}'`
DESKTOP="mate" DESKTOP="mate"
return 1 return 1
} }
function detect_lxde() function detect_lxde()
{ {
ps -e | grep -E '^.* lxsession$' > /dev/null ps -e | grep -E '^.* lxsession$' > /dev/null
if [ $? -ne 0 ]; if [ $? -ne 0 ];
then then
return 0 return 0
fi fi
# We can detect LXDE version only thru package manager # We can detect LXDE version only thru package manager
which apt-cache > /dev/null 2> /dev/null which apt-cache > /dev/null 2> /dev/null
if [ $? -ne 0 ]; if [ $? -ne 0 ];
then then
which yum > /dev/null 2> /dev/null which yum > /dev/null 2> /dev/null
if [ $? -ne 0 ]; if [ $? -ne 0 ];
then then
VERSION='unknown' VERSION='unknown'
else else
# For Fedora # For Fedora
VERSION=`yum list lxde-common | grep lxde-common | awk '{print $2}' | awk -F '-' '{print $1}'` VERSION=`yum list lxde-common | grep lxde-common | awk '{print $2}' | awk -F '-' '{print $1}'`
fi fi
else else
# For Lubuntu and Knoppix # For Lubuntu and Knoppix
VERSION=`apt-cache show lxde-common /| grep 'Version:' | awk '{print $2}' | awk -F '-' '{print $1}'` VERSION=`apt-cache show lxde-common /| grep 'Version:' | awk '{print $2}' | awk -F '-' '{print $1}'`
fi fi
DESKTOP="lxde" DESKTOP="lxde"
return 1 return 1
} }
function detect_sugar() function detect_sugar()
{ {
if [ "$DESKTOP_SESSION" == "sugar" ]; if [ "$DESKTOP_SESSION" == "sugar" ];
then then
VERSION=`python -c "from jarabe import config; print config.version"` VERSION=`python -c "from jarabe import config; print config.version"`
DESKTOP="sugar" DESKTOP="sugar"
else else
return 0 return 0
fi fi
} }
DESKTOP="unknown" DESKTOP="unknown"
if detect_unity; if detect_unity;
then then
if detect_kde; if detect_kde;
then then
if detect_kde4; if detect_kde4;
then then
if detect_gnome; if detect_budgie;
then then
if detect_xfce; if detect_gnome;
then then
if detect_cinnamon; if detect_xfce;
then then
if detect_mate; if detect_cinnamon;
then then
if detect_lxde; if detect_mate;
then then
detect_sugar if detect_lxde;
fi then
fi detect_sugar
fi fi
fi fi
fi fi
fi fi
fi fi
fi
fi
fi
fi fi
if [ "$1" == '-v' ]; if [ "$1" == '-v' ];
then then
echo $VERSION echo $VERSION
else else
if [ "$1" == '-n' ]; if [ "$1" == '-n' ];
then then
echo $DESKTOP echo $DESKTOP
else else
echo $DESKTOP $VERSION echo $DESKTOP $VERSION
fi fi
fi fi

View File

@@ -8,9 +8,9 @@ Restart=always
# eg DISPLAY=:0.0 # eg DISPLAY=:0.0
#Environment=DISPLAY={displayid} #Environment=DISPLAY={displayid}
RestartSec=1 RestartSec=1
WorkingDirectory=/home/{username}/.config/kinto WorkingDirectory={homedir}/.config/kinto
ExecStart=/bin/bash -c "/home/{username}/.config/kinto/xactive.sh carrots" ExecStart=/bin/bash -c "{homedir}/.config/kinto/xactive.sh carrots"
ExecStop=/bin/bash /home/{username}/.config/kinto/cleanup.sh ExecStop=/bin/bash {homedir}/.config/kinto/cleanup.sh
[Install] [Install]
WantedBy=default.target WantedBy=default.target

14
windows/NoShell.vbs Normal file
View File

@@ -0,0 +1,14 @@
If WScript.Arguments.Count >= 1 Then
ReDim arr(WScript.Arguments.Count-1)
prog = WScript.Arguments(0)
For i = 1 To WScript.Arguments.Count-1
Arg = WScript.Arguments(i)
If InStr(Arg, " ") > 1 Then Arg = """" & Arg & """"
arr(i) = Arg
Next
RunCmd = Join(arr)
' CreateObject("Wscript.Shell").Run RunCmd, 0, True
Set oShell = CreateObject("Shell.Application")
oShell.ShellExecute prog, RunCmd, , "runas", 0
End If

7
windows/kinto-start.vbs Normal file
View File

@@ -0,0 +1,7 @@
Set oShell = CreateObject("Shell.Application")
Set wShell = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
path = wShell.ExpandEnvironmentStrings("%userprofile%")
strFolder = fso.BuildPath(path, "\.kinto\kinto.ahk")
oShell.ShellExecute "C:\Program Files\AutoHotkey\AutoHotkey.exe", strFolder, , "runas", 0

View File

@@ -1,3 +1,52 @@
#SingleInstance force
#NoEnv
#Persistent
I_Icon = %A_ScriptDir%\assets\kinto-white.ico
IfExist, %I_Icon%
Menu, Tray, Icon, %I_Icon%
; Set Tray menu
; Menu, Tray, Standard
Menu, Tray, NoStandard ; to remove default menu
Menu, Tray, Add, Set Windows Keyboard, winkb
Menu, Tray, Add, Set Apple Keyboard, mackb
Menu, Tray, Add, Suspend Kinto, tray_suspend
Menu, Tray, Add, Returns to Desktop, min
Menu, Tray, Add
Menu, Tray, Add, Close, Exit
Menu, Tray, Click, 1
Menu, Tray, Tip, Kinto
winkb(){
Run, %A_ScriptDir%\NoShell.vbs %A_ScriptDir%\toggle_kb.bat win, %A_ScriptDir%
}
mackb(){
Run, %A_ScriptDir%\NoShell.vbs %A_ScriptDir%\toggle_kb.bat mac, %A_ScriptDir%
}
min(){
; Refocus last active Window
Send {LAlt down}{tab}{LAlt up}
}
tray_suspend(){
suspend toggle
if (a_isSuspended = 1){
menu, tray, check , Suspend Kinto
}
else{
menu, tray, unCheck, Suspend Kinto
}
; Refocus last active Window
Send {LAlt down}{tab}{LAlt up}
}
Exit() {
ExitApp
}
SetTitleMatchMode, 2 SetTitleMatchMode, 2
GroupAdd, terminals, ahk_exe ubuntu.exe GroupAdd, terminals, ahk_exe ubuntu.exe
@@ -7,6 +56,7 @@ GroupAdd, terminals, ahk_exe powershell.exe
GroupAdd, terminals, ahk_exe WindowsTerminal.exe GroupAdd, terminals, ahk_exe WindowsTerminal.exe
GroupAdd, terminals, ahk_exe Hyper.exe GroupAdd, terminals, ahk_exe Hyper.exe
GroupAdd, terminals, ahk_exe Cmd.exe GroupAdd, terminals, ahk_exe Cmd.exe
GroupAdd, terminals, ahk_exe Terminus.exe
GroupAdd, terminals, Fluent Terminal ahk_class ApplicationFrameWindow GroupAdd, terminals, Fluent Terminal ahk_class ApplicationFrameWindow
GroupAdd, posix, ahk_exe ubuntu.exe GroupAdd, posix, ahk_exe ubuntu.exe
@@ -14,6 +64,7 @@ GroupAdd, posix, ahk_exe ConEmu.exe
GroupAdd, posix, ahk_exe ConEmu64.exe GroupAdd, posix, ahk_exe ConEmu64.exe
GroupAdd, posix, ahk_exe Hyper.exe GroupAdd, posix, ahk_exe Hyper.exe
GroupAdd, posix, ahk_exe mintty.exe GroupAdd, posix, ahk_exe mintty.exe
GroupAdd, posix, ahk_exe Terminus.exe
GroupAdd, posix, Fluent Terminal ahk_class ApplicationFrameWindow GroupAdd, posix, Fluent Terminal ahk_class ApplicationFrameWindow
GroupAdd, ConEmu, ahk_exe ConEmu.exe GroupAdd, ConEmu, ahk_exe ConEmu.exe
@@ -27,7 +78,79 @@ GroupAdd, editors, ahk_exe Code.exe
GroupAdd, vscode, ahk_exe VSCodium.exe GroupAdd, vscode, ahk_exe VSCodium.exe
GroupAdd, vscode, ahk_exe Code.exe GroupAdd, vscode, ahk_exe Code.exe
; Close Apps GroupAdd, vstudio, ahk_exe devenv.exe
; New AltTab and CtrlTab fix
*tab::
{
; Tertiary
if (GetKeyState("LCtrl", "P") AND GetKeyState("LShift", "P") = false) {
; Secondary
; Send {LCtrl down}{Secondary up}{tab}
; Send {LCtrl down}{LWin up}{tab} ; WinModifiers
; Send {LCtrl down}{LAlt up}{tab} ; MacModifiers
KeyWait, tab
; Tertiary
} else if (GetKeyState("LCtrl", "P") AND GetKeyState("LShift", "P")) {
; Secondary
; Send {LCtrl down}{Secondary up}{LShift down}{tab}
; Send {LCtrl down}{LWin up}{LShift down}{tab} ; WinModifiers
; Send {LCtrl down}{LAlt up}{LShift down}{tab} ; MacModifiers
KeyWait, tab
; Primary
; } else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P") = false) { ; WinModifiers
; } else if (GetKeyState("LWin", "P") AND GetKeyState("LShift", "P") = false) { ; MacModifiers
Send {LAlt down}{tab}
KeyWait, tab
; Primary
; } else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P")) { ; WinModifiers
; } else if (GetKeyState("LWin", "P") AND GetKeyState("LShift", "P")) { ; MacModifiers
Send {LAlt down}{LShift down}{tab}
KeyWait, tab
; Secondary
; } else if (GetKeyState("LWin", "P") AND GetKeyState("LShift", "P")) = false { ; WinModifiers
; } else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P") = false) { ; MacModifiers
return
; Secondary
; } else if (GetKeyState("LWin", "P") AND GetKeyState("LShift", "P")) { ; WinModifiers
; } else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P")) { ; MacModifiers
return
} else {
send {Blind}{tab}
}
return
}
tab::Send {tab}
+tab::Send {Shift down}{tab}{Shift up}
; Basic Remap
;
; Primary::LCtrl
; Secondary::LAlt
; Tertiary::LWin
; $LAlt::LCtrl ; WinModifiers
; $RAlt::RCtrl ; WinModifiers
; $LWin::LAlt ; WinModifiers
; $LCtrl::LWin ; WinModifiers
; $LWin::LCtrl ; MacModifiers
; $RWin::RCtrl ; MacModifiers
; $LCtrl::LWin ; MacModifiers
; Hack to disable start menu on winkey
; Static
$LCtrl up::Send {Ctrl down}{LWin up}{Ctrl up}
; temporary hack to ensure keys don't get stuck
; impacts Alt-Tab fix
; Primary
; $LAlt up::Send {LWin up}{LAlt up}{LCtrl up} ; WinModifiers
; $LWin up::Send {LWin up}{LAlt up}{LCtrl up} ; MacModifiers
; Close Apps
^q::Send !{F4} ^q::Send !{F4}
; Emoji Panel ; Emoji Panel
@@ -56,127 +179,113 @@ $^+Right::Send +{End}
!+Right::Send ^+{Right} !+Right::Send ^+{Right}
; Cmd+Space Alternative ; Cmd+Space Alternative
LWin & vk07::return
LWin::return
RWin & vk07::return
RWin::return
^Space::Send ^{Esc} ^Space::Send ^{Esc}
; ^Space::run AppName
; Cmd Tab For App Switching ; ; Sublime Text Remaps for VS Code
LCtrl & Tab::AltTab
RCtrl & Tab::AltTab
; Ctrl Tab for In-App Tab Switching
; https://autohotkey.com/board/topic/72433-controltab/
#if GetKeyState("LWin")
*Tab::
if(!GetKeyState("LControl"))
Send {LControl Down}
Send {Tab}
SetTimer, WaitForWinUp, 10
ToolTip trigger
return
WaitForWinUp:
if(!GetKeyState("LWin", "P"))
{
Send {LControl Up}
SetTimer, WaitForWinUp, Off
}
return
; Sublime Text Remaps for VS Code
#IfWinActive ahk_group vscode ; ST2CODE #IfWinActive ahk_group vscode ; ST2CODE
; Remap Ctrl+Shift to behave like macOS Sublimetext ; Remap Ctrl+Shift to behave like macOS Sublimetext
; Will extend cursor to multiple lines ; Will extend cursor to multiple lines
#+Up::send ^!{Up} ; ST2CODE #+Up::send ^!{Up} ; ST2CODE
#+Down::send ^!{Down} ; ST2CODE #+Down::send ^!{Down} ; ST2CODE
; Remap Ctrl+Cmd+G to select all matches ; Remap Ctrl+Cmd+G to select all matches
#^g::send ^+{L} ; ST2CODE #^g::send ^+{L} ; ST2CODE
#If ; ST2CODE #If ; ST2CODE
#IfWinActive ahk_exe sublime_text.exe #IfWinActive ahk_exe sublime_text.exe
; Remap Ctrl+Shift to behave like macOS Sublimetext ; Remap Ctrl+Shift to behave like macOS Sublimetext
; Will extend cursor to multiple lines ; Will extend cursor to multiple lines
#+Up::send {shift up}^!{Up} #+Up::send {shift up}^!{Up}
#+Down::send {shift up}^!{Down} #+Down::send {shift up}^!{Down}
; Remap Ctrl+Cmd+G to select all matches ; Remap Ctrl+Cmd+G to select all matches
#^g::send !{F3} #^g::send !{F3}
#If
; Not sure why this fix is needed
#IfWinActive ahk_exe Firefox.exe
^v::send ^v
#If #If
#IfWinActive ahk_group terminals #IfWinActive ahk_group terminals
; Copy ; Copy
^c::Send {LCtrl down}{LShift down}c{LCtrl Up}{LShift Up} ^c::
#c::Send {LCtrl down}c{LCtrl Up} SetKeyDelay -1
#IfWinNotActive ahk_group ConEmu Send {Blind}{LShift down}{c DownTemp}
; Paste return
^v::Send {LCtrl down}{LShift down}v{LCtrl Up}{LShift Up}
#If ^c up::
SetKeyDelay -1
Send {Blind}{c Up}{LShift Up}
return
; Sigints - interrupt
$#c::Send {Ctrl down}c{Ctrl up}
; Paste
^v::
If WinActive("ahk_group posix"){
Send {Blind}{Shift down}v{Shift up}
}
else{
Send {Blind}v
}
return
#If #If
#IfWinActive ahk_group posix #IfWinActive ahk_group posix
; Open/Close Tab for those that support it ; Open/Close Tab for those that support it
^t::Send {LCtrl down}{LShift down}t{LCtrl Up}{LShift Up} $^t::
^w::Send {LCtrl down}{LShift down}w{LCtrl Up}{LShift Up} If not WinActive("ahk_group ConEmu"){
; End of Line Send {LCtrl down}{LShift down}t{LCtrl Up}{LShift Up}
#e::Send {LCtrl down}e{LCtrl Up} }
^e::return else{
; Beginning of Line Send ^t
#a::Send {LCtrl down}a{LCtrl Up} }
^a::return return
;^l::Send clear{Enter}
;#l::return
; Clear Terminal and Scroll Buffer
^k::Send clear && printf '\e[3J'{Enter}
; Nano editor shortcuts
#k::Send {LCtrl down}k{LCtrl Up}
#x::Send {LCtrl down}x{LCtrl Up}
#o::Send {LCtrl down}o{LCtrl Up}
#r::Send {LCtrl down}r{LCtrl Up}
#w::Send {LCtrl down}w{LCtrl Up}
#\::Send {LCtrl down}\{LCtrl Up}
#u::Send {LCtrl down}u{LCtrl Up}
#j::Send {LCtrl down}j{LCtrl Up}
#t::Send {LCtrl down}t{LCtrl Up}
#_::Send {LCtrl down}_{LCtrl Up}
#z::Send {LCtrl down}z{LCtrl Up}
#If
#IfWinActive ahk_group ConEmu $^w::
; Paste If not WinActive("ahk_group ConEmu"){
$^v::Send {Shift down}{Insert}{Shift Up} Send {LCtrl down}{LShift down}w{LCtrl Up}{LShift Up}
#v::Send {LCtrl down}v{LCtrl Up} }
#If else{
Send ^w
}
return
#IfWinActive ahk_exe mintty.exe ; End of Line
; Copy ^e::
$^c::Send {Control down}{Insert}{Control Up} SetKeyDelay -1
#c::Send {LCtrl down}c{LCtrl Up} Send {Blind}{e DownTemp}
; Paste return
$^v::Send {Shift down}{Insert}{Shift Up}
#v::Send {LCtrl down}v{LCtrl Up}
#If
;Disable win + l key locking (This line must come before any hotkey assignments in the .ahk file) ^e up::
SetKeyDelay -1
Send {Blind}{e Up}
return
; Admin privileges required ; Beginning of Line
; Sets Workstation Lock to not occur on Win+L ^a::
; RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Policies\System, DisableLockWorkstation, 1 SetKeyDelay -1
Send {Blind}{a DownTemp}
return
; Re-enables Workstation lock on Ctrl+Cmd+Q ^a up::
; Need to Remove Quick Assist and reboot SetKeyDelay -1
; Remove-WindowsCapability -online -name App.Support.QuickAssist~~~~0.0.1.0 Send {Blind}{a Up}
#^q:: return
; re-enable locking workstation, then lock it
; RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Policies\System, DisableLockWorkstation, 0 ^l::Send clear{Enter}
; DllCall("LockWorkStation") ; #l::return
; Reload script to relock Workstation Lock ; Clear Terminal and Scroll Buffer
; Reload ^k::Send clear && printf '\e[3J'{Enter}
;return ; Nano editor shortcuts
#g::Send {LCtrl down}g{LCtrl Up}
#k::Send {LCtrl down}k{LCtrl Up}
#x::Send {LCtrl down}x{LCtrl Up}
#o::Send {LCtrl down}o{LCtrl Up}
#r::Send {LCtrl down}r{LCtrl Up}
#w::Send {LCtrl down}w{LCtrl Up}
#\::Send {LCtrl down}\{LCtrl Up}
#u::Send {LCtrl down}u{LCtrl Up}
#j::Send {LCtrl down}j{LCtrl Up}
#t::Send {LCtrl down}t{LCtrl Up}
#_::Send {LCtrl down}_{LCtrl Up}
#z::Send {LCtrl down}z{LCtrl Up}
#y::Send {LCtrl down}y{LCtrl Up}
#v::Send {LCtrl down}v{LCtrl Up}
#If

22
windows/toggle_kb.bat Normal file
View File

@@ -0,0 +1,22 @@
@echo off
IF "%1"=="mac" goto mac
IF "%1"=="win" goto win
echo Not found.
goto commonexit
:win
perl -pi -e "s/(; )(.*)(; WinModifiers)/$2$3/g" "%userprofile%\.kinto\kinto.ahk"
perl -pi -e "s/^(?!;)(.*)(; MacModifiers)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk"
"C:\Program Files\AutoHotkey\AutoHotkey.exe" "%userprofile%\.kinto\kinto.ahk"
goto commonexit
:mac
perl -pi -e "s/(; )(.*)(; MacModifiers)/$2$3/g" "%userprofile%\.kinto\kinto.ahk"
perl -pi -e "s/^(?!;)(.*)(; WinModifiers)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk"
"C:\Program Files\AutoHotkey\AutoHotkey.exe" "%userprofile%\.kinto\kinto.ahk"
goto commonexit
:commonexit
exit

View File

@@ -29,9 +29,6 @@ define_conditional_modmap(lambda wm_class: wm_class.casefold() not in terminals,
# Key.RIGHT_META: Key.RIGHT_ALT, # WinMac # Key.RIGHT_META: Key.RIGHT_ALT, # WinMac
# Key.RIGHT_CTRL: Key.RIGHT_META, # WinMac # Key.RIGHT_CTRL: Key.RIGHT_META, # WinMac
# # KintoWin
# Key.LEFT_CTRL: Key.RIGHT_CTRL, # KintoWin
# # Mac Only # # Mac Only
# Key.LEFT_META: Key.RIGHT_CTRL, # Mac # Key.LEFT_META: Key.RIGHT_CTRL, # Mac
# Key.LEFT_CTRL: Key.LEFT_META, # Mac # Key.LEFT_CTRL: Key.LEFT_META, # Mac
@@ -57,10 +54,6 @@ define_conditional_modmap(re.compile(termStr, re.IGNORECASE), {
# Key.RIGHT_META: Key.RIGHT_ALT, # WinMac # Key.RIGHT_META: Key.RIGHT_ALT, # WinMac
# Key.RIGHT_CTRL: Key.LEFT_CTRL, # WinMac # Key.RIGHT_CTRL: Key.LEFT_CTRL, # WinMac
# # KintoWin
# Key.LEFT_CTRL: Key.RIGHT_CTRL, # KintoWin
# Key.LEFT_META: Key.LEFT_CTRL, # KintoWin
# # Mac Only # # Mac Only
# Key.LEFT_META: Key.RIGHT_CTRL, # Mac # Key.LEFT_META: Key.RIGHT_CTRL, # Mac
# # Left Ctrl Stays Left Ctrl # # Left Ctrl Stays Left Ctrl
@@ -178,7 +171,7 @@ define_keymap(re.compile(codeStr, re.IGNORECASE),{
# Keybindings for Sublime Text # Keybindings for Sublime Text
define_keymap(re.compile("Sublime_text", re.IGNORECASE),{ define_keymap(re.compile("Sublime_text", re.IGNORECASE),{
K("C-Super-up"): K("M-o"), # Switch file K("C-Super-up"): K("M-o"), # Switch file
K("C-M-f"): K("f11"), # toggle_full_screen K("Super-RC-f"): K("f11"), # toggle_full_screen
K("C-M-v"): [K("C-k"), K("C-v")], # paste_from_history K("C-M-v"): [K("C-k"), K("C-v")], # paste_from_history
K("C-up"): pass_through_key, # cancel scroll_lines up K("C-up"): pass_through_key, # cancel scroll_lines up
K("Super-M-up"): K("C-up"), # scroll_lines up K("Super-M-up"): K("C-up"), # scroll_lines up

View File

@@ -1,14 +1,13 @@
#!/bin/bash #!/bin/bash
if [ -f {homedir}/.config/systemd/user/keyswap.timer ]; then
if [ -f /home/{username}/.config/systemd/user/keyswap.timer ]; then
systemctl --user stop keyswap.timer >/dev/null 2>&1 systemctl --user stop keyswap.timer >/dev/null 2>&1
systemctl --user disable keyswap.timer >/dev/null 2>&1 systemctl --user disable keyswap.timer >/dev/null 2>&1
fi fi
if [ -f /home/{username}/.config/systemd/user/keyswap.service ]; then if [ -f {homedir}/.config/systemd/user/keyswap.service ]; then
systemctl --user stop keyswap >/dev/null 2>&1 systemctl --user stop keyswap >/dev/null 2>&1
systemctl --user disable keyswap >/dev/null 2>&1 systemctl --user disable keyswap >/dev/null 2>&1
fi fi
# export DISPLAY={displayid};/usr/bin/xhost +SI:localuser:root # export DISPLAY={displayid};/usr/bin/xhost +SI:localuser:root
mkdir -p /tmp/kinto/xkeysnail mkdir -p /tmp/kinto/xkeysnail
cp /home/{username}/.config/kinto/kinto.py /tmp/kinto/xkeysnail/kinto.py cp {homedir}/.config/kinto/kinto.py /tmp/kinto/xkeysnail/kinto.py

View File

@@ -0,0 +1,31 @@
// Place your key bindings in this file to override the defaultsauto[]
[
{
"key": "alt+left",
"command": "-workbench.action.terminal.focusPreviousPane",
"when": "terminalFocus"
},
{
"key": "alt+right",
"command": "-workbench.action.terminal.focusNextPane",
"when": "terminalFocus"
},
{
"key": "alt+right",
"command": "cursorWordRight"
},
{
"key": "alt+left",
"command": "cursorWordLeft"
},
{
"key": "shift+alt+left",
"command": "cursorWordStartLeftSelect",
"when": "textInputFocus"
},
{
"key": "shift+alt+right",
"command": "cursorWordEndRightSelect",
"when": "textInputFocus"
}
]

View File

@@ -4,12 +4,12 @@ Description=xkeysnail
[Service] [Service]
Type=simple Type=simple
KillMode=process KillMode=process
ExecStartPre=/bin/bash -c "{xhost} +SI:localuser:root && /sbin/runuser -l {username} -c /home/{username}/.config/kinto/prexk.sh" ExecStartPre=/bin/bash -c "{xhost} +SI:localuser:root && /sbin/runuser -l {username} -c {homedir}/.config/kinto/prexk.sh"
ExecStart=/usr/bin/sudo /bin/bash -c '{experimental-caret}/home/{username}/.config/kinto/xkeystart.sh /tmp/kinto/xkeysnail/kinto.py' ExecStart=/usr/bin/sudo /bin/bash -c '{experimental-caret}{homedir}/.config/kinto/xkeystart.sh /tmp/kinto/xkeysnail/kinto.py'
ExecStop=/bin/bash -c 'me=$$;ps -ef | grep \'[t]mp/kinto\' | awk -v me=$me \'$2 != me {print $2}\' | xargs kill;/usr/bin/killall dbus-monitor;/usr/bin/killall xkeysnail;{kill-caret}' ExecStop=/bin/bash -c 'me=$$;ps -ef | grep \'[t]mp/kinto\' | awk -v me=$me \'$2 != me {print $2}\' | xargs kill;/usr/bin/killall dbus-monitor;/usr/bin/killall xkeysnail;{kill-caret}'
Restart=on-failure Restart=on-failure
RestartSec=3 RestartSec=3
Environment=DISPLAY={displayid} Environment=DISPLAY={displayid}
[Install] [Install]
WantedBy=graphical.target WantedBy=graphical.target

View File

@@ -72,6 +72,20 @@ function uninstall {
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 -a /sys/module/hid_apple/parameters/swap_opt_cmd
echo 'options hid_apple swap_opt_cmd=0' | sudo tee -a /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 -a /sys/module/applespi/parameters/swap_opt_cmd
echo 'options applespi swap_opt_cmd=0' | sudo tee -a /etc/modprobe.d/applespi.conf
sudo update-initramfs -u -k all
fi
}
function budgieUninstall { function budgieUninstall {
if [ -f /usr/bin/budgie-desktop ];then if [ -f /usr/bin/budgie-desktop ];then
read -n 1 -s -r -p "Your system may log you off immediately during the restoration of budgie-daemon. Press any key to continue..." read -n 1 -s -r -p "Your system may log you off immediately during the restoration of budgie-daemon. Press any key to continue..."
@@ -101,7 +115,7 @@ function budgieUpdate {
budgieVersion="$(/usr/bin/budgie-desktop --version | awk '{ print $2; }' | head -n1)" budgieVersion="$(/usr/bin/budgie-desktop --version | awk '{ print $2; }' | head -n1)"
if [ "$budgieVersion" == "10.5.1" ]; then if [ "$budgieVersion" == "10.5.1" ]; then
if ! [ -f ./system-config/budgie-daemon_10.5.1 ]; 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 wget https://github.com/rbreaves/budgie-desktop/raw/f112e0e349c021c1bbfa7e45c16083eae0d92fac/binaries/budgie-daemon_10.5.1 -O ./system-config/budgie-daemon_10.5.1
fi fi
bdmd5=$(md5sum /usr/bin/budgie-daemon | awk '{ print $1 }') bdmd5=$(md5sum /usr/bin/budgie-daemon | awk '{ print $1 }')
newbdmd5=$(md5sum ./system-config/budgie-daemon_10.5.1 | awk '{ print $1 }') newbdmd5=$(md5sum ./system-config/budgie-daemon_10.5.1 | awk '{ print $1 }')
@@ -140,7 +154,6 @@ if [ $# -eq 0 ]; then
echo " 1) Windows & Mac (HID driver)" echo " 1) Windows & Mac (HID driver)"
echo " 2) Mac Only & VMs on Macbooks" echo " 2) Mac Only & VMs on Macbooks"
echo " 3) Chromebook" echo " 3) Chromebook"
echo " 4) Windows w/ Kinto - aka Linux VM"
# echo " 5) Uninstall" # echo " 5) Uninstall"
read n read n
@@ -153,7 +166,7 @@ rightalt=false
# VS code remap # VS code remap
vssublime=false vssublime=false
if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "4" || $1 == "kintowin" || $1 == "winmac" || $1 == "mac" || $1 == "chromebook" ]]; then if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1 == "chromebook" ]]; then
while true; do while true; do
read -rep $'\nDo you want multi-language support (the right Alt key will not remap)? (y/N)\n' yn read -rep $'\nDo you want multi-language support (the right Alt key will not remap)? (y/N)\n' yn
case $yn in case $yn in
@@ -173,7 +186,7 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "4" || $1 == "kintowin" || $1
while true; do 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 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 case $yn in
[Yy]* ) exp='/sbin/runuser -l {username} -c "export DISPLAY={displayid};/home/{username}/.config/kinto/caret_status_xkey.sh\&";'; expsh='"/home/{username}/.config/kinto/caret_status_xkey.sh"'; break;; [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;; [Nn]* ) exp=" "; expsh=" " break;;
# * ) echo "Please answer yes or no.";; # * ) echo "Please answer yes or no.";;
esac esac
@@ -214,7 +227,7 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "4" || $1 == "kintowin" || $1
# echo "Transferring files..." # echo "Transferring files..."
mkdir -p ~/.config/kinto mkdir -p ~/.config/kinto
# KDE xhost fix # KDE xhost fix
mkdir -p ~/.kde/Autostart mkdir -p ~/.kde/Autostart
echo -e '#!/bin/sh\rxhost +SI:localuser:root' > ~/.kde/Autostart/kintohost.sh echo -e '#!/bin/sh\rxhost +SI:localuser:root' > ~/.kde/Autostart/kintohost.sh
@@ -237,14 +250,16 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "4" || $1 == "kintowin" || $1
sed -i "s#{kill-caret}#$expsh#g" ./xkeysnail-config/xkeysnail.service.new sed -i "s#{kill-caret}#$expsh#g" ./xkeysnail-config/xkeysnail.service.new
fi fi
sed -i "s/{username}/`whoami`/g" ./xkeysnail-config/xkeysnail.service.new 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#{xhost}#`which xhost`#g" ./xkeysnail-config/xkeysnail.service.new sed -i "s#{xhost}#`which xhost`#g" ./xkeysnail-config/xkeysnail.service.new
sed -i "s/{username}/`whoami`/g" ./xkeysnail-config/limitedadmins.new sed -i "s/{username}/`whoami`/g" ./xkeysnail-config/limitedadmins.new
sed -i "s#{homedir}#`echo "$HOME"`#g" ./xkeysnail-config/limitedadmins.new
sed -i "s#{systemctl}#`which systemctl`#g" ./xkeysnail-config/limitedadmins.new sed -i "s#{systemctl}#`which systemctl`#g" ./xkeysnail-config/limitedadmins.new
sudo chown root:root ./xkeysnail-config/limitedadmins.new sudo chown root:root ./xkeysnail-config/limitedadmins.new
sudo mv ./xkeysnail-config/limitedadmins.new /etc/sudoers.d/limitedadmins sudo mv ./xkeysnail-config/limitedadmins.new /etc/sudoers.d/limitedadmins
sed -i "s#{systemctl}#`which systemctl`#g" ~/.config/autostart/xkeysnail.desktop sed -i "s#{systemctl}#`which systemctl`#g" ~/.config/autostart/xkeysnail.desktop
sed -i "s#{xhost}#`which xhost`#g" ~/.config/autostart/xkeysnail.desktop sed -i "s#{xhost}#`which xhost`#g" ~/.config/autostart/xkeysnail.desktop
sed -i "s/{username}/`whoami`/g" ~/.config/kinto/prexk.sh sed -i "s#{homedir}#`echo "$HOME"`#g" ~/.config/kinto/prexk.sh
sed -i "s/{displayid}/`echo "$DISPLAY"`/g" ./xkeysnail-config/xkeysnail.service.new sed -i "s/{displayid}/`echo "$DISPLAY"`/g" ./xkeysnail-config/xkeysnail.service.new
sed -i "s/{displayid}/`echo "$DISPLAY"`/g" ~/.config/kinto/prexk.sh sed -i "s/{displayid}/`echo "$DISPLAY"`/g" ~/.config/kinto/prexk.sh
@@ -254,13 +269,22 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "4" || $1 == "kintowin" || $1
fi fi
if [[ $1 == "1" || $1 == "winmac" ]]; then if [[ $1 == "1" || $1 == "winmac" ]]; then
echo '1' | sudo tee -a /sys/module/hid_apple/parameters/swap_opt_cmd;echo 'options hid_apple swap_opt_cmd=1' | sudo tee -a /etc/modprobe.d/hid_apple.conf;sudo update-initramfs -u -k all if ls /sys/module | grep hid_apple >/dev/null 2>&1 ; then
echo '1' | sudo tee -a /sys/module/hid_apple/parameters/swap_opt_cmd;echo 'options hid_apple swap_opt_cmd=1' | sudo tee -a /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 -a /sys/module/applespi/parameters/swap_opt_cmd;echo 'options applespi swap_opt_cmd=1' | sudo tee -a /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 perl -pi -e "s/(# )(.*)(# WinMac)/\$2\$3/g" ./xkeysnail-config/kinto.py.new
if [[ $dename == "xfce" ]]; then if [[ $dename == "xfce" ]]; then
perl -pi -e "s/(# )(.*)(# xfce4)/\$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 not-xfce4)/# \$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 fi
elif [[ $1 == "2" || $1 == "mac" ]]; then elif [[ $1 == "2" || $1 == "mac" ]]; then
removeAppleKB
perl -pi -e "s/(# )(.*)(# Mac)/\$2\$3/g" ./xkeysnail-config/kinto.py.new perl -pi -e "s/(# )(.*)(# Mac)/\$2\$3/g" ./xkeysnail-config/kinto.py.new
if [[ $dename == "xfce" ]]; then if [[ $dename == "xfce" ]]; then
perl -pi -e "s/(# )(.*)(# xfce4)/\$2\$3/g" ./xkeysnail-config/kinto.py.new perl -pi -e "s/(# )(.*)(# xfce4)/\$2\$3/g" ./xkeysnail-config/kinto.py.new
@@ -270,15 +294,13 @@ elif [[ $1 == "3" || $1 == "chromebook" ]]; then
perl -pi -e "s/(# )(.*)(# Chromebook)/\$2\$3/g" ./xkeysnail-config/kinto.py.new 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/(# )(.*)(# 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)/# \$1\$2/g" ./xkeysnail-config/kinto.py.new
elif [[ $1 == "4" || $1 == "kintowin" ]]; then
perl -pi -e "s/(# )(.*)(# KintoWin)/\$2\$3/g" ./xkeysnail-config/kinto.py.new
fi fi
if $rightalt ; then if $rightalt ; then
perl -pi -e "s/(\w.*)(Multi-language)/# \$1\$2/g" ./xkeysnail-config/kinto.py.new >/dev/null 2>&1 perl -pi -e "s/(\w.*)(Multi-language)/# \$1\$2/g" ./xkeysnail-config/kinto.py.new >/dev/null 2>&1
fi fi
if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "4" || $1 == "kintowin" || $1 == "winmac" || $1 == "mac" || $1 == "chromebook" ]]; then if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1 == "chromebook" ]]; then
mv ./xkeysnail-config/kinto.py.new ~/.config/kinto/kinto.py mv ./xkeysnail-config/kinto.py.new ~/.config/kinto/kinto.py
# if [ "$distro" == "fedora" ];then # if [ "$distro" == "fedora" ];then
sudo rm /etc/systemd/system/xkeysnail.service sudo rm /etc/systemd/system/xkeysnail.service
@@ -359,12 +381,7 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "4" || $1 == "kintowin" || $1
elif [[ $1 == "5" || $1 == "uninstall" || $1 == "Uninstall" ]]; then elif [[ $1 == "5" || $1 == "uninstall" || $1 == "Uninstall" ]]; then
echo "Uninstalling Kinto - xkeysnail (udev)" echo "Uninstalling Kinto - xkeysnail (udev)"
uninstall uninstall
# Undo Apple keyboard cmd & alt swap removeAppleKB
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 -a /sys/module/hid_apple/parameters/swap_opt_cmd
echo 'options hid_apple swap_opt_cmd=0' | sudo tee -a /etc/modprobe.d/hid_apple.conf
sudo update-initramfs -u -k all
fi
sudo systemctl stop xkeysnail sudo systemctl stop xkeysnail
sudo systemctl disable xkeysnail sudo systemctl disable xkeysnail
sudo rm /etc/sudoers.d/limitedadmins sudo rm /etc/sudoers.d/limitedadmins
@@ -381,4 +398,4 @@ elif [[ $1 == "5" || $1 == "budgieUpdate" ]]; then
budgieUpdate budgieUpdate
else else
echo "Expected argument was not provided" echo "Expected argument was not provided"
fi fi