Compare commits
106 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1e59d89494 | ||
![]() |
f7c02dc52f | ||
![]() |
bf3ea4e358 | ||
![]() |
07be0f826f | ||
![]() |
21dd05415e | ||
![]() |
ef4b7f8b01 | ||
![]() |
9d57c1f841 | ||
![]() |
6b0801eef6 | ||
![]() |
145e2a45b0 | ||
![]() |
92519e31e8 | ||
![]() |
cb60322517 | ||
![]() |
11c3195c48 | ||
![]() |
5f6c498f90 | ||
![]() |
c7dfbff27f | ||
![]() |
e67f8964a1 | ||
![]() |
7db6862f4f | ||
![]() |
ff58059770 | ||
![]() |
64c96e38c7 | ||
![]() |
f7c0876e83 | ||
![]() |
9b5ae88fe4 | ||
![]() |
87011ddb18 | ||
![]() |
ab4551d22f | ||
![]() |
fc6b590965 | ||
![]() |
91dd44b6ba | ||
![]() |
d7fc4b9277 | ||
![]() |
006a61a242 | ||
![]() |
bafea4cef1 | ||
![]() |
437a2141ff | ||
![]() |
aff4d46abc | ||
![]() |
8460f869a0 | ||
![]() |
05683dad2e | ||
![]() |
1c9302cb7a | ||
![]() |
33e39a8068 | ||
![]() |
d4992fe00a | ||
![]() |
be0cfbce2d | ||
![]() |
7574338d3a | ||
![]() |
a692377c0a | ||
![]() |
1e956287c0 | ||
![]() |
ca76a46372 | ||
![]() |
6f314d44b4 | ||
![]() |
cce00a26a3 | ||
![]() |
64b012ac65 | ||
![]() |
29a77f74de | ||
![]() |
0c1b83ecb7 | ||
![]() |
58a2ac4f35 | ||
![]() |
5f9a6f7a31 | ||
![]() |
b72def92ce | ||
![]() |
0b849d21e8 | ||
![]() |
03029e22dc | ||
![]() |
b87dfdab9c | ||
![]() |
1bdef2f519 | ||
![]() |
f4daa29040 | ||
![]() |
cd9f3042bd | ||
![]() |
139cff181f | ||
![]() |
d642966ba8 | ||
![]() |
dc98778439 | ||
![]() |
5d0454a22f | ||
![]() |
2420518c60 | ||
![]() |
90b27a3e85 | ||
![]() |
b2284aa970 | ||
![]() |
3ad2a7f518 | ||
![]() |
b029d1fbb3 | ||
![]() |
2df52c8e37 | ||
![]() |
fea76528cd | ||
![]() |
0d8310670b | ||
![]() |
e43df230f3 | ||
![]() |
231f537b0d | ||
![]() |
2a396325f2 | ||
![]() |
7fe35cdec3 | ||
![]() |
e702e461ac | ||
![]() |
f7e3011b8c | ||
![]() |
45e637a2a6 | ||
![]() |
a4dca21c22 | ||
![]() |
40c3d68336 | ||
![]() |
9f2815d73b | ||
![]() |
52f2112abd | ||
![]() |
79bcdeb89d | ||
![]() |
a84afd5b10 | ||
![]() |
2e99c023bb | ||
![]() |
98a1d8a0f1 | ||
![]() |
72f2f93657 | ||
![]() |
9ea909af33 | ||
![]() |
f37d7d09ec | ||
![]() |
d180b94bd9 | ||
![]() |
f5dc41589d | ||
![]() |
4f562357d5 | ||
![]() |
91b58f0100 | ||
![]() |
8795783d16 | ||
![]() |
73f2b44c73 | ||
![]() |
dafaaeb2a4 | ||
![]() |
791ab4e94a | ||
![]() |
333c8b387b | ||
![]() |
6da72654ba | ||
![]() |
57d56261ed | ||
![]() |
83aaca7f6b | ||
![]() |
394454aee2 | ||
![]() |
b1d4aad618 | ||
![]() |
77e0a7fe19 | ||
![]() |
52990b5bbe | ||
![]() |
0c5a9775ec | ||
![]() |
0df6d85571 | ||
![]() |
03d5df306c | ||
![]() |
e8d9ae9e8e | ||
![]() |
d727489d4a | ||
![]() |
619a395b65 | ||
![]() |
45d413a1ba |
238
README.md
@@ -1,6 +1,6 @@
|
||||
# Kinto
|
||||
# Kinto.sh
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
[](https://github.com/rbreaves/kinto/releases/latest)
|
||||
@@ -9,21 +9,21 @@
|
||||
|
||||
Seamless copy and paste with all apps and terminals. The zero effort solution.
|
||||
|
||||
v1.2 Release - Kinto now includes a system tray and simple wizard to setup the install with minimal effort.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
[What does this do exactly?](#What-does-this-do-exactly)
|
||||
|
||||
[What's different from other remappers?](#Whats-different)
|
||||
|
||||
[What does Kinto require?](#What-does-Kinto-require)
|
||||
|
||||
[How to install (Linux)](#How-to-install-Linux)
|
||||
|
||||
[How to install (Windows)](#How-to-install-Windows)
|
||||
|
||||
[Shortcut Creation](#Shortcut-Creation)
|
||||
[What does Kinto require?](#What-does-Kinto-require)
|
||||
|
||||
[Other Notes Related to Install](#Other-Notes-Related-to-Install)
|
||||
[Shortcut Creation](#Shortcut-Creation)
|
||||
|
||||
[How to Upgrade/Control Kinto](#How-to-Upgrade-Kinto)
|
||||
|
||||
@@ -59,6 +59,8 @@ Kinto works for standard Windows, Apple and Chromebook keyboards. The following
|
||||
|---|---|---|---|---|
|
||||
|**Virtual**| LCtrl | Alt | RCtrl |Spacebar|
|
||||
|
||||
Note: RCtrl for terminals is also adding in Shift most of the time, however it depends on the specific terminal in use and will change itself to the expected keymaps of that terminal application.
|
||||
|
||||
## What's different?
|
||||
|
||||
Compared to most other remappers ***this is a complete system-wide remap of your base level modifier keys***, this saves time. You're not going to die a death of a thousand papercuts from trying to support every shortcut key under the sun.
|
||||
@@ -69,45 +71,10 @@ If your OS and macOS have similar functionality on the system level, but only di
|
||||
|
||||
Additionally, if you are using a cross-platform app and if it happens to have a few shortcut keys that differ then that can very easily be added to either the kinto.py or kinto.ahk configuration files which on Windows is located here `~/.kinto/kinto.ahk` and on Linux it can be found here `~/.config/kinto/kinto.py`. More info can be found here [Shortcut Creation (Xkeysnail)](#Shortcut-Creation-Xkeysnail) for Linux.
|
||||
|
||||
## What does Kinto require?
|
||||
|
||||
- Python
|
||||
- systemd
|
||||
- x11
|
||||
- IBus*
|
||||
- Manjaro/Arch/Debian/Ubuntu based distro 16.04+
|
||||
- Fedora/RHEL (may not work w/ xkeysnail, but original xkb version does)
|
||||
- xkeysnail (Recommended, but optional)
|
||||
|
||||
Note: Budgie DE's, so Ubuntu Budgie, appears to have a bug where keybinds may not save across reboots. Please reset the Cmd+Tab keymap before rebooting to ensure it remembers that setting. I will remove this once the issue is resolved.
|
||||
|
||||
*IBus is needed to support wordwise during browser app usage as the keymap will need to change slightly depending if the cursor/caret is on screen waiting for input. Setup.py will set it but you can manually set it as well or check your current Input Method.
|
||||
|
||||
On most distros you can confirm Input Methods by navigating to "Language Support" and set "Keyboard input method system:" to IBus for full word-wise support with web browsers.
|
||||
|
||||
Wayland support is planned, but not ready yet.
|
||||
|
||||
### Kinto for Windows 10 Requirements
|
||||
|
||||
- [Git for Windows](https://git-scm.com/download/win)
|
||||
- Powershell - run as Administrator
|
||||
- [Python3](https://www.python.org/downloads/windows/)
|
||||
|
||||
Other programs that will be installed when you run ./setup.py
|
||||
- Chocolatey
|
||||
- Autohotkey
|
||||
- Strawberry Perl
|
||||
|
||||
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.
|
||||
|
||||
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 (Linux)
|
||||
|
||||
<img src="https://user-images.githubusercontent.com/10969616/96675561-c20e3100-1330-11eb-8472-813de1edec90.png" width="50%">
|
||||
|
||||
1. clone this repo
|
||||
```
|
||||
git clone https://github.com/rbreaves/kinto.git
|
||||
@@ -121,15 +88,17 @@ sudo apt update
|
||||
sudo apt install python3
|
||||
```
|
||||
|
||||
3. Follow the prompts and the script will guide you through the rest of the setup.
|
||||
3. Run the script, press 1 or 2 keys and you are done.
|
||||
```
|
||||
./setup.py
|
||||
```
|
||||
|
||||
Note: You can actually press Enter to agree to the wizard setup, and to finish it. No mouse is required to complete the setup, every element is properly focused.
|
||||
|
||||
To Uninstall Kinto
|
||||
|
||||
```
|
||||
./setup.py
|
||||
./setup.py -r
|
||||
```
|
||||
|
||||
## How to Install (Windows)
|
||||
@@ -159,6 +128,34 @@ To Uninstall Kinto - Select Uninstall
|
||||
```
|
||||
py setup.py
|
||||
```
|
||||
|
||||
## What does Kinto require?
|
||||
|
||||
- Python
|
||||
- systemd
|
||||
- x11
|
||||
- xkeysnail
|
||||
|
||||
On most distros you can confirm Input Methods by navigating to "Language Support" and set "Keyboard input method system:" to IBus for full word-wise support with web browsers.
|
||||
|
||||
### Kinto for Windows 10 Requirements
|
||||
|
||||
- [Git for Windows](https://git-scm.com/download/win)
|
||||
- Powershell - run as Administrator
|
||||
- [Python3](https://www.python.org/downloads/windows/)
|
||||
|
||||
Other programs that will be installed when you run ./setup.py
|
||||
- Chocolatey
|
||||
- Autohotkey
|
||||
- Strawberry Perl
|
||||
|
||||
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.
|
||||
|
||||
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%">
|
||||
|
||||
## Shortcut Creation
|
||||
|
||||
Note: A new project, [Universal Keys](https://github.com/rbreaves/Universal-Keys), has been created that will be updated to contain all current remaps - plus many more. Once that is done, Kinto will be updated to programmatically pull the latest keymaps from simple csv comma delimited files & will build out key remaps from there. This will also allow for more types of remaps within an application category, Sublime Text 3 to VS Code or VS Code to Sublime Text 3, Photoshop to Gimp, Gimp to Photoshop, etc & it will ensure that xkeysnail (linux) & autohotkey (windows) are pulling from the same data set.
|
||||
@@ -249,33 +246,11 @@ I don't have too many examples on this one, most developers seem to be shying aw
|
||||
## Shortcut Creation (XKB)
|
||||
The older xkb shortcut method info can be read about in ticket [#125](https://github.com/rbreaves/kinto/issues/125).
|
||||
|
||||
## Other Notes Related to Install
|
||||
|
||||
**Manjaro with Gnome there are issues with caret/input checking.**
|
||||
|
||||
Only impacts back/forward hotkeys for web browsers.
|
||||
|
||||
Please see this ticket for more information.
|
||||
|
||||
https://github.com/rbreaves/kinto/issues/59
|
||||
|
||||
https://wiki.archlinux.org/index.php/IBus
|
||||
|
||||
**For other Arch based distros.**
|
||||
|
||||
Append the following and logoff and back on, but only after running setup.py to install all packages and the kinto service. Please report if there are any difficulties.
|
||||
nano ~/.bashrc
|
||||
```
|
||||
export GTK_IM_MODULE=xim
|
||||
export XMODIFIERS=@im=ibus
|
||||
export QT_IM_MODULE=xim
|
||||
```
|
||||
|
||||
## How to Upgrade Kinto
|
||||
|
||||
Simply bring down the latest in either the master branch or dev, but dev is sometimes in flux as new features are being developed. Then you can re-run the setup.py installer, it will stop the service and re-install Kinto.
|
||||
|
||||
Note: If you have made any custom changes to ~/.xkb or ~/.config/kinto then you will need to backup or rename those directories before running an update.
|
||||
Note: If you have made any custom changes to ~/.config/kinto then you will need to backup or rename those directories before running an update.
|
||||
|
||||
```
|
||||
git pull origin master
|
||||
@@ -284,57 +259,28 @@ git pull origin master
|
||||
|
||||
## How to Control Kinto
|
||||
|
||||
Under systemd this is how you control Kinto.
|
||||
|
||||
Kinto (xkb/x11) = keyswap
|
||||
|
||||
Kinto (udev/xkeysnail/x11) = xkeysnail
|
||||
This info is now superceded by the fact that linux has a full fledge GUI and system tray app that is very easy to use, but I will keep the command line options for those that want to know what they are.
|
||||
|
||||
Status
|
||||
```
|
||||
systemctl --user status keyswap
|
||||
sudo systemctl status xkeysnail
|
||||
```
|
||||
|
||||
Stop (your keymap will return to normal)
|
||||
```
|
||||
systemctl --user stop keyswap
|
||||
sudo systemctl stop xkeysnail
|
||||
```
|
||||
|
||||
Start
|
||||
```
|
||||
systemctl --user start keyswap
|
||||
sudo systemctl start xkeysnail
|
||||
```
|
||||
|
||||
Restart
|
||||
```
|
||||
systemctl --user restart keyswap
|
||||
sudo systemctl restart xkeysnail
|
||||
```
|
||||
|
||||
Enable
|
||||
```
|
||||
systemctl --user enable keyswap
|
||||
sudo systemctl enable xkeysnail
|
||||
```
|
||||
|
||||
Disable
|
||||
```
|
||||
systemctl --user disable keyswap
|
||||
sudo systemctl disable xkeysnail
|
||||
```
|
||||
|
||||
## Learning macOS style hotkeys on Linux
|
||||
|
||||
You can use websites like https://www.shortcutfoo.com in Google Chrome while using the terminal style keymap, but Firefox is not compatible due to detecting "cmd" as keycode 224. Chrome detects Win/Super/Cmd as keycode 91 on all OS's.
|
||||
|
||||
To make sure you are in the terminal style keymap you can just simply open the terminal and turn off the kinto service, and then switch back to Chrome.
|
||||
```
|
||||
systemctl --user stop keyswap && setxkbmap -option;setxkbmap -option altwin:swap_alt_win
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Installed successfully, but modifier keys are not properly remapped?
|
||||
@@ -354,26 +300,12 @@ To disable keyboard mapping:
|
||||
|
||||
### Does not start when you log in or after you reboot?
|
||||
|
||||
Kinto (xkb/x11) = keyswap
|
||||
Kinto
|
||||
|
||||
Kinto (udev/xkeysnail/x11) = xkeysnail
|
||||
You may need to manually set your DISPLAY in the systemd service file. Normally it pulls in the proper DISPLAY value but if it doesn't you can try this.
|
||||
|
||||
1. Check the status
|
||||
```
|
||||
systemctl --user status keyswap
|
||||
sudo systemctl status xkeysnail
|
||||
```
|
||||
2. Check the service journal
|
||||
```
|
||||
journalctl --user-unit=keyswap.service -b
|
||||
sudo journalctl --unit=xkeysnail.service -b
|
||||
```
|
||||
Another possibility is the SELinux could be enabled and needs to be set to permissive. (aka /etc/selinux/config)
|
||||
|
||||
Note: You can also watch your log live
|
||||
```
|
||||
journalctl -l --user-unit=keyswap.service -b
|
||||
sudo journalctl -l --unit=xkeysnail.service -b
|
||||
```
|
||||
|
||||
You may need to manually set your DISPLAY in the systemd service file. Normally it pulls in the proper DISPLAY value but if it doesn't you can try this.
|
||||
|
||||
@@ -383,7 +315,14 @@ echo $DISPLAY
|
||||
# :0.0
|
||||
```
|
||||
|
||||
nano ~/.config/systemd/user/keyswap.service
|
||||
You can use the Kinto.sh app or system tray to edit your service file.
|
||||
|
||||
kinto.sh gui
|
||||
1. Edit -> Edit Service
|
||||
kinto tray
|
||||
1. Customize -> Edit Service
|
||||
|
||||
or you can use your terminal.
|
||||
|
||||
sudo nano /etc/systemd/system/xkeysnail.service
|
||||
```
|
||||
@@ -397,73 +336,6 @@ Environment=DISPLAY=:0.0
|
||||
|
||||
If you continue to have issues then open a ticket and send me the info.
|
||||
|
||||
### Keyswap is not occurring, but it was working.
|
||||
|
||||
Kinto (xkb/x11) = keyswap
|
||||
|
||||
Kinto (udev/xkeysnail/x11) = xkeysnail
|
||||
|
||||
Now that Kinto (xkb/x11) is using a custom written C program I am not aware of any specific bugs or issues, but you can start here if you having difficulties and please report it if it is reproducible.
|
||||
|
||||
1. Get status
|
||||
```
|
||||
systemctl --user status keyswap
|
||||
sudo systemctl status xkeysnail
|
||||
```
|
||||
2. Restart Kinto
|
||||
```
|
||||
systemctl --user restart keyswap
|
||||
sudo systemctl restart xkeysnail
|
||||
```
|
||||
3. Check the Status again and open a ticket if you need to.
|
||||
```
|
||||
systemctl --user status keyswap
|
||||
sudo systemctl status xkeysnail
|
||||
```
|
||||
|
||||
You can also do the following to see if it is an actual issue with kintox11 not running or your service file.
|
||||
```
|
||||
cd ~/.config/kinto
|
||||
./kintox11
|
||||
```
|
||||
|
||||
## Debug (Linux - xkb method only)
|
||||
|
||||
If all else fails you can now run Kinto in debug mode as of 1.0.6-2. The output will become more verbose and I'd recommend running this directly after stopping the service.
|
||||
|
||||
Kinto (xkb/x11)
|
||||
```
|
||||
systemctl --user stop keyswap
|
||||
cd ~/.config/kinto
|
||||
./kintox11 --debug
|
||||
```
|
||||
|
||||
Kinto (udev/xkeysnail)
|
||||
|
||||
Stop
|
||||
```
|
||||
sudo systemctl stop xkeysnail
|
||||
```
|
||||
nano ~/.config/kinto/xkeystart.sh
|
||||
|
||||
Remove the 2 instances of --quiet and resave
|
||||
```
|
||||
#!/bin/bash
|
||||
|
||||
/usr/local/bin/xkeysnail --quiet --watch "$1" &
|
||||
|
||||
inotifywait -m -e close_write,moved_to,create -q "$1" |
|
||||
while read -r path; do
|
||||
/usr/bin/killall xkeysnail
|
||||
/usr/local/bin/xkeysnail --quiet --watch "$1" &
|
||||
done
|
||||
```
|
||||
Start
|
||||
```
|
||||
sudo systemctl start xkeysnail
|
||||
sudo systemctl status xkeysnail
|
||||
```
|
||||
|
||||
## 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.
|
||||
|
||||
|
631
kinto_old/setup.py
Normal 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
@@ -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
|
542
setup.py
@@ -1,33 +1,44 @@
|
||||
#!/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
|
||||
|
||||
def windows_setup():
|
||||
keymaps = ["Apple keyboard standard", "Windows keyboard standard","Uninstall"]
|
||||
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.capitalize()))
|
||||
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 < 3:
|
||||
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:
|
||||
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 == 3:
|
||||
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...")
|
||||
@@ -39,14 +50,27 @@ def windows_setup():
|
||||
os.system('(rd /s /q "%userprofile%\\.kinto") 2> nul')
|
||||
print("")
|
||||
print("Uninstall of Kinto is Complete.")
|
||||
if default > 0 and default < 3:
|
||||
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):
|
||||
os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; ST2CODE)/$2$3/g" .\\windows\\kinto-new.ahk')
|
||||
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"')
|
||||
@@ -93,514 +117,18 @@ 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 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 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 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 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"')
|
||||
# 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 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()
|
||||
|
||||
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")
|
19
uninstall.sh
@@ -1,19 +0,0 @@
|
||||
#!/bin/bash
|
||||
# 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
|
||||
systemctl --user stop keyswap 2>/dev/null
|
||||
systemctl --user disable keyswap
|
||||
systemctl --user stop keyswap.timer 2>/dev/null
|
||||
systemctl --user disable keyswap.timer
|
||||
rm ~/.config/systemd/user/keyswap.service
|
||||
rm ~/.config/systemd/user/keyswap.timer
|
||||
rm -rf ~/.config/autostart/kinto.desktop
|
||||
rm -rf ~/.config/kinto
|
||||
rm -rf ~/.xkb
|
||||
sudo systemctl daemon-reload
|
||||
sed -i '/xkb/d' ~/.Xsession 2>/dev/null
|
||||
exit 0
|
@@ -3,5 +3,5 @@ Set wShell = WScript.CreateObject("WScript.Shell")
|
||||
Set fso = CreateObject("Scripting.FileSystemObject")
|
||||
|
||||
path = wShell.ExpandEnvironmentStrings("""%userprofile%")
|
||||
strFolder = fso.BuildPath( path, "\.kinto\kinto.ahk""")
|
||||
strFolder = fso.BuildPath( path, "\.kinto\kinto.ahk"" {kbtype}")
|
||||
oShell.ShellExecute "C:\Program Files\AutoHotkey\AutoHotkey.exe", strFolder, , "runas", 0
|
@@ -2,8 +2,8 @@
|
||||
#NoEnv
|
||||
#Persistent
|
||||
|
||||
DetectHiddenWindows, On
|
||||
Run, %A_ScriptDir%\detectUSB.ahk
|
||||
; DetectHiddenWindows, On ; Autodetect
|
||||
; Run, %A_ScriptDir%\detectUSB.ahk ; Autodetect
|
||||
|
||||
; Enable Left clicks on Kinto Icon
|
||||
; https://www.autohotkey.com/boards/viewtopic.php?t=9501
|
||||
@@ -29,18 +29,40 @@ AHK_NOTIFYICON(wParam, lParam)
|
||||
; Menu, Tray, Icon, %I_Icon%,, 1 ; MacModifiers
|
||||
; Menu, Tray, Tip, Mac - Kinto ; MacModifiers
|
||||
|
||||
; I_Icon = %A_ScriptDir%\assets\kinto-white-invert.ico ; WinModifiers
|
||||
; IfExist, %I_Icon% ; WinModifiers
|
||||
; Menu, Tray, Icon, %I_Icon%,, 1 ; WinModifiers
|
||||
; I_Icon = %A_ScriptDir%\assets\kinto-white-invert.ico ; WinModifiers/CB/IBM
|
||||
; IfExist, %I_Icon% ; WinModifiers/CB/IBM
|
||||
; Menu, Tray, Icon, %I_Icon%,, 1 ; WinModifiers/CB/IBM
|
||||
; Menu, Tray, Tip, Windows - Kinto ; WinModifiers
|
||||
; Menu, Tray, Tip, Chromebook - Kinto ; Chromebook
|
||||
; Menu, Tray, Tip, IBM - Kinto ; IBM
|
||||
|
||||
Menu, Keyboards, Add, Windows, winkb
|
||||
Menu, Keyboards, Add, Apple, mackb
|
||||
Menu, Keyboards, Add, Chromebook, chromekb
|
||||
Menu, Keyboards, Add, IBM (No Super/Win key), ibmkb
|
||||
|
||||
paramkb=%1%
|
||||
|
||||
if paramkb = mac
|
||||
checkKB = Apple
|
||||
if paramkb = win
|
||||
checkKB = Windows
|
||||
if paramkb = chrome
|
||||
checkKB = Chromebook
|
||||
if paramkb = ibm
|
||||
checkKB = IBM (No Super/Win key)
|
||||
|
||||
menu, Keyboards, check, %checkKB%
|
||||
|
||||
; 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, Keyboard Types, :Keyboards
|
||||
Menu, Tray, Add, Autodetect Keyboards, autodetect
|
||||
; Menu, Tray, check, Autodetect Keyboards ; Autodetect
|
||||
; Menu, Tray, disable, Autodetect Keyboards ; CB/IBM
|
||||
Menu, Tray, Add, Suspend Kinto, tray_suspend
|
||||
Menu, Tray, Add, Returns to Desktop, min
|
||||
; Menu, Tray, Add, Returns to Desktop, min
|
||||
Menu, Tray, Add
|
||||
Menu, Tray, Add, Close, Exit
|
||||
Menu, Tray, Click, 1
|
||||
@@ -53,6 +75,20 @@ mackb(){
|
||||
Run, "%A_ScriptDir%\NoShell.vbs" "%A_ScriptDir%\toggle_kb.bat" mac, "%A_ScriptDir%"
|
||||
}
|
||||
|
||||
chromekb(){
|
||||
Run, "%A_ScriptDir%\NoShell.vbs" "%A_ScriptDir%\toggle_kb.bat" chrome, "%A_ScriptDir%"
|
||||
}
|
||||
|
||||
ibmkb(){
|
||||
Run, "%A_ScriptDir%\NoShell.vbs" "%A_ScriptDir%\toggle_kb.bat" ibm, "%A_ScriptDir%"
|
||||
}
|
||||
|
||||
autodetect(){
|
||||
IfWinExist, detectUSB.ahk
|
||||
WinClose
|
||||
Run, "%A_ScriptDir%\NoShell.vbs" "%A_ScriptDir%\toggle_kb.bat" auto, "%A_ScriptDir%"
|
||||
}
|
||||
|
||||
min(){
|
||||
; Refocus last active Window
|
||||
Send {LAlt down}{tab}{LAlt up}
|
||||
@@ -71,7 +107,7 @@ tray_suspend(){
|
||||
else{
|
||||
menu, tray, unCheck, Suspend Kinto
|
||||
; I_Icon = %A_ScriptDir%\assets\kinto-white.ico ; MacModifiers
|
||||
; I_Icon = %A_ScriptDir%\assets\kinto-white-invert.ico ; WinModifiers
|
||||
; I_Icon = %A_ScriptDir%\assets\kinto-white-invert.ico ; WinModifiers/CB/IBM
|
||||
Menu, Tray, Icon, %I_Icon%,,1
|
||||
Run, %A_ScriptDir%\detectUSB.ahk
|
||||
}
|
||||
@@ -111,6 +147,9 @@ GroupAdd, ConEmu, ahk_exe ConEmu.exe
|
||||
GroupAdd, ConEmu, ahk_exe ConEmu64.exe
|
||||
GroupAdd, ConEmu, ahk_exe WindowsTerminal.exe
|
||||
|
||||
GroupAdd, ExcPaste, ahk_exe Cmd.exe
|
||||
GroupAdd, ExcPaste, ahk_exe mintty.exe
|
||||
|
||||
GroupAdd, editors, ahk_exe sublime_text.exe
|
||||
GroupAdd, editors, ahk_exe VSCodium.exe
|
||||
GroupAdd, editors, ahk_exe Code.exe
|
||||
@@ -118,6 +157,12 @@ GroupAdd, editors, ahk_exe Code.exe
|
||||
GroupAdd, browsers, ahk_exe chrome.exe
|
||||
GroupAdd, browsers, ahk_exe opera.exe
|
||||
GroupAdd, browsers, ahk_exe firefox.exe
|
||||
|
||||
; Disable Key Remapping for Virtual Machines
|
||||
; Disable for Remote desktop solutions too
|
||||
GroupAdd, virtm, ahk_exe VirtualBoxVM.exe
|
||||
GroupAdd, virtm, ahk_exe mstsc.exe
|
||||
|
||||
; Disabled Edge for now - no ability to close all instances
|
||||
; GroupAdd, browsers, Microsoft Edge ahk_class ApplicationFrameWindow
|
||||
|
||||
@@ -129,387 +174,443 @@ GroupAdd, vstudio, ahk_exe devenv.exe
|
||||
GroupAdd, intellij, ahk_exe idea.exe
|
||||
GroupAdd, intellij, ahk_exe idea64.exe
|
||||
|
||||
; New AltTab and CtrlTab fix
|
||||
*tab::
|
||||
{
|
||||
; Tertiary
|
||||
if (GetKeyState("LCtrl", "P") AND GetKeyState("LShift", "P") = false) {
|
||||
; SetCapsLockState, AlwaysOff ; CB/IBM
|
||||
|
||||
#IfWinNotActive ahk_group virtm
|
||||
|
||||
; 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
|
||||
; Send {LCtrl down}{CapsLock up}{tab} ; CB/IBM
|
||||
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/CB
|
||||
; Send {LCtrl down}{LAlt up}{LShift down}{tab} ; MacModifiers
|
||||
; Send {LCtrl down}{CapsLock up}{LShift down}{tab} ; IBM
|
||||
KeyWait, tab
|
||||
; Primary
|
||||
; } else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P") = false) { ; WinModifiers/CB/IBM
|
||||
; } 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/CB/IBM
|
||||
; } 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/CB
|
||||
; } else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P") = false) { ; MacModifiers
|
||||
; } else if (GetKeyState("CapsLock", "P") AND GetKeyState("LShift", "P")) = false { ; IBM
|
||||
return
|
||||
; 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
|
||||
; } else if (GetKeyState("LWin", "P") AND GetKeyState("LShift", "P")) { ; WinModifiers/CB
|
||||
; } else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P")) { ; MacModifiers
|
||||
; } else if (GetKeyState("CapsLock", "P") AND GetKeyState("LShift", "P")) { ; IBM
|
||||
return
|
||||
} else {
|
||||
send {Blind}{tab}
|
||||
}
|
||||
return
|
||||
; Secondary
|
||||
; } else if (GetKeyState("LWin", "P") AND GetKeyState("LShift", "P")) { ; WinModifiers
|
||||
; } else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P")) { ; MacModifiers
|
||||
}
|
||||
|
||||
tab::Send {tab}
|
||||
|
||||
+tab::Send {Shift down}{tab}{Shift up}
|
||||
|
||||
; Basic Remap
|
||||
;
|
||||
; Primary::LCtrl
|
||||
; Secondary::LAlt
|
||||
; Tertiary::LWin
|
||||
|
||||
; $LAlt::LCtrl ; CB/IBM
|
||||
; $RAlt::RCtrl ; CB/IBM
|
||||
; $CapsLock::LWin ; IBM
|
||||
; $LCtrl::LAlt ; CB/IBM
|
||||
|
||||
; $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
|
||||
; $LAlt up::Send {LWin up}{CapsLock up}{LAlt up}{LCtrl up} ; CB/IBM
|
||||
|
||||
; Close Apps
|
||||
^q::Send !{F4}
|
||||
|
||||
; Minimize specific Window
|
||||
^m::WinMinimize, A
|
||||
|
||||
; Minimize all but Active Window
|
||||
!^m::
|
||||
WinGet, winid ,, A
|
||||
WinMinimizeAll
|
||||
WinActivate ahk_id %winid%
|
||||
return
|
||||
|
||||
; hide all instances of active Program
|
||||
^h::
|
||||
WinGetClass, class, A
|
||||
WinGet, AllWindows, List
|
||||
loop %AllWindows% {
|
||||
WinGetClass, WinClass, % "ahk_id " AllWindows%A_Index%
|
||||
if(InStr(WinClass,class)){
|
||||
WinMinimize, % "ahk_id " AllWindows%A_Index%
|
||||
}
|
||||
}
|
||||
return
|
||||
|
||||
; hide all but active program
|
||||
!^h::
|
||||
WinGetClass, class, A
|
||||
WinMinimizeAll
|
||||
WinGet, AllWindows, List
|
||||
loop %AllWindows% {
|
||||
WinGetClass, WinClass, % "ahk_id " AllWindows%A_Index%
|
||||
if(InStr(WinClass,class)){
|
||||
WinRestore, % "ahk_id " AllWindows%A_Index%
|
||||
}
|
||||
}
|
||||
return
|
||||
|
||||
; Show Desktop
|
||||
^F3::Send #d
|
||||
|
||||
; Emoji Panel
|
||||
#^Space::Send {LWin down};{LWin up}
|
||||
|
||||
; Full Screenshot
|
||||
^+3::Send {PrintScreen}
|
||||
|
||||
; Region Screenshot
|
||||
^+4::Send #+{S}
|
||||
|
||||
; wordwise support
|
||||
$^Left::Send {Home}
|
||||
$^+Left::Send +{Home}
|
||||
$^Right::Send {End}
|
||||
$^+Right::Send +{End}
|
||||
^Up::Send ^{Home}
|
||||
^+Up::Send ^+{Home}
|
||||
^Down::Send ^{End}
|
||||
^+Down::Send ^+{End}
|
||||
$^Backspace::Send +{Home}{Delete}
|
||||
!Backspace::Send ^{Backspace}
|
||||
!Left::Send ^{Left}
|
||||
!+Left::Send ^+{Left}
|
||||
!Right::Send ^{Right}
|
||||
!+Right::Send ^+{Right}
|
||||
|
||||
; Cmd+Space Alternative
|
||||
$^Space::Send ^{Esc}
|
||||
|
||||
#IfWinActive ahk_group intellij
|
||||
; General
|
||||
^0::Send !{0} ;Open corresponding tool window
|
||||
^1::Send !{1} ;Open corresponding tool window
|
||||
^2::Send !{2} ;Open corresponding tool window
|
||||
^3::Send !{3} ;Open corresponding tool window
|
||||
^4::Send !{4} ;Open corresponding tool window
|
||||
^5::Send !{5} ;Open corresponding tool window
|
||||
^6::Send !{6} ;Open corresponding tool window
|
||||
^7::Send !{7} ;Open corresponding tool window
|
||||
^8::Send !{8} ;Open corresponding tool window
|
||||
^9::Send !{9} ;Open corresponding tool window
|
||||
#`::Send ^` ;Quick switch current scheme
|
||||
^,::Send ^!s ;Open Settings dialog
|
||||
^;::Send ^!+s ;Open Project Structure dialog
|
||||
; Debugging
|
||||
^!r::Send {F9} ;Resume program
|
||||
; Search/Replace
|
||||
^g::Send {F3} ;Find next
|
||||
^+F3::Send +{F3} ;Find previous
|
||||
#g::Send !j ;Select next occurrence
|
||||
^#g::Send ^!+j ;Select all occurrences
|
||||
#+g::Send !+j ;Unselect occurrence
|
||||
; Editing
|
||||
; #Space::Send ^{Space} ; Default - Basic code completion
|
||||
; !Space::Send ^{Space} ; CB/IBM - Basic code completion
|
||||
#+Space::Send ^+{Space} ;Smart code completion
|
||||
#j::Send ^q ;Quick documentation lookup
|
||||
^n::Send !{Insert} ;Generate code...
|
||||
#o::Send ^o ;Override methods
|
||||
#i::Send ^i ;Implement methods
|
||||
!Up::Send ^w ;Extend selection
|
||||
!Down::Send ^+w ;Shrink selection
|
||||
#+q::Send !q ;Context info
|
||||
#!o::Send ^!o ;Optimize imports
|
||||
#!i::Send ^!i ;Auto-indent line(s)
|
||||
$^Backspace::Send ^y ;Delete line at caret
|
||||
#+j::Send ^+j ;Smart line join
|
||||
!Delete::Send ^{Delete} ;Delete to word end
|
||||
!Backspace::Send ^{Backspace} ;Delete to word start
|
||||
^+::Send ^{NumpadAdd} ;Expand code block
|
||||
^-::Send ^{NumpadSub} ;Collapse code block
|
||||
^++::Send ^+{NumpadAdd} ;Expand all
|
||||
^+-::Send ^+{NumpadSub} ;Collapse all
|
||||
^w::Send ^{F4} ;Close active editor tab
|
||||
; Refactoring
|
||||
^Delete::Send !{Delete} ;Safe Delete
|
||||
^T::Send ^!+T ;Refactor this
|
||||
; Navigation
|
||||
^o::Send ^n ;Go to class
|
||||
^+o::Send ^+n ;Go to file
|
||||
^!o::Send ^!+n ;Go to symbol
|
||||
#Right::Send !{Right} ;Go to next editor tab
|
||||
#Left::Send !{Left} ;Go to previous editor tab
|
||||
#l::Send ^g ;Go to line
|
||||
#e::Send ^e ;Recent files popup
|
||||
; !Space::Send ^+i ; Default - Open quick definition lookup
|
||||
; #Space::Send ^+i ; CB/IBM - Open quick definition lookup
|
||||
^Y::Send ^+i ;Open quick definition lookup
|
||||
#+b::Send ^+b ;Go to type declaration
|
||||
#Up::Send !{Up} ;Go to previous
|
||||
#Down::Send !{Down} ;Go to next method
|
||||
#h::Send ^h ;Type hierarchy
|
||||
#!h::Send ^!h ;Call hierarchy
|
||||
^Down::Send ^{Enter} ;Edit source/View source
|
||||
!Home::Send !{Home} ;Show navigation bar
|
||||
F2::Send {F11} ;Toggle bookmark
|
||||
#F3::Send ^{F11} ;Toggle bookmark with mnemonic
|
||||
#0::Send ^{0} ;Go to numbered bookmark
|
||||
#1::Send ^{1} ;Go to numbered bookmark
|
||||
#2::Send ^{2} ;Go to numbered bookmark
|
||||
#3::Send ^{3} ;Go to numbered bookmark
|
||||
#4::Send ^{4} ;Go to numbered bookmark
|
||||
#5::Send ^{5} ;Go to numbered bookmark
|
||||
#6::Send ^{6} ;Go to numbered bookmark
|
||||
#7::Send ^{7} ;Go to numbered bookmark
|
||||
#8::Send ^{8} ;Go to numbered bookmark
|
||||
#9::Send ^{9} ;Go to numbered bookmark
|
||||
^F3::Send +{F11} ;Show bookmarks
|
||||
; Compile and Run
|
||||
#!r::Send !+{F10} ;Select configuration and run
|
||||
#!d::Send !+{F9} ;Select configuration and debug
|
||||
#r::Send +{F10} ;Run
|
||||
#d::Send +{F9} ;Debug
|
||||
#+r::Send ^+{F10} ;Run context configuration from editor
|
||||
#+d::Send ^+{F9} ;Debug context configuration from editor
|
||||
; VCS/Local History
|
||||
#v::Send !` ;VCS quick popup
|
||||
#If
|
||||
|
||||
; Close all browsers
|
||||
#IfWinActive ahk_group browsers
|
||||
^q::send {Alt Down}f{Alt Up}x ; exit all windows
|
||||
#If
|
||||
|
||||
; Sublime Text Remaps for VS Code
|
||||
#IfWinActive ahk_group vscode
|
||||
#p::send {Up} ; Allow for traversing quick list
|
||||
#n::send {Down} ; Allow for traversing quick list
|
||||
; Remap Ctrl+Shift to behave like macOS Sublimetext
|
||||
; Will extend cursor to multiple lines
|
||||
; #+Up::send ^!{Up} ; Default - ST2CODE
|
||||
; !+Up::send ^!{Up} ; CB/IBM - ST2CODE
|
||||
; #+Down::send ^!{Down} ; Default - ST2CODE
|
||||
; !+Down::send ^!{Down} ; CB/IBM - ST2CODE
|
||||
; Remap Ctrl+Cmd+G to select all matches
|
||||
; #^g::send ^+{L} ; Default - ST2CODE
|
||||
; !^g::send ^+{L} ; CB/IBM - ST2CODE
|
||||
!+g::send ^+{G} ; View source control
|
||||
; $#c::Send {Ctrl down}c{Ctrl up} ; Default - Sigints interrupt
|
||||
; $!c::Send {Ctrl down}c{Ctrl up} ; CB/IBM
|
||||
|
||||
; #Space::Send ^{Space} ; Default - Basic code completion
|
||||
; !Space::Send ^{Space} ; CB/IBM - Basic code completion
|
||||
#If
|
||||
|
||||
#IfWinActive ahk_exe sublime_text.exe
|
||||
; #Space::Send ^{Space} ; Default - Basic code completion
|
||||
; !Space::Send ^{Space} ; CB/IBM - Basic code completion
|
||||
#^Up::send !{O} ; Switch file
|
||||
#^f::send {F11} ; toggle_full_screen
|
||||
^!v::send {Ctrl Down}k{Ctrl Up}{Ctrl Down}v{Ctrl Up} ; paste_from_history
|
||||
^Up::Return ; cancel scroll_lines up
|
||||
^!Up::send ^{Up} ; scroll_lines up
|
||||
^Down::Return ; cancel scroll_lines down
|
||||
^!Down::send ^{Down} ; scroll_lines down
|
||||
; #+Up::send {shift up}^!{Up} ; Default - multi-cursor up
|
||||
; #+Down::send {shift up}^!{Down} ; Default - multi-cursor down
|
||||
; #+Up::send {shift up}^!{Up} ; CB/IBM - multi-cursor up
|
||||
; #+Down::send {shift up}^!{Down} ; CB/IBM - multi-cursor down
|
||||
^PgDn::Return ; cancel next_view
|
||||
^PgUp::Return ; cancel prev_view
|
||||
^+{::send ^{PgDn} ; next_view
|
||||
^+}::send ^{PgUp} ; prev_view
|
||||
^!Right::send ^{PgDn} ; next_view
|
||||
^!Left::send ^{PgUp} ; prev_view
|
||||
Insert::Return ; cancel toggle_overwrite
|
||||
^!O::send {Insert} ; toggle_overwrite
|
||||
!c::Return ; cancel toggle_case_sensitive
|
||||
^!c::send !{c} ; toggle_case_sensitive
|
||||
; ^h::Return ; cancel replace
|
||||
^!f::send ^{h} ; replace
|
||||
^+h::Return ; cancel replace_next
|
||||
^!e::send ^+{h} ; replace_next
|
||||
F3::Return ; cancel find_next
|
||||
^g::send {F3} ; find_next
|
||||
*F3::Return ; cancel find_prev, find_under, find_all_under
|
||||
^+g::send +{F3} ; find_prev
|
||||
#!g::send ^{F3} ; find_under
|
||||
#!+g::send ^+{F3} ; find_under_prev
|
||||
; #^g::send !{F3} ; Default - find_all_under
|
||||
; !^g::send !{F3} ; CB/IBM - find_all_under
|
||||
^+Up::Return ; cancel swap_line_up
|
||||
#!Up::send ^+{Up} ; swap_line_up
|
||||
^+Down::Return ; cancel swap_line_down
|
||||
#!Down::send ^+{Down} ; swap_line_down
|
||||
^Pause::Return ; cancel cancel_build
|
||||
#c::send ^{Pause} ; cancel_build
|
||||
F9::Return ; cancel sort_lines case_s false
|
||||
F5::send {F9} ; sort_lines case_s false
|
||||
#F9::Return ; cancel sort_lines case_s true
|
||||
#F5::send #{F9} ; sort_lines case_s true
|
||||
!+1::Return ; cancel set_layout
|
||||
^!1::send !+1 ; set_layout
|
||||
!+2::Return ; cancel set_layout
|
||||
^!2::send !+2 ; set_layout
|
||||
!+3::Return ; cancel set_layout
|
||||
^!3::send !+3 ; set_layout
|
||||
!+4::Return ; cancel set_layout
|
||||
^!4::send !+4 ; set_layout
|
||||
!+5::Return ; cancel set_layout
|
||||
^!5::send !+5 ; set_layout
|
||||
!+8::Return ; cancel set_layout
|
||||
^!8::send !+8 ; set_layout
|
||||
!+9::Return ; cancel set_layout
|
||||
^!9::send !+9 ; set_layout
|
||||
#If
|
||||
|
||||
#IfWinActive ahk_group terminals
|
||||
|
||||
; End of Line
|
||||
; #e:: ; Default
|
||||
; !e:: ; CB/IBM
|
||||
Send {End}
|
||||
return
|
||||
} else {
|
||||
send {Blind}{tab}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
tab::Send {tab}
|
||||
; Beginning of Line
|
||||
; #a:: ; Default
|
||||
; !a:: ; CB/IBM
|
||||
Send {Home}
|
||||
return
|
||||
|
||||
+tab::Send {Shift down}{tab}{Shift up}
|
||||
; Copy
|
||||
^c::
|
||||
If WinActive("ahk_exe cmd.exe"){
|
||||
Send {Enter}
|
||||
}
|
||||
else if WinActive("ahk_exe mintty.exe"){
|
||||
SetKeyDelay -1
|
||||
Send {Blind}{Insert}
|
||||
}
|
||||
else{
|
||||
SetKeyDelay -1
|
||||
Send {Blind}{LShift down}{c DownTemp}
|
||||
}
|
||||
return
|
||||
|
||||
; Basic Remap
|
||||
;
|
||||
; Primary::LCtrl
|
||||
; Secondary::LAlt
|
||||
; Tertiary::LWin
|
||||
^c up::
|
||||
If not WinActive("ahk_group cmd.exe"){
|
||||
SetKeyDelay -1
|
||||
Send {Blind}{c Up}{LShift Up}
|
||||
}
|
||||
return
|
||||
|
||||
; $LAlt::LCtrl ; WinModifiers
|
||||
; $RAlt::RCtrl ; WinModifiers
|
||||
; $LWin::LAlt ; WinModifiers
|
||||
; $LCtrl::LWin ; WinModifiers
|
||||
; Sigints - interrupt
|
||||
; $#c::Send {Ctrl down}c{Ctrl up} ; Default
|
||||
; $!c::Send {Ctrl down}c{Ctrl up} ; CB/IBM
|
||||
|
||||
; $LWin::LCtrl ; MacModifiers
|
||||
; $RWin::RCtrl ; MacModifiers
|
||||
; $LCtrl::LWin ; MacModifiers
|
||||
; Paste
|
||||
$^v::
|
||||
If WinActive("ahk_exe mintty.exe"){
|
||||
Send {Shift down}{Insert}{Shift up}
|
||||
}
|
||||
else if WinActive("ahk_group posix"){
|
||||
Send {Blind}{Shift down}v{Shift up}
|
||||
}
|
||||
else{
|
||||
Send {Blind}v
|
||||
}
|
||||
return
|
||||
#If
|
||||
|
||||
; Hack to disable start menu on winkey
|
||||
; Static
|
||||
$LCtrl up::Send {Ctrl down}{LWin up}{Ctrl up}
|
||||
#IfWinActive ahk_group posix
|
||||
; Open/Close Tab for those that support it
|
||||
$^t::
|
||||
If not WinActive("ahk_group ConEmu"){
|
||||
Send {LCtrl down}{LShift down}t{LCtrl Up}{LShift Up}
|
||||
}
|
||||
else{
|
||||
Send ^t
|
||||
}
|
||||
return
|
||||
|
||||
; 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
|
||||
$^w::
|
||||
If not WinActive("ahk_group ConEmu"){
|
||||
Send {LCtrl down}{LShift down}w{LCtrl Up}{LShift Up}
|
||||
}
|
||||
else{
|
||||
Send ^w
|
||||
}
|
||||
return
|
||||
|
||||
; Close Apps
|
||||
^q::Send !{F4}
|
||||
|
||||
; Minimize specific Window
|
||||
^m::WinMinimize, A
|
||||
|
||||
; Minimize all but Active Window
|
||||
!^m::
|
||||
WinGet, winid ,, A
|
||||
WinMinimizeAll
|
||||
WinActivate ahk_id %winid%
|
||||
return
|
||||
|
||||
; hide all instances of active Program
|
||||
^h::
|
||||
WinGetClass, class, A
|
||||
WinGet, AllWindows, List
|
||||
loop %AllWindows% {
|
||||
WinGetClass, WinClass, % "ahk_id " AllWindows%A_Index%
|
||||
if(InStr(WinClass,class)){
|
||||
WinMinimize, % "ahk_id " AllWindows%A_Index%
|
||||
}
|
||||
}
|
||||
return
|
||||
|
||||
; hide all but active program
|
||||
!^h::
|
||||
WinGetClass, class, A
|
||||
WinMinimizeAll
|
||||
WinGet, AllWindows, List
|
||||
loop %AllWindows% {
|
||||
WinGetClass, WinClass, % "ahk_id " AllWindows%A_Index%
|
||||
if(InStr(WinClass,class)){
|
||||
WinRestore, % "ahk_id " AllWindows%A_Index%
|
||||
}
|
||||
}
|
||||
return
|
||||
|
||||
; Show Desktop
|
||||
^F3::Send #d
|
||||
|
||||
; Emoji Panel
|
||||
#^Space::Send {LWin down};{LWin up}
|
||||
|
||||
; Full Screenshot
|
||||
^+3::Send {PrintScreen}
|
||||
|
||||
; Region Screenshot
|
||||
^+4::Send #+{S}
|
||||
|
||||
; wordwise support
|
||||
$^Left::Send {Home}
|
||||
$^+Left::Send +{Home}
|
||||
$^Right::Send {End}
|
||||
$^+Right::Send +{End}
|
||||
^Up::Send ^{Home}
|
||||
^+Up::Send ^+{Home}
|
||||
^Down::Send ^{End}
|
||||
^+Down::Send ^+{End}
|
||||
$^Backspace::Send +{Home}{Delete}
|
||||
!Backspace::Send ^{Backspace}
|
||||
!Left::Send ^{Left}
|
||||
!+Left::Send ^+{Left}
|
||||
!Right::Send ^{Right}
|
||||
!+Right::Send ^+{Right}
|
||||
|
||||
; Cmd+Space Alternative
|
||||
$^Space::Send ^{Esc}
|
||||
|
||||
#IfWinActive ahk_group intellij
|
||||
; General
|
||||
^0::Send !{0} ;Open corresponding tool window
|
||||
^1::Send !{1} ;Open corresponding tool window
|
||||
^2::Send !{2} ;Open corresponding tool window
|
||||
^3::Send !{3} ;Open corresponding tool window
|
||||
^4::Send !{4} ;Open corresponding tool window
|
||||
^5::Send !{5} ;Open corresponding tool window
|
||||
^6::Send !{6} ;Open corresponding tool window
|
||||
^7::Send !{7} ;Open corresponding tool window
|
||||
^8::Send !{8} ;Open corresponding tool window
|
||||
^9::Send !{9} ;Open corresponding tool window
|
||||
#`::Send ^` ;Quick switch current scheme
|
||||
^,::Send ^!s ;Open Settings dialog
|
||||
^;::Send ^!+s ;Open Project Structure dialog
|
||||
; Debugging
|
||||
^!r::Send {F9} ;Resume program
|
||||
; Search/Replace
|
||||
^g::Send {F3} ;Find next
|
||||
^+F3::Send +{F3} ;Find previous
|
||||
#g::Send !j ;Select next occurrence
|
||||
^#g::Send ^!+j ;Select all occurrences
|
||||
#+g::Send !+j ;Unselect occurrence
|
||||
; Editing
|
||||
#Space::Send ^{Space} ;Basic code completion
|
||||
#+Space::Send ^+{Space} ;Smart code completion
|
||||
#j::Send ^q ;Quick documentation lookup
|
||||
^n::Send !{Insert} ;Generate code...
|
||||
#o::Send ^o ;Override methods
|
||||
#i::Send ^i ;Implement methods
|
||||
!Up::Send ^w ;Extend selection
|
||||
!Down::Send ^+w ;Shrink selection
|
||||
#+q::Send !q ;Context info
|
||||
#!o::Send ^!o ;Optimize imports
|
||||
#!i::Send ^!i ;Auto-indent line(s)
|
||||
$^Backspace::Send ^y ;Delete line at caret
|
||||
#+j::Send ^+j ;Smart line join
|
||||
!Delete::Send ^{Delete} ;Delete to word end
|
||||
!Backspace::Send ^{Backspace} ;Delete to word start
|
||||
^+::Send ^{NumpadAdd} ;Expand code block
|
||||
^-::Send ^{NumpadSub} ;Collapse code block
|
||||
^++::Send ^+{NumpadAdd} ;Expand all
|
||||
^+-::Send ^+{NumpadSub} ;Collapse all
|
||||
^w::Send ^{F4} ;Close active editor tab
|
||||
; Refactoring
|
||||
^Delete::Send !{Delete} ;Safe Delete
|
||||
^T::Send ^!+T ;Refactor this
|
||||
; Navigation
|
||||
^o::Send ^n ;Go to class
|
||||
^+o::Send ^+n ;Go to file
|
||||
^!o::Send ^!+n ;Go to symbol
|
||||
#Right::Send !{Right} ;Go to next editor tab
|
||||
#Left::Send !{Left} ;Go to previous editor tab
|
||||
#l::Send ^g ;Go to line
|
||||
#e::Send ^e ;Recent files popup
|
||||
!Space::Send ^+i ;Open quick definition lookup
|
||||
^Y::Send ^+i ;Open quick definition lookup
|
||||
#+b::Send ^+b ;Go to type declaration
|
||||
#Up::Send !{Up} ;Go to previous
|
||||
#Down::Send !{Down} ;Go to next method
|
||||
#h::Send ^h ;Type hierarchy
|
||||
#!h::Send ^!h ;Call hierarchy
|
||||
^Down::Send ^{Enter} ;Edit source/View source
|
||||
!Home::Send !{Home} ;Show navigation bar
|
||||
F2::Send {F11} ;Toggle bookmark
|
||||
#F3::Send ^{F11} ;Toggle bookmark with mnemonic
|
||||
#0::Send ^{0} ;Go to numbered bookmark
|
||||
#1::Send ^{1} ;Go to numbered bookmark
|
||||
#2::Send ^{2} ;Go to numbered bookmark
|
||||
#3::Send ^{3} ;Go to numbered bookmark
|
||||
#4::Send ^{4} ;Go to numbered bookmark
|
||||
#5::Send ^{5} ;Go to numbered bookmark
|
||||
#6::Send ^{6} ;Go to numbered bookmark
|
||||
#7::Send ^{7} ;Go to numbered bookmark
|
||||
#8::Send ^{8} ;Go to numbered bookmark
|
||||
#9::Send ^{9} ;Go to numbered bookmark
|
||||
^F3::Send +{F11} ;Show bookmarks
|
||||
; Compile and Run
|
||||
#!r::Send !+{F10} ;Select configuration and run
|
||||
#!d::Send !+{F9} ;Select configuration and debug
|
||||
#r::Send +{F10} ;Run
|
||||
#d::Send +{F9} ;Debug
|
||||
#+r::Send ^+{F10} ;Run context configuration from editor
|
||||
#+d::Send ^+{F9} ;Debug context configuration from editor
|
||||
; VCS/Local History
|
||||
#v::Send !` ;VCS quick popup
|
||||
#If
|
||||
|
||||
; Close all browsers
|
||||
#IfWinActive ahk_group browsers
|
||||
^q::send {Alt Down}f{Alt Up}x ; exit all windows
|
||||
#If
|
||||
|
||||
; Sublime Text Remaps for VS Code
|
||||
#IfWinActive ahk_group vscode
|
||||
#Space::Send ^{Space} ; Basic code completion
|
||||
; Remap Ctrl+Shift to behave like macOS Sublimetext
|
||||
; Will extend cursor to multiple lines
|
||||
; #+Up::send ^!{Up} ; ST2CODE
|
||||
; #+Down::send ^!{Down} ; ST2CODE
|
||||
; Remap Ctrl+Cmd+G to select all matches
|
||||
; #^g::send ^+{L} ; ST2CODE
|
||||
!+g::send ^+{G} ; View source control
|
||||
; Sigints - interrupt
|
||||
$#c::Send {Ctrl down}c{Ctrl up}
|
||||
#If
|
||||
|
||||
#IfWinActive ahk_exe sublime_text.exe
|
||||
#Space::Send ^{Space} ; Basic code completion
|
||||
#^Up::send !{O} ; Switch file
|
||||
#^f::send {F11} ; toggle_full_screen
|
||||
^!v::send {Ctrl Down}k{Ctrl Up}{Ctrl Down}v{Ctrl Up} ; paste_from_history
|
||||
^Up::Return ; cancel scroll_lines up
|
||||
^!Up::send ^{Up} ; scroll_lines up
|
||||
^Down::Return ; cancel scroll_lines down
|
||||
^!Down::send ^{Down} ; scroll_lines down
|
||||
#+Up::send {shift up}^!{Up} ; multi-cursor up
|
||||
#+Down::send {shift up}^!{Down} ; multi-cursor down
|
||||
^PgDn::Return ; cancel next_view
|
||||
^PgUp::Return ; cancel prev_view
|
||||
^+{::send ^{PgDn} ; next_view
|
||||
^+}::send ^{PgUp} ; prev_view
|
||||
^!Right::send ^{PgDn} ; next_view
|
||||
^!Left::send ^{PgUp} ; prev_view
|
||||
Insert::Return ; cancel toggle_overwrite
|
||||
^!O::send {Insert} ; toggle_overwrite
|
||||
!c::Return ; cancel toggle_case_sensitive
|
||||
^!c::send !{c} ; toggle_case_sensitive
|
||||
; ^h::Return ; cancel replace
|
||||
^!f::send ^{h} ; replace
|
||||
^+h::Return ; cancel replace_next
|
||||
^!e::send ^+{h} ; replace_next
|
||||
F3::Return ; cancel find_next
|
||||
^g::send {F3} ; find_next
|
||||
*F3::Return ; cancel find_prev, find_under, find_all_under
|
||||
^+g::send +{F3} ; find_prev
|
||||
#!g::send ^{F3} ; find_under
|
||||
#!+g::send ^+{F3} ; find_under_prev
|
||||
#^g::send !{F3} ; find_all_under
|
||||
^+Up::Return ; cancel swap_line_up
|
||||
#!Up::send ^+{Up} ; swap_line_up
|
||||
^+Down::Return ; cancel swap_line_down
|
||||
#!Down::send ^+{Down} ; swap_line_down
|
||||
^Pause::Return ; cancel cancel_build
|
||||
#c::send ^{Pause} ; cancel_build
|
||||
F9::Return ; cancel sort_lines case_s false
|
||||
F5::send {F9} ; sort_lines case_s false
|
||||
#F9::Return ; cancel sort_lines case_s true
|
||||
#F5::send #{F9} ; sort_lines case_s true
|
||||
!+1::Return ; cancel set_layout
|
||||
^!1::send !+1 ; set_layout
|
||||
!+2::Return ; cancel set_layout
|
||||
^!2::send !+2 ; set_layout
|
||||
!+3::Return ; cancel set_layout
|
||||
^!3::send !+3 ; set_layout
|
||||
!+4::Return ; cancel set_layout
|
||||
^!4::send !+4 ; set_layout
|
||||
!+5::Return ; cancel set_layout
|
||||
^!5::send !+5 ; set_layout
|
||||
!+8::Return ; cancel set_layout
|
||||
^!8::send !+8 ; set_layout
|
||||
!+9::Return ; cancel set_layout
|
||||
^!9::send !+9 ; set_layout
|
||||
#If
|
||||
|
||||
#IfWinActive ahk_group terminals
|
||||
|
||||
; End of Line
|
||||
#e::
|
||||
Send {End}
|
||||
return
|
||||
|
||||
; Beginning of Line
|
||||
#a::
|
||||
Send {Home}
|
||||
return
|
||||
|
||||
; Copy
|
||||
^c::
|
||||
SetKeyDelay -1
|
||||
Send {Blind}{LShift down}{c DownTemp}
|
||||
return
|
||||
|
||||
^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_exe mintty.exe"){
|
||||
Send {Shift down}{Insert}{Shift up}
|
||||
}
|
||||
else if WinActive("ahk_group posix"){
|
||||
Send {Blind}{Shift down}v{Shift up}
|
||||
}
|
||||
else{
|
||||
Send {Blind}v
|
||||
}
|
||||
return
|
||||
#If
|
||||
|
||||
#IfWinActive ahk_group posix
|
||||
; Open/Close Tab for those that support it
|
||||
$^t::
|
||||
If not WinActive("ahk_group ConEmu"){
|
||||
Send {LCtrl down}{LShift down}t{LCtrl Up}{LShift Up}
|
||||
}
|
||||
else{
|
||||
Send ^t
|
||||
}
|
||||
return
|
||||
|
||||
$^w::
|
||||
If not WinActive("ahk_group ConEmu"){
|
||||
Send {LCtrl down}{LShift down}w{LCtrl Up}{LShift Up}
|
||||
}
|
||||
else{
|
||||
Send ^w
|
||||
}
|
||||
return
|
||||
|
||||
^l::Send clear{Enter}
|
||||
; #l::return
|
||||
; Clear Terminal and Scroll Buffer
|
||||
^k::Send clear && printf '\e[3J'{Enter}
|
||||
; 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}
|
||||
^l::Send clear{Enter}
|
||||
; #l::return
|
||||
; Clear Terminal and Scroll Buffer
|
||||
^k::Send clear && printf '\e[3J'{Enter}
|
||||
; Nano editor shortcuts
|
||||
#g::Send {LCtrl down}g{LCtrl Up} ; Default
|
||||
#k::Send {LCtrl down}k{LCtrl Up} ; Default
|
||||
#x::Send {LCtrl down}x{LCtrl Up} ; Default
|
||||
#o::Send {LCtrl down}o{LCtrl Up} ; Default
|
||||
#r::Send {LCtrl down}r{LCtrl Up} ; Default
|
||||
#w::Send {LCtrl down}w{LCtrl Up} ; Default
|
||||
#\::Send {LCtrl down}\{LCtrl Up} ; Default
|
||||
#u::Send {LCtrl down}u{LCtrl Up} ; Default
|
||||
#j::Send {LCtrl down}j{LCtrl Up} ; Default
|
||||
#t::Send {LCtrl down}t{LCtrl Up} ; Default
|
||||
#_::Send {LCtrl down}_{LCtrl Up} ; Default
|
||||
#z::Send {LCtrl down}z{LCtrl Up} ; Default
|
||||
#y::Send {LCtrl down}y{LCtrl Up} ; Default
|
||||
#v::Send {LCtrl down}v{LCtrl Up} ; Default
|
||||
!g::Send {LCtrl down}g{LCtrl Up} ; CB/IBM
|
||||
!k::Send {LCtrl down}k{LCtrl Up} ; CB/IBM
|
||||
!x::Send {LCtrl down}x{LCtrl Up} ; CB/IBM
|
||||
!o::Send {LCtrl down}o{LCtrl Up} ; CB/IBM
|
||||
!r::Send {LCtrl down}r{LCtrl Up} ; CB/IBM
|
||||
!w::Send {LCtrl down}w{LCtrl Up} ; CB/IBM
|
||||
!\::Send {LCtrl down}\{LCtrl Up} ; CB/IBM
|
||||
!u::Send {LCtrl down}u{LCtrl Up} ; CB/IBM
|
||||
!j::Send {LCtrl down}j{LCtrl Up} ; CB/IBM
|
||||
!t::Send {LCtrl down}t{LCtrl Up} ; CB/IBM
|
||||
!_::Send {LCtrl down}_{LCtrl Up} ; CB/IBM
|
||||
!z::Send {LCtrl down}z{LCtrl Up} ; CB/IBM
|
||||
!y::Send {LCtrl down}y{LCtrl Up} ; CB/IBM
|
||||
!v::Send {LCtrl down}v{LCtrl Up} ; CB/IBM
|
||||
#If
|
||||
#If
|
@@ -2,20 +2,63 @@
|
||||
|
||||
IF "%1"=="mac" goto mac
|
||||
IF "%1"=="win" goto win
|
||||
IF "%1"=="chrome" goto chrome
|
||||
IF "%1"=="ibm" goto ibm
|
||||
IF "%1"=="auto" goto auto
|
||||
|
||||
echo Not found.
|
||||
goto commonexit
|
||||
|
||||
:auto
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(;)( )(.*)(; Autodetect)|^(?!; )(.*)(; )(Autodetect)/$6$5$6$7$3$4/g" "%userprofile%\.kinto\kinto.ahk"
|
||||
"%userprofile%\.kinto\kinto-start.vbs"
|
||||
goto commonexit
|
||||
|
||||
:win
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/(; )(.*)(; WinModifiers)/$2$3/g" "%userprofile%\.kinto\kinto.ahk"
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/(; )(.*)(; Default)/$2$3/g" "%userprofile%\.kinto\kinto.ahk"
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!;)(.*)(; MacModifiers)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk"
|
||||
"C:\Program Files\AutoHotkey\AutoHotkey.exe" "%userprofile%\.kinto\kinto.ahk"
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!;)(.*)(; CB\/IBM)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk"
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!;)(.*)(; Chromebook)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk"
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!;)(.*)(; IBM)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk"
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/(ahk\"\" )(\w*)/$1win/gm" "%userprofile%\.kinto\kinto-start.vbs"
|
||||
"C:\Program Files\AutoHotkey\AutoHotkey.exe" "%userprofile%\.kinto\kinto.ahk" win
|
||||
goto commonexit
|
||||
|
||||
:mac
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/(; )(.*)(; MacModifiers)/$2$3/g" "%userprofile%\.kinto\kinto.ahk"
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/(; )(.*)(; Default)/$2$3/g" "%userprofile%\.kinto\kinto.ahk"
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!;)(.*)(; WinModifiers)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk"
|
||||
"C:\Program Files\AutoHotkey\AutoHotkey.exe" "%userprofile%\.kinto\kinto.ahk"
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!;)(.*)(; CB\/IBM)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk"
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!;)(.*)(; Chromebook)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk"
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!;)(.*)(; IBM)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk"
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/(ahk\"\" )(\w*)/$1mac/gm" "%userprofile%\.kinto\kinto-start.vbs"
|
||||
"C:\Program Files\AutoHotkey\AutoHotkey.exe" "%userprofile%\.kinto\kinto.ahk" mac
|
||||
goto commonexit
|
||||
|
||||
:chrome
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!; )(.*)(; Autodetect)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk"
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!;)(.*)(; WinModifiers)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk"
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!;)(.*)(; MacModifiers)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk"
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!;)(.*)(; Default)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk"
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/(; )(.*)(; Chromebook)/$2$3/g" "%userprofile%\.kinto\kinto.ahk"
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/(; )(.*)(; WinModifiers\/CB)/$2$3/g" "%userprofile%\.kinto\kinto.ahk"
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/(; )(.*)(; CB\/IBM)/$2$3/g" "%userprofile%\.kinto\kinto.ahk"
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/(ahk\"\" )(\w*)/$1chrome/gm" "%userprofile%\.kinto\kinto-start.vbs"
|
||||
"C:\Program Files\AutoHotkey\AutoHotkey.exe" "%userprofile%\.kinto\kinto.ahk" chrome
|
||||
goto commonexit
|
||||
|
||||
:ibm
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!; )(.*)(; Autodetect)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk"
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!;)(.*)(; WinModifiers)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk"
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!;)(.*)(; Chromebook)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk"
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!;)(.*)(; MacModifiers)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk"
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/^(?!;)(.*)(; Default)/; $1$2/gm" "%userprofile%\.kinto\kinto.ahk"
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/(; )(.*)(; IBM)/$2$3/g" "%userprofile%\.kinto\kinto.ahk"
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/(; )(.*)(; WinModifiers\/CB\/IBM)/$2$3/g" "%userprofile%\.kinto\kinto.ahk"
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/(; )(.*)(; CB\/IBM)/$2$3/g" "%userprofile%\.kinto\kinto.ahk"
|
||||
C:\Strawberry\perl\bin\perl.exe -pi -e "s/(ahk\"\" )(\w*)/$1ibm/gm" "%userprofile%\.kinto\kinto-start.vbs"
|
||||
"C:\Program Files\AutoHotkey\AutoHotkey.exe" "%userprofile%\.kinto\kinto.ahk" ibm
|
||||
goto commonexit
|
||||
|
||||
:commonexit
|
||||
|
7
xkeysnail-config/gnome_logoff.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
dbus-monitor --session "type='signal',interface='org.gnome.SessionManager.Logout'" | grep '1' |
|
||||
while read x; do
|
||||
# echo "$x"
|
||||
sudo systemctl stop xkeysnail
|
||||
exit 0
|
||||
done
|
BIN
xkeysnail-config/gui/capslock_1200x720.png
Executable file
After Width: | Height: | Size: 7.0 KiB |
BIN
xkeysnail-config/gui/keys_1200x720.png
Executable file
After Width: | Height: | Size: 8.4 KiB |
1362
xkeysnail-config/gui/kinto-gui.py
Executable file
11
xkeysnail-config/gui/kinto.desktop
Normal file
@@ -0,0 +1,11 @@
|
||||
[Desktop Entry]
|
||||
# /.local/share/applications
|
||||
Name=Kinto.sh
|
||||
GenericName=Kinto.sh
|
||||
Categories=Utility;
|
||||
Type=Application
|
||||
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/tuxbg.png
Executable file
After Width: | Height: | Size: 111 KiB |
BIN
xkeysnail-config/gui/tuxcry4.png
Executable file
After Width: | Height: | Size: 63 KiB |
BIN
xkeysnail-config/gui/tuxerror.png
Executable file
After Width: | Height: | Size: 172 KiB |
BIN
xkeysnail-config/gui/tuxuninstall.png
Executable file
After Width: | Height: | Size: 94 KiB |
40
xkeysnail-config/initkb
Normal file
@@ -0,0 +1,40 @@
|
||||
kbtype = ask
|
||||
rightmod = true
|
||||
vsc2st3 = false
|
||||
capslock = default
|
||||
systray = true
|
||||
autostart = true
|
||||
|
||||
#
|
||||
# kbtype - ask|win|mac|ibm|cbk|wmk
|
||||
#
|
||||
# What physical keyboard type does the user have?
|
||||
# ask - Prompt the user
|
||||
# win - Standard layout Ctrl, Win, Alt, Spacebar
|
||||
# mac - Mac layout Ctrl, Alt, Cmd, Spacebar
|
||||
# ibm - Model M layout Ctrl, Alt, Spacebar (Capslock is Capslock)
|
||||
# cbk - Chromebook layout Ctrl, Alt, Spacebar (Capslock is Search (Win))
|
||||
# wmk - WinMac layout
|
||||
# wmk - Uses Apple driver to swap Cmd & Alt so
|
||||
# swapping between Win & Mac keyboards is seamless.
|
||||
#
|
||||
# rightmod - Remap modifiers on right
|
||||
# true (default)
|
||||
#
|
||||
# ^ Note: Useful to set to false for multi-language users (aka AltGr)
|
||||
#
|
||||
# vsc2st3 - Remap VS Code to use Sublime Text keymap
|
||||
# false (default)
|
||||
#
|
||||
# capslock - esc_cmd|cmd|default
|
||||
# esc_cmd - escape if tapped, cmd if held
|
||||
# cmd - remaps to cmd
|
||||
# default - no remap
|
||||
#
|
||||
# systray - Sets whether the system tray will show
|
||||
# true - default
|
||||
# false - only defaults on gnome3 and kde
|
||||
#
|
||||
# autostart - Sets whether or not kinto will automatically start
|
||||
# true - deefault
|
||||
#
|
20
xkeysnail-config/killdups.sh
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
xkeycount=$(pgrep 'xkeysnail' | wc -l)
|
||||
|
||||
if [[ $xkeycount -le 1 ]]; then
|
||||
# No dups found
|
||||
exit 0
|
||||
fi
|
||||
|
||||
while ! zenity --entry --title="Kinto Duplicates" --text="Type Password to end duplicates:" --hide-text| sudo -S cat /dev/null >/dev/null; do
|
||||
if ! $(zenity --question --text="Wrong password, try again?"); then
|
||||
# Dups still exist
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
# pgrep 'xkeysnail' | head -n -1 | xargs -r -n1 sudo kill
|
||||
pgrep 'xkeysnail' | xargs -r -n1 sudo kill
|
||||
sudo -K # remove privilege
|
||||
# No dups should exist
|
||||
exit 0
|
@@ -1,4 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# autostart = true
|
||||
|
||||
import re
|
||||
from xkeysnail.transform import *
|
||||
@@ -6,7 +7,7 @@ from xkeysnail.transform import *
|
||||
# Use the following for testing terminal keymaps
|
||||
# terminals = [ "", ... ]
|
||||
# xbindkeys -mk
|
||||
terminals = ["gnome-terminal","konsole","io.elementary.terminal","terminator","sakura","guake","tilda","xterm","eterm","kitty","alacritty","mate-terminal","tilix","xfce4-terminal"]
|
||||
terminals = ["kinto-gui.py","gnome-terminal","konsole","io.elementary.terminal","terminator","sakura","guake","tilda","xterm","eterm","kitty","alacritty","mate-terminal","tilix","xfce4-terminal"]
|
||||
terminals = [term.casefold() for term in terminals]
|
||||
termStr = "|".join(str(x) for x in terminals)
|
||||
|
||||
@@ -18,15 +19,34 @@ browserStr = "|".join(str(x) for x in browsers)
|
||||
mscodes = ["code","vscodium"]
|
||||
codeStr = "|".join(str(x) for x in mscodes)
|
||||
|
||||
define_multipurpose_modmap(
|
||||
# {Key.ENTER: [Key.ENTER, Key.RIGHT_CTRL] # Enter2Cmd
|
||||
# {Key.CAPSLOCK: [Key.ESC, Key.RIGHT_CTRL] # Caps2Esc
|
||||
# {Key.LEFT_META: [Key.ESC, Key.RIGHT_CTRL] # Caps2Esc - Chromebook
|
||||
{ # Placeholder
|
||||
})
|
||||
|
||||
# [Global modemap] Change modifier keys as in xmodmap
|
||||
define_conditional_modmap(lambda wm_class: wm_class.casefold() not in terminals,{
|
||||
# # Chromebook
|
||||
|
||||
# Key.CAPSLOCK: Key.RIGHT_CTRL, # Caps2Cmd
|
||||
# Key.LEFT_META: Key.RIGHT_CTRL, # Caps2Cmd - Chromebook
|
||||
|
||||
# - IBM
|
||||
# Key.LEFT_ALT: Key.RIGHT_CTRL, # IBM
|
||||
# Key.LEFT_CTRL: Key.LEFT_ALT, # IBM
|
||||
# Key.CAPSLOCK: Key.LEFT_META, # IBM
|
||||
# Key.RIGHT_ALT: Key.RIGHT_CTRL, # IBM - Multi-language (Remove)
|
||||
# Key.RIGHT_CTRL: Key.RIGHT_ALT, # IBM - Multi-language (Remove)
|
||||
|
||||
# - Chromebook
|
||||
# Key.LEFT_ALT: Key.RIGHT_CTRL, # Chromebook
|
||||
# Key.LEFT_CTRL: Key.LEFT_ALT, # Chromebook
|
||||
# Key.RIGHT_ALT: Key.RIGHT_CTRL, # Chromebook - Multi-language (Remove)
|
||||
# Key.RIGHT_CTRL: Key.RIGHT_ALT, # Chromebook - Multi-language (Remove)
|
||||
|
||||
# # Default Mac/Win
|
||||
# - Default Mac/Win
|
||||
# - Default Win
|
||||
# Key.LEFT_ALT: Key.RIGHT_CTRL, # WinMac
|
||||
# Key.LEFT_META: Key.LEFT_ALT, # WinMac
|
||||
# Key.LEFT_CTRL: Key.LEFT_META, # WinMac
|
||||
@@ -34,7 +54,7 @@ define_conditional_modmap(lambda wm_class: wm_class.casefold() not in terminals,
|
||||
# Key.RIGHT_META: Key.RIGHT_ALT, # WinMac - Multi-language (Remove)
|
||||
# Key.RIGHT_CTRL: Key.RIGHT_META, # WinMac - Multi-language (Remove)
|
||||
|
||||
# # Mac Only
|
||||
# - Mac Only
|
||||
# Key.LEFT_META: Key.RIGHT_CTRL, # Mac
|
||||
# Key.LEFT_CTRL: Key.LEFT_META, # Mac
|
||||
# Key.RIGHT_META: Key.RIGHT_CTRL, # Mac - Multi-language (Remove)
|
||||
@@ -43,7 +63,18 @@ define_conditional_modmap(lambda wm_class: wm_class.casefold() not in terminals,
|
||||
|
||||
# [Conditional modmap] Change modifier keys in certain applications
|
||||
define_conditional_modmap(re.compile(termStr, re.IGNORECASE), {
|
||||
# # Chromebook
|
||||
# - IBM
|
||||
# Key.LEFT_ALT: Key.RIGHT_CTRL, # IBM
|
||||
# # Left Ctrl Stays Left Ctrl
|
||||
# Key.CAPSLOCK: Key.LEFT_ALT, # IBM
|
||||
# Key.RIGHT_ALT: Key.RIGHT_CTRL, # IBM - Multi-language (Remove)
|
||||
# Key.RIGHT_CTRL: Key.RIGHT_ALT, # IBM
|
||||
# # Right Meta does not exist on chromebooks
|
||||
|
||||
# Key.RIGHT_ALT: Key.RIGHT_CTRL, # IBM - Multi-language (Remove)
|
||||
# Key.RIGHT_CTRL: Key.RIGHT_ALT, # IBM - Multi-language (Remove)
|
||||
|
||||
# - Chromebook
|
||||
# Key.LEFT_ALT: Key.RIGHT_CTRL, # Chromebook
|
||||
# # Left Ctrl Stays Left Ctrl
|
||||
# Key.LEFT_META: Key.LEFT_ALT, # Chromebook
|
||||
@@ -51,7 +82,8 @@ define_conditional_modmap(re.compile(termStr, re.IGNORECASE), {
|
||||
# Key.RIGHT_CTRL: Key.RIGHT_ALT, # Chromebook
|
||||
# # Right Meta does not exist on chromebooks
|
||||
|
||||
# # Default Mac/Win
|
||||
# - Default Mac/Win
|
||||
# - Default Win
|
||||
# Key.LEFT_ALT: Key.RIGHT_CTRL, # WinMac
|
||||
# Key.LEFT_META: Key.LEFT_ALT, # WinMac
|
||||
# Key.LEFT_CTRL: Key.LEFT_CTRL, # WinMac
|
||||
@@ -59,7 +91,7 @@ define_conditional_modmap(re.compile(termStr, re.IGNORECASE), {
|
||||
# Key.RIGHT_META: Key.RIGHT_ALT, # WinMac - Multi-language (Remove)
|
||||
# Key.RIGHT_CTRL: Key.LEFT_CTRL, # WinMac - Multi-language (Remove)
|
||||
|
||||
# # Mac Only
|
||||
# - Mac Only
|
||||
# Key.LEFT_META: Key.RIGHT_CTRL, # Mac
|
||||
# # Left Ctrl Stays Left Ctrl
|
||||
# Key.RIGHT_META: Key.RIGHT_CTRL, # Mac - Multi-language (Remove)
|
||||
@@ -91,8 +123,8 @@ define_keymap(re.compile("jetbrains-idea", re.IGNORECASE),{
|
||||
K("C-Super-g"): K("C-M-Shift-j"), # Select all occurrences
|
||||
K("Super-Shift-g"): K("M-Shift-j"), # Unselect occurrence
|
||||
# Editing
|
||||
K("Super-Space"): K("C-Space"), # Basic code completion
|
||||
K("Super-Shift-Space"): K("C-Shift-Space"), # Smart code completion
|
||||
K("Super-Space"): K("LC-Space"), # Basic code completion
|
||||
K("Super-Shift-Space"): K("LC-Shift-Space"),# Smart code completion
|
||||
K("Super-j"): K("C-q"), # Quick documentation lookup
|
||||
K("C-n"): K("M-Insert"), # Generate code...
|
||||
K("Super-o"): K("C-o"), # Override methods
|
||||
@@ -170,21 +202,41 @@ define_keymap(re.compile(browserStr, re.IGNORECASE),{
|
||||
})
|
||||
|
||||
define_keymap(None,{
|
||||
K("RC-Space"): K("Alt-F1"), # Default SL - Launch Application Menu (gnome/kde)
|
||||
K("RC-F3"):K("Super-d"), # Default SL - Show Desktop (gnome/kde,eos)
|
||||
K("RC-LC-f"):K("M-F10"), # Default SL - Maximize app (gnome/kde)
|
||||
# K("Super-Right"):K("C-M-Right"), # Default SL - Change workspace (budgie)
|
||||
# K("Super-Left"):K("C-M-Left"), # Default SL - Change workspace (budgie)
|
||||
K("RC-Q"): K("M-F4"), # Default SL - not-popos
|
||||
K("RC-H"):K("Super-h"), # Default SL - Minimize app (gnome/budgie/popos/fedora)
|
||||
K("M-Tab"): pass_through_key, # Default not-xfce4 - Cmd Tab - App Switching Default
|
||||
K("RC-Tab"): K("M-Tab"), # Default not-xfce4 - Cmd Tab - App Switching Default
|
||||
K("RC-Shift-Tab"): K("M-Shift-Tab"), # Default not-xfce4 - Cmd Tab - App Switching Default
|
||||
K("RC-Grave"): K("M-Grave"), # Default not-xfce4 - Cmd ` - Same App Switching
|
||||
K("RC-Shift-Grave"): K("M-Grave"), # Default not-xfce4 - Cmd ` - Same App Switching
|
||||
# K("Super-Right"):K("Super-Page_Up"), # SL - Change workspace (ubuntu/fedora)
|
||||
# K("Super-Left"):K("Super-Page_Down"), # SL - Change workspace (ubuntu/fedora)
|
||||
# K("Super-Right"):K("Super-C-Up"), # SL - Change workspace (popos)
|
||||
# K("Super-Left"):K("Super-C-Down"), # SL - Change workspace (popos)
|
||||
# K("RC-Q"):K("Super-q"), # SL - Close Apps (popos)
|
||||
# K("RC-Space"): K("Super-Space"), # SL - Launch Application Menu (eos)
|
||||
# K("RC-H"): K("Super-Page_Down"), # SL - Minimize app (kde_neon)
|
||||
# SL - Default SL - Change workspace (kde_neon)
|
||||
# K("RC-Space"): K("LC-Esc"), # SL- Launch Application Menu xfce4
|
||||
# K("RC-F3"):K("C-M-d"), # SL- Show Desktop xfce4
|
||||
# K("RC-LC-f"):K("Super-Up"), # SL- Maximize app eos
|
||||
# K("RC-LC-f"):K("Super-PAGE_UP"), # SL- Maximize app manjaro
|
||||
# Basic App hotkey functions
|
||||
K("RC-Q"): K("Alt-F4"),
|
||||
K("RC-H"): K("Alt-F9"),
|
||||
# K("RC-H"):K("M-F9"), # SL - Minimize app xfce4
|
||||
# K("RC-LC-f"):K("Super-PAGE_DOWN"), # SL - Minimize app manjaro
|
||||
# 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("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
|
||||
# K("RC-Shift-Tab"): K("RC-Shift-backslash"), # xfce4
|
||||
# K("RC-Grave"): K("RC-Shift-backslash"), # xfce4
|
||||
# In-App Tab switching
|
||||
# K("M-Tab"): K("C-Tab"), # Chromebook - In-App Tab switching
|
||||
# K("M-Shift-Tab"): K("C-Shift-Tab"), # Chromebook - In-App Tab switching
|
||||
# K("M-Grave") : K("C-Shift-Tab"), # Chromebook - In-App Tab switching
|
||||
# K("M-Tab"): K("C-Tab"), # Chromebook/IBM - In-App Tab switching
|
||||
# K("M-Shift-Tab"): K("C-Shift-Tab"), # Chromebook/IBM - In-App Tab switching
|
||||
# K("M-Grave") : K("C-Shift-Tab"), # Chromebook/IBM - In-App Tab switching
|
||||
K("Super-Tab"): K("LC-Tab"), # Default not-chromebook
|
||||
K("Super-Shift-Tab"): K("LC-Shift-Tab"), # Default not-chromebook
|
||||
|
||||
@@ -203,17 +255,16 @@ define_keymap(None,{
|
||||
K("RC-Shift-Up"): K("C-Shift-Home"), # Select all to Beginning of File
|
||||
K("RC-Down"): K("C-End"), # End of File
|
||||
K("RC-Shift-Down"): K("C-Shift-End"), # Select all to End of File
|
||||
# K("M-Backspace"): K("Delete"), # Chromebook - Delete
|
||||
# K("M-Backspace"): K("Delete"), # Chromebook/IBM - Delete
|
||||
K("Super-Backspace"): K("C-Backspace"), # Default not-chromebook - Delete Left Word of Cursor
|
||||
K("Super-Delete"): K("C-Delete"), # Default not-chromebook - Delete Right Word of Cursor
|
||||
K("Alt-Backspace"): K("C-Backspace"), # Default not-chromebook - Delete Left Word of Cursor
|
||||
K("Alt-Delete"): K("C-Delete"), # Default not-chromebook - Delete Right Word of Cursor
|
||||
K("Alt-Backspace"): K("C-Backspace"), # Default not-chromebook - Delete Left Word of Cursor
|
||||
K("Alt-Delete"): K("C-Delete"), # Default not-chromebook - Delete Right Word of Cursor
|
||||
# K(""): pass_through_key, # cancel
|
||||
# K(""): K(""), #
|
||||
})
|
||||
|
||||
define_keymap(lambda wm_class: wm_class.casefold() not in mscodes,{
|
||||
K("Super-Space"): K("C-Space"), # Basic code completion
|
||||
# Wordwise remaining - for Everything but VS Code
|
||||
K("M-Left"): K("C-Left"), # Left of Word
|
||||
K("M-Shift-Left"): K("C-Shift-Left"), # Select Left of Word
|
||||
@@ -238,6 +289,7 @@ define_keymap(lambda wm_class: wm_class.casefold() not in mscodes,{
|
||||
|
||||
# Keybindings for VS Code
|
||||
define_keymap(re.compile(codeStr, re.IGNORECASE),{
|
||||
K("Super-Space"): K("LC-Space"), # Basic code completion
|
||||
# Wordwise remaining - for VS Code
|
||||
# Alt-F19 hack fixes Alt menu activation
|
||||
K("M-Left"): [K("M-F19"),K("C-Left")], # Left of Word
|
||||
@@ -264,7 +316,7 @@ define_keymap(re.compile(codeStr, re.IGNORECASE),{
|
||||
K("C-Shift-g"): K("Shift-f3"), # find_prev
|
||||
K("Super-c"): K("LC-c"), # Sigints - interrupt
|
||||
# K("Super-C-g"): K("C-f2"), # Default - Sublime - find_all_under
|
||||
# K("C-M-g"): K("C-f2"), # Chromebook - Sublime - find_all_under
|
||||
# K("C-M-g"): K("C-f2"), # Chromebook/IBM - Sublime - find_all_under
|
||||
# K("Super-Shift-up"): K("M-Shift-up"), # multi-cursor up - Sublime
|
||||
# K("Super-Shift-down"): K("M-Shift-down"), # multi-cursor down - Sublime
|
||||
# K(""): pass_through_key, # cancel
|
||||
@@ -306,8 +358,8 @@ define_keymap(re.compile("Sublime_text", re.IGNORECASE),{
|
||||
K("C-Shift-f3"): pass_through_key, # cancel find_under_prev
|
||||
K("Super-M-Shift-g"): K("C-Shift-f3"), # find_under_prev
|
||||
K("M-f3"): pass_through_key, # Default - cancel find_all_under
|
||||
# K("M-Refresh"): pass_through_key, # Chromebook - cancel find_all_under
|
||||
# K("M-C-g"): K("M-Refresh"), # Chromebook - find_all_under
|
||||
# K("M-Refresh"): pass_through_key, # Chromebook/IBM - cancel find_all_under
|
||||
# K("M-C-g"): K("M-Refresh"), # Chromebook/IBM - find_all_under
|
||||
K("Super-C-g"): K("M-f3"), # Default - find_all_under
|
||||
K("C-Shift-up"): pass_through_key, # cancel swap_line_up
|
||||
K("Super-M-up"): K("C-Shift-up"), # swap_line_up
|
||||
@@ -354,6 +406,16 @@ define_keymap(re.compile("Io.elementary.terminal|kitty", re.IGNORECASE),{
|
||||
}, "Elementary Terminal tab switching")
|
||||
|
||||
define_keymap(re.compile(termStr, re.IGNORECASE),{
|
||||
# K("LC-Right"):K("C-M-Right"), # Default SL - Change workspace (budgie)
|
||||
# K("LC-Left"):K("C-M-Left"), # Default SL - Change workspace (budgie)
|
||||
# K("LC-Left"):K("C-M-End"), # SL - Change workspace xfce4
|
||||
# K("LC-Left"):K("Super-Left"), # SL - Change workspace eos
|
||||
# K("LC-Right"):K("C-M-Home"), # SL - Change workspace xfce4
|
||||
# K("LC-Right"):K("Super-Right"), # SL - Change workspace eos
|
||||
# K("LC-Right"):K("Super-Page_Up"), # SL - Change workspace (ubuntu/fedora)
|
||||
# K("LC-Left"):K("Super-Page_Down"), # SL - Change workspace (ubuntu/fedora)
|
||||
# K("LC-Right"):K("Super-C-Up"), # SL - Change workspace (popos)
|
||||
# K("LC-Left"):K("Super-C-Down"), # SL - Change workspace (popos)
|
||||
# Ctrl Tab - In App Tab Switching
|
||||
K("LC-Tab") : K("LC-PAGE_DOWN"),
|
||||
K("LC-Shift-Tab") : K("LC-PAGE_UP"),
|
||||
|
@@ -3,3 +3,8 @@
|
||||
%{username} ALL=NOPASSWD: {systemctl} start xkeysnail
|
||||
%{username} ALL=NOPASSWD: {systemctl} stop xkeysnail
|
||||
%{username} ALL=NOPASSWD: {systemctl} status xkeysnail
|
||||
%{username} ALL=(root) NOPASSWD: /usr/local/bin/logoff.sh
|
||||
%{username} ALL=NOPASSWD: {pkill} -f logoff
|
||||
%{username} ALL=NOPASSWD: {pkill} -f bin/xkeysnail
|
||||
%{username} ALL=NOPASSWD: {xkeysnail} /home/{username}/.config/kinto/kinto.py
|
||||
%{username} ALL=NOPASSWD: {systemctl} is-active --quiet xkeysnail
|
||||
|
6
xkeysnail-config/root_logoff.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
# /usr/local/bin/logoff.sh
|
||||
while true; do
|
||||
w | grep -E "$1.*$2" > /dev/null 2>&1 || (sudo systemctl stop xkeysnail && sudo pkill -f logoff)
|
||||
sleep 5
|
||||
done
|
@@ -0,0 +1,41 @@
|
||||
<?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>
|
After Width: | Height: | Size: 3.0 KiB |
41
xkeysnail-config/trayapps/appindicator/icons/kinto-color.svg
Normal file
@@ -0,0 +1,41 @@
|
||||
<?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>
|
After Width: | Height: | Size: 3.0 KiB |
@@ -0,0 +1,28 @@
|
||||
<?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>
|
After Width: | Height: | Size: 2.2 KiB |
@@ -0,0 +1,28 @@
|
||||
<?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>
|
After Width: | Height: | Size: 2.2 KiB |
@@ -0,0 +1,24 @@
|
||||
<?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>
|
After Width: | Height: | Size: 2.1 KiB |
25
xkeysnail-config/trayapps/appindicator/icons/kinto-solid.svg
Normal file
@@ -0,0 +1,25 @@
|
||||
<?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>
|
After Width: | Height: | Size: 2.1 KiB |
27
xkeysnail-config/trayapps/appindicator/icons/kinto.svg
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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>
|
After Width: | Height: | Size: 2.4 KiB |
8
xkeysnail-config/trayapps/appindicator/kintotray.desktop
Normal file
@@ -0,0 +1,8 @@
|
||||
[Desktop Entry]
|
||||
Name=Kinto Tray
|
||||
GenericName=Kintotray
|
||||
Comment=Make Linux Type Like it's a Mac
|
||||
Exec=/bin/bash -c "{homedir}/.config/kinto/kintotray.py"
|
||||
Terminal=false
|
||||
Type=Application
|
||||
X-GNOME-Autostart-enabled=true
|
707
xkeysnail-config/trayapps/appindicator/kintotray.py
Executable file
@@ -0,0 +1,707 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import gi
|
||||
|
||||
gi.require_version('Gtk', '3.0')
|
||||
gi.require_version('AppIndicator3', '0.1')
|
||||
gi.require_version('Notify', '0.7')
|
||||
|
||||
import signal,time,os,fcntl,datetime,re
|
||||
from subprocess import Popen, PIPE, CalledProcessError
|
||||
from shutil import which
|
||||
from gi.repository import Gtk,GLib,GdkPixbuf
|
||||
from gi.repository import AppIndicator3 as appindicator
|
||||
from gi.repository import Notify as notify
|
||||
|
||||
import signal
|
||||
|
||||
def kill_child():
|
||||
if child_pid is None:
|
||||
pass
|
||||
else:
|
||||
os.kill(child_pid, signal.SIGTERM)
|
||||
|
||||
import atexit
|
||||
atexit.register(kill_child)
|
||||
|
||||
APPINDICATOR_ID = 'Kinto'
|
||||
|
||||
class Indicator():
|
||||
|
||||
global child_pid
|
||||
kinto_status = Popen("while :; do clear; systemctl is-active xkeysnail; sleep 2s; done", stdout=PIPE, shell=True)
|
||||
child_pid = kinto_status.pid
|
||||
|
||||
homedir = os.path.expanduser("~")
|
||||
kconfig = homedir+"/.config/kinto/kinto.py"
|
||||
ostype = os.environ.get('XDG_CURRENT_DESKTOP')
|
||||
|
||||
enable_id = 0
|
||||
winmac_id = 0
|
||||
chkautostart_id = 0
|
||||
autostart_bool = False
|
||||
menu = Gtk.Menu()
|
||||
menukb = Gtk.Menu()
|
||||
checkbox_autostart = Gtk.CheckMenuItem('Autostart')
|
||||
restart = Gtk.MenuItem('Restart')
|
||||
stop = Gtk.MenuItem('Stop')
|
||||
keyboards = Gtk.MenuItem('Keyboard Types')
|
||||
keyboards.set_submenu(menukb)
|
||||
winkb = Gtk.RadioMenuItem(label='Windows')
|
||||
mackb = Gtk.RadioMenuItem(label='Apple',group=winkb)
|
||||
chromekb = Gtk.RadioMenuItem(label='Chromebook',group=winkb)
|
||||
ibmkb = Gtk.RadioMenuItem(label='IBM (No Super/Win key)',group=winkb)
|
||||
winmackb = Gtk.RadioMenuItem(label='Windows & Apple*',group=winkb)
|
||||
edit = Gtk.MenuItem('Customize')
|
||||
edit_submenu = Gtk.Menu()
|
||||
edit.set_submenu(edit_submenu)
|
||||
tweaks = Gtk.MenuItem('Tweaks')
|
||||
rightmod = Gtk.CheckButton('AltGr on Right Cmd')
|
||||
vsc2st3 = Gtk.CheckButton('ST3 hotkeys for VS Code')
|
||||
caps2esc = Gtk.CheckButton('Capslock is Escape when tapped, Cmd when held')
|
||||
caps2cmd = Gtk.CheckButton('Capslock is Cmd')
|
||||
button_config = Gtk.MenuItem('Kinto Config (shortcuts)')
|
||||
service = Gtk.MenuItem('Kinto Service')
|
||||
# Keyboard type set below
|
||||
button_syskb = Gtk.MenuItem('System Shortcuts')
|
||||
button_region = Gtk.MenuItem('Change Language')
|
||||
systray = Gtk.CheckMenuItem('Tray Enabled')
|
||||
helpm = Gtk.MenuItem('Help')
|
||||
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
|
||||
restartsvc = False
|
||||
unixts = int(time.time())
|
||||
last_status = ""
|
||||
|
||||
def __init__(self):
|
||||
res = Popen(['sudo', 'systemctl','is-active','--quiet','xkeysnail'])
|
||||
res.wait()
|
||||
|
||||
if res.returncode == 0:
|
||||
self.last_status = 'active'
|
||||
self.indicator = appindicator.Indicator.new(APPINDICATOR_ID, os.environ['HOME']+'/.config/kinto/kinto-invert.svg', appindicator.IndicatorCategory.SYSTEM_SERVICES)
|
||||
else:
|
||||
self.last_status = 'inactive'
|
||||
self.indicator = appindicator.Indicator.new(APPINDICATOR_ID, os.environ['HOME']+'/.config/kinto/kinto.svg', appindicator.IndicatorCategory.SYSTEM_SERVICES)
|
||||
|
||||
self.indicator.set_status(appindicator.IndicatorStatus.ACTIVE)
|
||||
self.indicator.set_menu(self.build_menu(res))
|
||||
notify.init(APPINDICATOR_ID)
|
||||
|
||||
GLib.timeout_add(2000, self.update_terminal)
|
||||
|
||||
def build_menu(self,res):
|
||||
|
||||
with open(self.kconfig) as configfile:
|
||||
autostart_line = configfile.read().split('\n')[1]
|
||||
|
||||
# Autostart
|
||||
if "autostart = true" in autostart_line.casefold():
|
||||
autostart_bool = True
|
||||
|
||||
if autostart_bool:
|
||||
# Popen(['sudo', 'systemctl','restart','xkeysnail'])
|
||||
self.checkbox_autostart.set_active(True)
|
||||
self.chkautostart_id = self.checkbox_autostart.connect('activate',self.setAutostart,False)
|
||||
else:
|
||||
self.checkbox_autostart.set_active(False)
|
||||
self.chkautostart_id = self.checkbox_autostart.connect('activate',self.setAutostart,True)
|
||||
|
||||
self.restart.connect('activate',self.runRestart)
|
||||
self.menu.append(self.restart)
|
||||
self.stop.connect('activate',self.runStop)
|
||||
self.menu.append(self.stop)
|
||||
|
||||
self.refreshKB()
|
||||
|
||||
self.mackb.signal_id = self.mackb.connect('activate',self.setKB,"mac")
|
||||
self.winkb.signal_id = self.winkb.connect('activate',self.setKB,"win")
|
||||
self.chromekb.signal_id = self.chromekb.connect('activate',self.setKB,"chrome")
|
||||
self.ibmkb.signal_id = self.ibmkb.connect('activate',self.setKB,"ibm")
|
||||
self.winmackb.signal_id = self.winmackb.connect('activate',self.setKB,"winmac")
|
||||
|
||||
self.menukb.append(self.winkb)
|
||||
self.menukb.append(self.mackb)
|
||||
self.menukb.append(self.chromekb)
|
||||
self.menukb.append(self.ibmkb)
|
||||
self.menukb.append(self.winmackb)
|
||||
self.menu.append(self.keyboards)
|
||||
|
||||
self.tweaks.connect('activate',self.setTweaks)
|
||||
self.edit_submenu.append(self.tweaks)
|
||||
self.button_config.connect('activate',self.setConfig)
|
||||
self.edit_submenu.append(self.button_config)
|
||||
self.service.connect('activate',self.setService)
|
||||
self.edit_submenu.append(self.service)
|
||||
# Set System Keyboard Shortcuts
|
||||
self.button_syskb.connect('activate',self.setSysKB)
|
||||
self.edit_submenu.append(self.button_syskb)
|
||||
# Set Language
|
||||
self.button_region.connect('activate',self.setRegion)
|
||||
self.edit_submenu.append(self.button_region)
|
||||
self.edit_submenu.append(self.checkbox_autostart)
|
||||
if os.path.exists(os.environ['HOME']+'/.config/autostart/kintotray.desktop'):
|
||||
self.systray.set_active(True)
|
||||
self.systray.signal_id = self.systray.connect('activate',self.checkTray,False)
|
||||
else:
|
||||
self.systray.signal_id = self.systray.connect('activate',self.checkTray,True)
|
||||
self.edit_submenu.append(self.systray)
|
||||
self.menu.append(self.edit)
|
||||
|
||||
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)
|
||||
self.help_submenu.append(self.about)
|
||||
self.menu.append(self.helpm)
|
||||
|
||||
self.keyboards.connect('activate',self.refresh)
|
||||
|
||||
# self.debug.connect('activate',self.runDebug)
|
||||
# self.menu.append(self.debug)
|
||||
|
||||
# self.tweaks.connect('activate',self.setTweaks)
|
||||
# self.menu.append(self.tweaks)
|
||||
|
||||
# Edit Config
|
||||
# self.button_config.connect('activate',self.setConfig)
|
||||
# self.menu.append(self.button_config)
|
||||
|
||||
# # Set System Keyboard Shortcuts
|
||||
# self.button_syskb.connect('activate',self.setSysKB)
|
||||
# self.menu.append(self.button_syskb)
|
||||
|
||||
# # Set Language
|
||||
# self.button_region.connect('activate',self.setRegion)
|
||||
# self.menu.append(self.button_region)
|
||||
|
||||
item_quit = Gtk.MenuItem('Close')
|
||||
item_quit.connect('activate', quit)
|
||||
self.menu.append(item_quit)
|
||||
self.menu.show_all()
|
||||
|
||||
return self.menu
|
||||
|
||||
# def refresh(self, widget, event):
|
||||
# print('refresh!!!')
|
||||
# if event.button != 1:
|
||||
# return False #only intercept left mouse button
|
||||
# md = gtk.MessageDialog(self, gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO, gtk.BUTTONS_CLOSE, "herp derp, I only needed one click")
|
||||
# md.run()
|
||||
# md.destroy()
|
||||
# return True
|
||||
|
||||
def checkTray(self,button,tray_bool):
|
||||
# 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'])
|
||||
self.systray.disconnect(self.systray.signal_id)
|
||||
self.systray.set_active(True)
|
||||
self.systray.signal_id = self.systray.connect('activate',self.checkTray,False)
|
||||
else:
|
||||
Popen(['rm',os.environ['HOME']+'/.config/autostart/kintotray.desktop'])
|
||||
Gtk.main_quit()
|
||||
self.systray.disconnect(self.systray.signal_id)
|
||||
self.systray.set_active(False)
|
||||
self.systray.signal_id = self.systray.connect('activate',self.checkTray,True)
|
||||
return
|
||||
|
||||
def refresh(self,button):
|
||||
self.refreshKB()
|
||||
|
||||
def refreshKB(self):
|
||||
# Keyboard Types
|
||||
ismac = "perl -ne 'print if /^(\s{4})((?!#).*)(# Mac\n)/' ~/.config/kinto/kinto.py | wc -l"
|
||||
iswin = "perl -ne 'print if /^(\s{4})(# -- Default Win)/' ~/.config/kinto/kinto.py | wc -l"
|
||||
ischrome = "perl -ne 'print if /^(\s{4})((?!#).*)(# Chromebook\n)/' ~/.config/kinto/kinto.py | wc -l"
|
||||
iswinmac = "perl -ne 'print if /^(\s{4})(# -- Default Mac)/' ~/.config/kinto/kinto.py | wc -l"
|
||||
isibm = "perl -ne 'print if /^(\s{4})((?!#).*)(# IBM\n)/' ~/.config/kinto/kinto.py | wc -l"
|
||||
mac_result = int(self.queryConfig(ismac))
|
||||
win_result = int(self.queryConfig(iswin))
|
||||
chrome_result = int(self.queryConfig(ischrome))
|
||||
ibm_result = int(self.queryConfig(isibm))
|
||||
winmac_result = int(self.queryConfig(iswinmac))
|
||||
|
||||
countkb = 0
|
||||
|
||||
if mac_result:
|
||||
self.mackb.set_active(True)
|
||||
countkb += 1
|
||||
if win_result:
|
||||
self.winkb.set_active(True)
|
||||
countkb += 1
|
||||
if chrome_result:
|
||||
self.chromekb.set_active(True)
|
||||
countkb += 1
|
||||
if winmac_result:
|
||||
self.winmackb.set_active(True)
|
||||
countkb += 1
|
||||
if ibm_result:
|
||||
ibmkb.set_active(True)
|
||||
countkb += 1
|
||||
|
||||
if countkb > 1:
|
||||
Popen(['notify-send','Kinto: Remove ' + str(countkb-1) + ' kb type(s)'])
|
||||
|
||||
return
|
||||
|
||||
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)
|
||||
op = output.read()
|
||||
if op == None:
|
||||
return ''
|
||||
status = op.decode('utf-8').rstrip()
|
||||
if "inactive" in status or "failed" in status or "deactivating" in status or "activating" in status:
|
||||
stats = "inactive"
|
||||
elif "active" in status:
|
||||
stats = "active"
|
||||
else:
|
||||
stats = "inactive"
|
||||
return stats
|
||||
|
||||
def update_terminal(self):
|
||||
status = self.non_block_read().strip()
|
||||
nowts = int(time.time())
|
||||
if (nowts - self.unixts) > 5 and (status=='active' and self.indicator.get_icon() != os.environ['HOME']+'/.config/kinto/kinto-invert.svg'):
|
||||
self.indicator.set_icon(os.environ['HOME']+'/.config/kinto/kinto-invert.svg')
|
||||
elif (nowts - self.unixts) > 5 and (status == 'inactive' and self.indicator.get_icon() != os.environ['HOME']+'/.config/kinto/kinto.svg'):
|
||||
self.indicator.set_icon(os.environ['HOME']+'/.config/kinto/kinto.svg')
|
||||
self.last_status = status
|
||||
|
||||
return self.kinto_status.poll() is None
|
||||
|
||||
def openSupport(self,button):
|
||||
Gtk.show_uri_on_window(None, "https://github.com/rbreaves/kinto#table-of-contents", Gtk.get_current_event_time())
|
||||
return
|
||||
|
||||
def runAbout(self,button):
|
||||
win = Gtk.Window()
|
||||
|
||||
path = os.environ['HOME']+'/.config/kinto/kinto-color.svg'
|
||||
width = -1
|
||||
height = 128
|
||||
preserve_aspect_ratio = True
|
||||
|
||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(path, width, height, preserve_aspect_ratio)
|
||||
win.set_default_icon_list([pixbuf])
|
||||
|
||||
win.set_title("About")
|
||||
win.set_default_size(350, 200)
|
||||
win.set_position(Gtk.WindowPosition.CENTER)
|
||||
|
||||
context = win.get_style_context()
|
||||
default_background = str(context.get_background_color(Gtk.StateType.NORMAL))
|
||||
|
||||
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))
|
||||
blue = float(tokenValue.group(3))
|
||||
alpha = float(tokenValue.group(4))
|
||||
|
||||
bgAvg = (red + green + blue)/3
|
||||
|
||||
if(bgAvg > 0.5):
|
||||
theme = "light"
|
||||
else:
|
||||
theme = "dark"
|
||||
|
||||
vbox = Gtk.VBox()
|
||||
# innervbox = Gtk.VBox()
|
||||
|
||||
if theme == "dark":
|
||||
path = os.environ['HOME']+'/.config/kinto/kinto-invert.svg'
|
||||
else:
|
||||
path = os.environ['HOME']+'/.config/kinto/kinto-color.svg'
|
||||
width = -1
|
||||
height = 128
|
||||
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)
|
||||
|
||||
with open(os.environ['HOME']+'/.config/kinto/version', 'r') as file:
|
||||
verdata = file.read().replace('\n', '')
|
||||
|
||||
version = Gtk.Label('Kinto v' + verdata)
|
||||
|
||||
credits = Gtk.Label("Author: Ben Reaves")
|
||||
spacer = Gtk.Label(" ")
|
||||
copy = Gtk.Label("© 2019, 2020 - GPLv2")
|
||||
url = Gtk.LinkButton("http://kinto.sh", label="kinto.sh")
|
||||
|
||||
vbox.add(image)
|
||||
vbox.add(version)
|
||||
vbox.add(spacer)
|
||||
vbox.add(credits)
|
||||
vbox.add(copy)
|
||||
vbox.add(url)
|
||||
win.add(vbox)
|
||||
|
||||
win.show_all()
|
||||
|
||||
version.set_selectable(True)
|
||||
win.connect('delete-event', self.on_delete_event)
|
||||
|
||||
return
|
||||
|
||||
def setTweaks(self,button):
|
||||
win = Gtk.Window()
|
||||
|
||||
path = os.environ['HOME']+'/.config/kinto/kinto-color.svg'
|
||||
width = -1
|
||||
height = 128
|
||||
preserve_aspect_ratio = True
|
||||
|
||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(path, width, height, preserve_aspect_ratio)
|
||||
win.set_default_icon_list([pixbuf])
|
||||
|
||||
win.set_title("Kinto Tweaks")
|
||||
win.set_default_size(350, 200)
|
||||
win.set_position(Gtk.WindowPosition.CENTER)
|
||||
|
||||
# Check AltGr - commented out is enabled
|
||||
is_rightmod = "perl -ne 'print if /^(\s{4})(Key.*)(Multi-language)/' ~/.config/kinto/kinto.py | wc -l"
|
||||
rightmod_result = int(self.queryConfig(is_rightmod))
|
||||
|
||||
# Sublime enabled for vscode
|
||||
is_vsc2st3 = "perl -ne 'print if /^(\s{4}\w.*)(- Sublime)/' ~/.config/kinto/kinto.py | wc -l"
|
||||
vsc2st3_result = int(self.queryConfig(is_vsc2st3))
|
||||
|
||||
# Caps2Esc enabled
|
||||
is_caps2esc = "perl -ne 'print if /^(\s{4}{\w.*)(# Caps2Esc)/' ~/.config/kinto/kinto.py | wc -l"
|
||||
caps2esc_result = int(self.queryConfig(is_caps2esc))
|
||||
|
||||
# Caps2Cmd enabled
|
||||
is_caps2cmd = "perl -ne 'print if /^(\s{4}\w.*)(# Caps2Cmd)/' ~/.config/kinto/kinto.py | wc -l"
|
||||
caps2cmd_result = int(self.queryConfig(is_caps2cmd))
|
||||
|
||||
# Enter2Cmd enabled
|
||||
# (\s{4}{\w.*)(# Enter2Cmd)
|
||||
|
||||
vbox = Gtk.VBox()
|
||||
|
||||
self.lbl = Gtk.Label()
|
||||
global restartsvc
|
||||
restartsvc = False
|
||||
self.rightmod = Gtk.CheckButton('AltGr on Right Cmd')
|
||||
self.vsc2st3 = Gtk.CheckButton('ST3 hotkeys for VS Code')
|
||||
self.caps2esc = Gtk.CheckButton('Capslock is Escape when tapped, Cmd when held')
|
||||
self.caps2cmd = Gtk.CheckButton('Capslock is Cmd')
|
||||
|
||||
if rightmod_result == 0:
|
||||
self.rightmod.set_active(True)
|
||||
|
||||
if vsc2st3_result > 0:
|
||||
self.vsc2st3.set_active(True)
|
||||
|
||||
if caps2esc_result > 0:
|
||||
self.caps2esc.set_active(True)
|
||||
self.caps2cmd.set_sensitive(False)
|
||||
|
||||
if caps2cmd_result > 0:
|
||||
self.caps2cmd.set_active(True)
|
||||
self.caps2esc.set_sensitive(False)
|
||||
|
||||
self.rightmod.signal_id = self.rightmod.connect('toggled',self.setRightMod)
|
||||
self.vsc2st3.signal_id = self.vsc2st3.connect('toggled',self.setVSC2ST3)
|
||||
self.caps2esc.signal_id = self.caps2esc.connect('toggled',self.setCaps2Esc)
|
||||
self.caps2cmd.signal_id = self.caps2cmd.connect('toggled',self.setCaps2Cmd)
|
||||
|
||||
vbox.add(self.rightmod)
|
||||
vbox.add(self.vsc2st3)
|
||||
vbox.add(self.caps2esc)
|
||||
vbox.add(self.caps2cmd)
|
||||
vbox.add(self.lbl)
|
||||
win.add(vbox)
|
||||
|
||||
win.show_all()
|
||||
|
||||
win.connect('delete-event', self.on_delete_event)
|
||||
|
||||
return
|
||||
|
||||
__gsignals__ = {
|
||||
"delete-event" : "override"
|
||||
}
|
||||
|
||||
def on_delete_event(event, self, widget):
|
||||
global restartsvc
|
||||
if restartsvc == True:
|
||||
try:
|
||||
restartcmd = ['sudo', 'systemctl','restart','xkeysnail']
|
||||
Popen(restartcmd)
|
||||
restartsvc = False
|
||||
|
||||
except CalledProcessError:
|
||||
Popen(['notify-send','Kinto: Error restarting Kinto after setting tweaks!'])
|
||||
|
||||
self.hide()
|
||||
self.destroy()
|
||||
return True
|
||||
|
||||
def setRightMod(self,button):
|
||||
global restartsvc
|
||||
try:
|
||||
if self.winkb.get_active() or self.winmackb.get_active():
|
||||
# print('winkb true')
|
||||
setkb = 's/^(\s{4})((# )(.*)(# )(WinMac - Multi-language.*)|(K)(.*)(# )(WinMac - Multi-language.*))/ $4$5$6$9$7$8$9$10/g'
|
||||
if self.mackb.get_active():
|
||||
# print('mackb true')
|
||||
setkb = 's/^(\s{4})((# )(.*)(# )(Mac - Multi-language.*)|(K)(.*)(# )(Mac - Multi-language.*))/ $4$5$6$9$7$8$9$10/g'
|
||||
if self.chromekb.get_active():
|
||||
# print('chromekb true')
|
||||
setkb = 's/^(\s{4})((# )(.*)(# )(Chromebook - Multi-language.*)|(K)(.*)(# )(Chromebook - Multi-language.*))/ $4$5$6$9$7$8$9$10/g'
|
||||
if self.ibmkb.get_active():
|
||||
# print('ibmkb true')
|
||||
setkb = 's/^(\s{4})((# )(.*)(# )(IBM - Multi-language.*)|(K)(.*)(# )(IBM - Multi-language.*))/ $4$5$6$9$7$8$9$10/g'
|
||||
|
||||
cmds = ['perl','-pi','-e',setkb,self.kconfig]
|
||||
|
||||
cmdsTerm = Popen(cmds)
|
||||
|
||||
restartsvc = True
|
||||
|
||||
except CalledProcessError:
|
||||
Popen(['notify-send','Kinto: Error Resetting AltGr!'])
|
||||
|
||||
return
|
||||
|
||||
def setVSC2ST3(self,button):
|
||||
global restartsvc
|
||||
|
||||
try:
|
||||
if self.chromekb.get_active() or self.ibmkb.get_active():
|
||||
setkb = 's/^(\s{4})(\w.*)(# )(Chromebook/IBM - Sublime)|^(\s{4})(# )(\w.*)(# Chromebook/IBM - Sublime)/$5$7$8$1$3$2$3$4/g'
|
||||
else:
|
||||
setkb = 's/^(\s{4})(\w.*)(# )(Default - Sublime)|^(\s{4})(# )(\w.*)(# Default - Sublime)/$5$7$8$1$3$2$3$4/g'
|
||||
|
||||
cmds = ['perl','-pi','-e',setkb,self.kconfig]
|
||||
|
||||
cmdsTerm = Popen(cmds)
|
||||
|
||||
restartsvc = True
|
||||
|
||||
except CalledProcessError:
|
||||
Popen(['notify-send','Kinto: Error Resetting SublimeText remaps for VSCode!'])
|
||||
return
|
||||
|
||||
def setCaps2Esc(self,button):
|
||||
|
||||
global restartsvc
|
||||
try:
|
||||
if self.winkb.get_active() or self.winmackb.get_active() or self.ibmkb.get_active() or self.mackb.get_active():
|
||||
setkb = 's/^(\s{4})((# )(\{\w.*)(# Caps2Esc\n)|(\{\w.*)(# )(Caps2Esc - Chrome.*)|(\{.*)(# )(Caps2Esc\n|Placeholder)|(\w.*)(# )(Caps2Cmd.*)|(# )(\{.*)(# )(Placeholder))/ $4$5$7$6$7$8$10$9$10$11$13$12$13$14$16$17$18/g'
|
||||
if self.chromekb.get_active():
|
||||
setkb = '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'
|
||||
|
||||
cmds = ['perl','-pi','-e',setkb,self.kconfig]
|
||||
|
||||
if self.caps2esc.get_active():
|
||||
self.caps2cmd.set_sensitive(False)
|
||||
else:
|
||||
self.caps2cmd.set_sensitive(True)
|
||||
|
||||
cmdsTerm = Popen(cmds)
|
||||
|
||||
restartsvc = True
|
||||
|
||||
except CalledProcessError:
|
||||
Popen(['notify-send','Kinto: Error resetting caps2esc!'])
|
||||
|
||||
return
|
||||
|
||||
def setCaps2Cmd(self,button):
|
||||
|
||||
global restartsvc
|
||||
|
||||
try:
|
||||
if self.winkb.get_active() or self.winmackb.get_active() or self.ibmkb.get_active() or self.mackb.get_active():
|
||||
setkb = 's/^(\s{4})((\w.*)(# )(Caps2Cmd\n)|(\w.*)(# )(Caps2Cmd - Chrome.*)|(# )(\w.*)(# )(Caps2Cmd\n)|(\{\w.*)(# )(Caps2Esc.*)|(# )(\{.*)(# )(Placeholder))/ $4$3$4$5$7$6$7$8$10$11$12$14$13$14$15$17$18$19/g'
|
||||
if self.chromekb.get_active():
|
||||
setkb = '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'
|
||||
|
||||
cmds = ['perl','-pi','-e',setkb,self.kconfig]
|
||||
|
||||
if self.caps2cmd.get_active():
|
||||
self.caps2esc.set_sensitive(False)
|
||||
else:
|
||||
self.caps2esc.set_sensitive(True)
|
||||
|
||||
cmdsTerm = Popen(cmds)
|
||||
|
||||
restartsvc = True
|
||||
|
||||
except CalledProcessError:
|
||||
Popen(['notify-send','Kinto: Error resetting caps2cmd!'])
|
||||
|
||||
return
|
||||
|
||||
def runRestart(self,button):
|
||||
try:
|
||||
stop = Popen(['sudo', 'systemctl','stop','xkeysnail'])
|
||||
stop.wait()
|
||||
time.sleep(1)
|
||||
res = Popen(['pgrep','xkeysnail'])
|
||||
res.wait()
|
||||
|
||||
if res.returncode == 0:
|
||||
# Popen(['notify-send','Kinto: Ending Debug'])
|
||||
pkillxkey = Popen(['sudo', 'pkill','-f','bin/xkeysnail'])
|
||||
pkillxkey.wait()
|
||||
|
||||
Popen(['sudo', 'systemctl','start','xkeysnail'])
|
||||
except:
|
||||
Popen(['notify-send','Kinto: Error restarting Kinto!'])
|
||||
|
||||
def runStop(self,button):
|
||||
try:
|
||||
stop = Popen(['sudo', 'systemctl','stop','xkeysnail'])
|
||||
stop.wait()
|
||||
time.sleep(1)
|
||||
res = Popen(['pgrep','xkeysnail'])
|
||||
res.wait()
|
||||
|
||||
if res.returncode == 0:
|
||||
# Popen(['notify-send','Kinto: Ending Debug'])
|
||||
pkillxkey = Popen(['sudo', 'pkill','-f','bin/xkeysnail'])
|
||||
pkillxkey.wait()
|
||||
except:
|
||||
Popen(['notify-send','Kinto: Error stopping Kinto!'])
|
||||
|
||||
def runDebug(self,button,opendebug):
|
||||
try:
|
||||
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 opening Kinto!'])
|
||||
|
||||
def queryConfig(self,query):
|
||||
res = Popen(query, stdout=PIPE, stderr=None, shell=True)
|
||||
res.wait()
|
||||
return res.communicate()[0].strip().decode('UTF-8')
|
||||
|
||||
def setAutostart(self,button,autostart):
|
||||
try:
|
||||
if autostart == False:
|
||||
Popen(['perl','-pi','-e','s/autostart = true/autostart = false/g',os.environ['HOME']+'/.config/kinto/kinto.py'])
|
||||
self.checkbox_autostart.set_active(False)
|
||||
self.checkbox_autostart.disconnect(self.chkautostart_id)
|
||||
self.chkautostart_id = self.checkbox_autostart.connect('activate',self.setAutostart,True)
|
||||
else:
|
||||
Popen(['perl','-pi','-e','s/autostart = false/autostart = true/g',os.environ['HOME']+'/.config/kinto/kinto.py'])
|
||||
self.checkbox_autostart.set_active(True)
|
||||
self.checkbox_autostart.disconnect(self.chkautostart_id)
|
||||
self.chkautostart_id = self.checkbox_autostart.connect('activate',self.setAutostart,False)
|
||||
|
||||
except CalledProcessError:
|
||||
Popen(['notify-send','Kinto: Error setting autostart!'])
|
||||
|
||||
def setConfig(self,button):
|
||||
try:
|
||||
if os.path.exists('/opt/sublime_text/sublime_text'):
|
||||
Popen(['/opt/sublime_text/sublime_text',os.environ['HOME']+'/.config/kinto/kinto.py'])
|
||||
elif which(gedit) is not None:
|
||||
Popen(['gedit',os.environ['HOME']+'/.config/kinto/kinto.py'])
|
||||
elif which(mousepad) is not None:
|
||||
Popen(['mousepad',os.environ['HOME']+'/.config/kinto/kinto.py'])
|
||||
|
||||
except CalledProcessError: # Notify user about error on running restart commands.
|
||||
Popen(['notify-send','Kinto: Error could not open config file!'])
|
||||
|
||||
def setService(self,button):
|
||||
try:
|
||||
if os.path.exists('/opt/sublime_text/sublime_text'):
|
||||
Popen(['/opt/sublime_text/sublime_text','/lib/systemd/system/xkeysnail.service'])
|
||||
elif which(gedit) is not None:
|
||||
Popen(['gedit','/lib/systemd/system/xkeysnail.service'])
|
||||
elif which(mousepad) is not None:
|
||||
Popen(['mousepad','/lib/systemd/system/xkeysnail.service'])
|
||||
|
||||
except CalledProcessError: # Notify user about error on running restart commands.
|
||||
Popen(['notify-send','Kinto: Error could not open config file!'])
|
||||
|
||||
def setKB(self,button,kbtype):
|
||||
try:
|
||||
if kbtype == "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'
|
||||
elif kbtype == "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")
|
||||
elif kbtype == "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'
|
||||
elif kbtype == "chrome":
|
||||
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'
|
||||
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'
|
||||
|
||||
cmds = ['perl','-pi','-e',setkb,self.kconfig]
|
||||
cmdsTerm = Popen(cmds)
|
||||
cmdsTerm.wait()
|
||||
|
||||
restart = ['sudo', 'systemctl','restart','xkeysnail']
|
||||
Popen(restart)
|
||||
|
||||
except CalledProcessError:
|
||||
Popen(['notify-send','Kinto: Error Resetting KB Type!'])
|
||||
|
||||
def setSysKB(self,button):
|
||||
if self.ostype == "XFCE":
|
||||
Popen(['xfce4-keyboard-settings'])
|
||||
else:
|
||||
Popen(['gnome-control-center','keyboard'])
|
||||
|
||||
def setRegion(self,button):
|
||||
if self.ostype == "XFCE":
|
||||
Popen(['gnome-language-selector'])
|
||||
else:
|
||||
Popen(['gnome-control-center','region'])
|
||||
|
||||
def quit(source):
|
||||
Gtk.main_quit()
|
||||
|
||||
Indicator()
|
||||
signal.signal(signal.SIGINT, signal.SIG_DFL)
|
||||
Gtk.main()
|
@@ -2,7 +2,10 @@
|
||||
Name=Kinto_xkey
|
||||
GenericName=Kinto_xkey
|
||||
Comment=Make Linux Type Like it's a Mac
|
||||
Exec=/bin/bash -c "{xhost} +SI:localuser:root && sudo {systemctl} restart xkeysnail"
|
||||
Exec=/bin/bash -c "grep -q 'autostart = true' {homedir}/.config/kinto/kinto.py && {xhost} +SI:localuser:root && sudo {systemctl} restart xkeysnail"
|
||||
# Budgie logoff fix to avoid key input loss
|
||||
# ;{homedir}/.config/kinto/logoff.sh
|
||||
# ;sudo /usr/local/bin/logoff.sh $USER $DISPLAY
|
||||
Terminal=false
|
||||
Type=Application
|
||||
X-GNOME-Autostart-enabled=true
|
@@ -4,9 +4,8 @@ Description=xkeysnail
|
||||
[Service]
|
||||
Type=simple
|
||||
KillMode=process
|
||||
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}{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}'
|
||||
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 /bin/bash -c '/usr/bin/sudo pkill -f bin/xkeysnail && exit 0'
|
||||
Restart=on-failure
|
||||
RestartSec=3
|
||||
Environment=DISPLAY={displayid}
|
||||
|
@@ -4,10 +4,86 @@
|
||||
# to false for wordwise to work in Firefox
|
||||
|
||||
typeset -l distro
|
||||
distro=$(awk -F= '$1=="NAME" { print $2 ;}' /etc/os-release)
|
||||
distro=$(awk -F= '$1=="NAME" { gsub("[\",!,_, ]","",$2);print $2 ;}' /etc/os-release)
|
||||
typeset -l dename
|
||||
dename=$(./system-config/dename.sh | cut -d " " -f1)
|
||||
|
||||
|
||||
# Add additional shortcuts if needed, does not modify existing ones
|
||||
|
||||
if [[ $dename == 'gnome' || $dename == 'budgie' ]];then
|
||||
if [[ $(gsettings get org.gnome.mutter overlay-key | grep "''\|' '" | wc -l) != 1 ]];then
|
||||
bound=$(gsettings get org.gnome.mutter overlay-key)
|
||||
echo "Overlay key, " $bound ", detected. Will be removing so Super-Space can remap to Cmd-Space for app launching.."
|
||||
echo "Overlay key, Super, detected. Will be removing so Super-Space can remap to Cmd-Space for app launching.."
|
||||
gsettings set org.gnome.mutter overlay-key ''
|
||||
fi
|
||||
fi
|
||||
|
||||
# if ls /etc/apt/sources.list.d/system76* 1> /dev/null 2>&1; then
|
||||
if [[ $distro == 'popos' ]]; then
|
||||
pip3 install pillow
|
||||
# Addition, does not overwrite existing
|
||||
if [[ $(gsettings get org.gnome.desktop.wm.keybindings minimize | grep "\[\]" | wc -l) != 1 ]];then
|
||||
echo "Adding Super-h (Cmd+h) to hide/minimize Window."
|
||||
gsettings set org.gnome.desktop.wm.keybindings minimize "['<Super>h','<Alt>F9']"
|
||||
# work around to make sure settings survive reboot
|
||||
dconf dump /org/gnome/desktop/wm/keybindings/ > tempkb.conf
|
||||
dconf load /org/gnome/desktop/wm/keybindings/ < tempkb.conf
|
||||
else
|
||||
bound=$(gsettings get org.gnome.desktop.wm.keybindings minimize)
|
||||
echo "Hide/minimize Window is already bound to " $bound " , please remap it to Super-H for kinto."
|
||||
echo "gsettings set org.gnome.desktop.wm.keybindings minimize \"['<Super>h','<Alt>F9']\""
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $dename == "kde" ]]; then
|
||||
if [[ $distroy == "manjarolinux" ]]; then
|
||||
sudo ./system-config/unipkg.sh vte3
|
||||
else
|
||||
sudo ./system-config/unipkg.sh libvte-2.91-dev
|
||||
fi
|
||||
fi
|
||||
if [[ $distro == 'kdeneon' ]]; then
|
||||
kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Show Desktop" "Meta+D,none,Show Desktop"
|
||||
kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Window Close" "Alt+F4,none,Close Window"
|
||||
kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Window Minimize" "Meta+PgDown,none,Minimize Window"
|
||||
kwriteconfig5 --file "$HOME/.config/kglobalshortcutsrc" --group "kwin" --key "Window Maximize" "Meta+PgUp,none,Maximize Window"
|
||||
kquitapp5 kglobalaccel && sleep 2s && kglobalaccel5 &
|
||||
fi
|
||||
|
||||
if [[ $distro == 'fedora' ]]; then
|
||||
echo "Checking SELinux status..."
|
||||
if [[ $(perl -ne 'print if /^SELINUX=enforcing/' /etc/selinux/config | wc -l) != 0 ]]; then
|
||||
while true; do
|
||||
read -rep $'\nWould you like to update your SELinux state from enforcing to permissive? (y/n)\n' yn
|
||||
case $yn in
|
||||
[Yy]* ) setSE='yes'; break;;
|
||||
[Nn]* ) exp='no'; expsh=" " break;;
|
||||
# * ) echo "Please answer yes or no.";;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ $yn == "yes" ]]; then
|
||||
sed -i "s/SELINUX=enforcing/SELINUX=permissive/g" /etc/selinux/config
|
||||
echo "/etc/selinux/config has been updated. Please reboot your computer before continuing."
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
echo "SELinux state should be ok for Kinto to install"
|
||||
fi
|
||||
if [[ $(gsettings get org.gnome.desktop.wm.keybindings show-desktop | grep "\[\]" | wc -l) == 1 ]];then
|
||||
gsettings set org.gnome.desktop.wm.keybindings show-desktop "['<Super>d']"
|
||||
else
|
||||
if [[ $(gsettings get org.gnome.desktop.wm.keybindings show-desktop | grep "<Super>d" | wc -l) == 0 ]]; then
|
||||
echo 'Kinto will not set your "Show Desktop" hotkey due to it already being set.\nPlease set Show Desktop to Super-D, or Edit Kinto'"'"'s config.'
|
||||
echo "Did not run the following."
|
||||
echo "gsettings set org.gnome.desktop.wm.keybindings show-desktop \"['<Super>d']\""
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
function uninstall {
|
||||
|
||||
while true; do
|
||||
@@ -21,7 +97,7 @@ function uninstall {
|
||||
|
||||
if [ "$yn" == "f" ];then
|
||||
echo "Reset to factory shortcuts"
|
||||
if [ "$dename" == "gnome" ];then
|
||||
if [[ $dename == "gnome" || $dename == "budgie" ]];then
|
||||
echo "Resetting DE hotkeys..."
|
||||
echo "gsettings reset-recursively org.gnome.desktop.wm.keybindings"
|
||||
gsettings reset-recursively org.gnome.desktop.wm.keybindings
|
||||
@@ -41,7 +117,7 @@ function uninstall {
|
||||
fi
|
||||
elif [ "$yn" == "r" ]; then
|
||||
echo "Restore original user shortcuts"
|
||||
if [ "$dename" == "gnome" ]; then
|
||||
if [[ $dename == "gnome" || $dename == "budgie" ]]; then
|
||||
echo "Restoring DE hotkeys..."
|
||||
wmkeys=$(ls | grep -m1 "keybinding")
|
||||
mutterkeys=$(ls | grep -m1 "mutter_")
|
||||
@@ -60,13 +136,13 @@ function uninstall {
|
||||
fi
|
||||
elif [ "$dename" == "kde" ]; then
|
||||
echo "Restoring DE hotkeys..."
|
||||
kwinkeys = $(ls | grep -m1 "kwinrc")
|
||||
kdekeys = $(ls | grep -m1 "kglobalshortcutsrc")
|
||||
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")
|
||||
xfcekeys=$(ls | grep -m1 "xfce4-keyboard")
|
||||
cp ./"$xfcekeys" ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml
|
||||
fi
|
||||
fi
|
||||
@@ -88,7 +164,8 @@ function removeAppleKB {
|
||||
|
||||
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..."
|
||||
echo -e "\nYour system may log you off immediately during the restoration of budgie-daemon.\n"
|
||||
read -n 1 -s -r -p "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
|
||||
@@ -104,7 +181,7 @@ 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 will immediately log you out after this runs.)\n' yn
|
||||
read -rep $'Would you like to update Budgie to support proper App Switching? (y/n)\n(Your system may immediately log you out after this runs.)\n' yn
|
||||
case $yn in
|
||||
[Yy]* ) yn="y"; break;;
|
||||
[Nn]* ) yn="n";break;;
|
||||
@@ -149,162 +226,175 @@ 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 " 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
|
||||
|
||||
# multi-language
|
||||
rightalt=false
|
||||
# VS code remap
|
||||
vssublime=false
|
||||
|
||||
if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1 == "chromebook" ]]; then
|
||||
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=" "
|
||||
if ! [ -x "$(command -v python3-config)" ]; then
|
||||
if [ "$distro" == "ubuntu" ] || [ "$distro" == "debian" ] || [ "$distro" == 'linuxmint' ]; then
|
||||
pydev="python3-dev"
|
||||
elif [ "$distro" == "fedora" ]; then
|
||||
pydev="python3-devel"
|
||||
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
|
||||
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/prexk.sh ~/.config/kinto/prexk.sh
|
||||
yes | cp -rf ./system-config/caret_status_xkey.sh ~/.config/kinto/caret_status_xkey.sh
|
||||
yes | cp -rf ./xkeysnail-config/xkeysnail.service ./xkeysnail-config/xkeysnail.service.new
|
||||
# yes | cp -rf ./xkeysnail-config/xkeysnail.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#{xhost}#`\\which xhost`#g" ./xkeysnail-config/xkeysnail.service.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
|
||||
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
|
||||
sed -i "s#{xhost}#`\\which xhost`#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" == 'linuxmint' ]; 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" == 'linuxmint' ]; then
|
||||
pip3 install setuptools
|
||||
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
|
||||
# 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/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 == "budgie" ]]; then
|
||||
perl -pi -e "s/\s{4}(# )(K.*)(# Default SL - Change workspace.*budgie.*)/ \$2\$3/g" ./xkeysnail-config/kinto.py.new >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
if [[ $distro == "popos" ]]; then
|
||||
perl -pi -e "\s{4}(# )(K.*)(# SL - .*popos.*)/ \$2\$3/g" ./xkeysnail-config/kinto.py.new >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
if [[ $distro == "fedora" ]]; then
|
||||
perl -pi -e "\s{4}(# )(K.*)(# SL - .*fedora.*)/ \$2\$3/g" ./xkeysnail-config/kinto.py.new >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
if [[ $distro == "elementaryos" ]]; then
|
||||
perl -pi -e "\s{4}(# )(K.*)(# SL - .*eos.*)/ \$2\$3/g" ./xkeysnail-config/kinto.py.new >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
if [[ "$distro" == "manjaro"* ]]; then
|
||||
perl -pi -e "\s{4}(# )(K.*)(# SL - .*manjaro.*)/ \$2\$3/g" ./xkeysnail-config/kinto.py.new >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
if [[ $dename == "gnome" ]]; then
|
||||
perl -pi -e "\s{4}(# )(K.*)(# SL - .*ubuntu.*)/ \$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 [[ $dename == "xfce" ]]; then
|
||||
perl -pi -e "\s{4}(# )(K.*)(# SL - .*xfce.*)/ \$2\$3/g" ./xkeysnail-config/kinto.py.new >/dev/null 2>&1
|
||||
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 $rightalt ; then
|
||||
perl -pi -e "s/(\w.*)(Multi-language)/# \$1\$2/g" ./xkeysnail-config/kinto.py.new >/dev/null 2>&1
|
||||
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 [[ $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
|
||||
# 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
|
||||
@@ -316,8 +406,9 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1
|
||||
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
|
||||
git clone --depth 10 https://github.com/rbreaves/xkeysnail.git
|
||||
cd xkeysnail
|
||||
git pull --depth 10
|
||||
git checkout 51c369084e0045a8410d227bab52411bf84fb65b
|
||||
giturl=$(git ls-remote --get-url)
|
||||
if [ "$giturl" != "https://github.com/rbreaves/xkeysnail.git" ];then
|
||||
@@ -331,13 +422,21 @@ if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1
|
||||
sudo pip3 install --upgrade .
|
||||
cd ..
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl --state=not-found --all | grep xkeysnail
|
||||
if [ "$distro" == "fedora" ];then
|
||||
systemctl enable xkeysnail.service
|
||||
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
|
||||
if ! [[ $dename == "gnome" || $dename == "kde" ]];then
|
||||
sudo pkill -f kintotray >/dev/null 2>&1
|
||||
else
|
||||
sudo systemctl enable xkeysnail.service
|
||||
sed -i "s/systray = true/systray = false/g" ~/.config/kinto/initkb
|
||||
fi
|
||||
sudo systemctl restart xkeysnail
|
||||
nohup python3 ~/.config/kinto/gui/kinto-gui.py >/dev/null 2>&1 &
|
||||
|
||||
echo -e "Adding xhost fix...\n"
|
||||
|
||||
@@ -360,42 +459,33 @@ 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
|
||||
|
||||
elif [[ $1 == "5" || $1 == "uninstall" || $1 == "Uninstall" ]]; then
|
||||
echo "Uninstalling Kinto - xkeysnail (udev)"
|
||||
uninstall
|
||||
removeAppleKB
|
||||
sudo systemctl stop xkeysnail
|
||||
sudo systemctl disable xkeysnail
|
||||
sudo rm /etc/sudoers.d/limitedadmins
|
||||
rm ~/.config/autostart/xkeysnail.desktop
|
||||
rm -rf ~/.config/kinto
|
||||
sudo rm /etc/systemd/system/xkeysnail.service
|
||||
sudo rm /etc/systemd/system/graphical.target.wants/xkeysnail.service
|
||||
sudo rm /usr/lib/systemd/system/xkeysnail.service
|
||||
pkill -f kintotray >/dev/null 2>&1
|
||||
sudo systemctl stop xkeysnail >/dev/null 2>&1
|
||||
sudo systemctl disable xkeysnail >/dev/null 2>&1
|
||||
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
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl --state=not-found --all | grep xkeysnail
|
||||
# sudo systemctl --state=not-found --all | grep xkeysnail
|
||||
budgieUninstall
|
||||
exit 0
|
||||
elif [[ $1 == "5" || $1 == "budgieUpdate" ]]; then
|
||||
elif [[ $1 == "budgieUpdate" ]]; then
|
||||
budgieUpdate
|
||||
else
|
||||
echo "Expected argument was not provided"
|
||||
|