Compare commits

...

174 Commits
1.1-8 ... 1.2-1

Author SHA1 Message Date
Ben Reaves
157ea9a116 - Improved uninstaller, added verbosity 2020-10-24 21:56:29 -05:00
Ben Reaves
3cc1146954 - Removed repetitive output from setup 2020-10-24 20:50:24 -05:00
Ben Reaves
d2ae2a0b1d - Restore prekinto, needed for setup 2020-10-24 20:39:44 -05:00
Ben Reaves
89701595fb - Basic cleanup of old files 2020-10-24 19:28:37 -05:00
Ben Reaves
3f573c6d61 Update README.md 2020-10-24 17:21:05 -05:00
Ryan Reaves
6a20ac5932 Merge branch 'dev' 2020-10-24 12:10:04 -05:00
Ryan Reaves
34a94306ca - Removed unneeded uninstall function for Budgie DE 2020-10-24 12:00:47 -05:00
Ben Reaves
9adf85cbde Update README.md 2020-10-24 02:26:45 -05:00
Ben Reaves
18ddc4da01 Merge branch 'dev' 2020-10-24 00:03:23 -05:00
Ben Reaves
76e6186d54 - Added fix for about versioning 2020-10-24 00:03:01 -05:00
Ben Reaves
b3984244f8 Merge branch 'dev' 2020-10-23 23:57:55 -05:00
Ben Reaves
ef385a29f3 - Added fix for about versioning 2020-10-23 23:57:24 -05:00
Ben Reaves
1e59d89494 Merge pull request #294 from rbreaves/dev
Win & Linux Sys Trays & GUI, Fast KB Switching, Simple Wizard for Linux
2020-10-23 23:15:28 -05:00
Ben Reaves
f7c02dc52f - Resolved merge conflict 2020-10-23 23:09:26 -05:00
Ben Reaves
bf3ea4e358 Update README.md 2020-10-23 23:04:06 -05:00
Ben Reaves
07be0f826f - Fixed bug that causes app to close prematurely in some cases 2020-10-23 22:54:58 -05:00
Ben Reaves
21dd05415e - Added more hotkey fixes for multiple OS's 2020-10-23 22:32:07 -05:00
Ben Reaves
ef4b7f8b01 - Added in better parsing of distro names 2020-10-23 17:02:22 -05:00
Ben Reaves
9d57c1f841 - Updated shortcuts 2020-10-23 16:58:20 -05:00
Ben Reaves
6b0801eef6 - Fixed issue on xkeysnail setup and added elementaryOS hotkeys 2020-10-23 14:50:15 -05:00
Ryan Reaves
145e2a45b0 - Updated shortcuts for fedora 2020-10-23 13:42:31 -05:00
Ben Reaves
92519e31e8 - Added package for manjaro kde 2020-10-23 13:04:19 -05:00
Ryan Reaves
cb60322517 - Added Fedora fix to allow for systemd service files to run 2020-10-23 03:23:12 -05:00
Ben Reaves
11c3195c48 - Added shortcuts for kde neon 2020-10-23 01:52:34 -05:00
Ben Reaves
5f6c498f90 - Added pillow requirement for popos, popos shortcuts 2020-10-22 23:57:50 -05:00
Ben Reaves
c7dfbff27f - Added proper bg color for gui, added hotkeys for ubuntu workspace switching 2020-10-22 22:23:22 -05:00
Ben Reaves
e67f8964a1 - Fixed budgie uninstaller and confirmed SL hotkeys 2020-10-22 19:33:03 -05:00
Ben Reaves
7db6862f4f - Removed Budgie specific iconography from error messages 2020-10-22 17:29:38 -05:00
Ryan Reaves
ff58059770 - Updated installer and removed unnecessary toggle 2020-10-21 21:23:20 -05:00
Ben Reaves
64c96e38c7 - Added stop to gui & sys tray 2020-10-21 19:18:12 -05:00
Ben Reaves
f7c0876e83 Merge branch 'dev' into alpha 2020-10-21 04:13:24 -05:00
Ben Reaves
9b5ae88fe4 - Added missing icons folder 2020-10-21 04:12:39 -05:00
Ben Reaves
87011ddb18 - Added OS level shortcuts to xkeysnail remap WIP 2020-10-21 01:20:28 -05:00
Ben Reaves
ab4551d22f Update README.md 2020-10-21 00:25:33 -05:00
Ben Reaves
fc6b590965 - Reordered Install and requirements info 2020-10-21 00:18:06 -05:00
Ben Reaves
91dd44b6ba - Removed outdated info, added new setup info.
All references to C/x11 version of kinto has been removed. New setup info and screenshot has been added.
2020-10-21 00:16:10 -05:00
Ben Reaves
d7fc4b9277 Merge pull request #271 from rbreaves/alpha
System Tray Update for Windows and Linux
2020-10-20 23:47:23 -05:00
Ben Reaves
006a61a242 - Removed unneeded files 2020-10-20 23:43:36 -05:00
Ben Reaves
bafea4cef1 Merge pull request #293 from rbreaves/gui
- Added GUI, sys tray, and simple wizard installer for Linux
2020-10-20 23:39:58 -05:00
Ryan Reaves
437a2141ff - Install changes, debug fixes, refinements
- Added setup fixes for gui

- Fixed debug issues & updated copyright

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

- Fixed order of operations for args parsing

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

- File cleanup, relocations and faster setup file

- Do not clobber initkb if it already exists
2020-10-20 23:35:42 -05:00
Ben Reaves
aff4d46abc - Force initial setup, added assets
- Added assets for gui

- Updated gui to resize better

- gui sizing improvements

- Updated UI more and changed terminal vte import

- Fixed possible issue with VTE term implementation
2020-10-20 23:35:42 -05:00
Ben Reaves
8460f869a0 - KB Assist refined & key listener added
- KB Assist refined & key listener added

- All pages & bg images added for kb assist WIP

- Keyboard assistant refined

- Connected key event listener to kb assist
2020-10-20 23:35:42 -05:00
Ben Reaves
05683dad2e - GUI & sys tray interaction issues resolved
- Added fix to kill spawned processes to GUI app

- Added proper handling of spawn from disabling sys tray app

- Improved checkTray function

- Set full path to avoid issues on About
2020-10-20 23:35:42 -05:00
Ben Reaves
1c9302cb7a - GUI and sys tray added
- merging layouts

- Major progress, unknowns completed

- Added more menu options

- Updated status placement and formatting

- Ported Tweaks from tray to GUI, added more submenus to tray

- GUI App icon improvements, desktop shortcut (linux), sys tray icon status improved

- Added debug switch to gui app, proper child termination for sys tray

- Updates to debug functionality

- Added support and about to sys tray

- Added more commands to sudoers & added version to about

- KB logic can now refresh when needed

- GUI and sys tray feature complete
2020-10-20 23:35:40 -05:00
Ben Reaves
33e39a8068 Update README.md 2020-10-13 12:23:34 -05:00
Ben Reaves
d4992fe00a - Updated installer with more info for Ubuntu/Gnome3 users 2020-10-12 22:24:28 -05:00
Ben Reaves
be0cfbce2d - Added mousepad as a default for edit config (ensoOS) 2020-10-12 21:54:13 -05:00
Ben Reaves
7574338d3a - Completed tweaks menu for Linux sys tray 2020-10-12 21:34:17 -05:00
Ben Reaves
a692377c0a - Added kb switching improvements & better AltGr detection 2020-10-12 15:41:17 -05:00
Ben Reaves
1e956287c0 - Tweaks menu updated, kb switching via tray for linux 2020-10-12 02:48:02 -05:00
Ben Reaves
ca76a46372 - Adding in cmd-space hotfixes 2020-10-11 20:15:13 -05:00
Ben Reaves
6f314d44b4 - Merged hotfix to dev 2020-10-11 20:04:11 -05:00
Ben Reaves
cce00a26a3 - merged dev 2020-10-11 19:58:21 -05:00
Ben Reaves
64b012ac65 Merge pull request #289 from rbreaves/hotfix
- Fixed uninstall issues for KDE, xfce & improved cmd-space remap. Closes #288
2020-10-11 18:20:43 -05:00
Ben Reaves
29a77f74de - Moved basic code completion to VS Code for Linux to proper location 2020-10-11 18:18:29 -05:00
Ben Reaves
0c1b83ecb7 - Added Cmd-Space fix for KDE and silenced output 2020-10-11 18:05:09 -05:00
Ben Reaves
58a2ac4f35 - Added Cmd-Space support for EnsoOS 2020-10-11 17:39:49 -05:00
Ben Reaves
5f9a6f7a31 - Fixed uninstaller for xfce & kde on restoring original shortcut keys 2020-10-11 14:02:54 -05:00
Ben Reaves
b72def92ce - Reversing App Launcher hotkey from OS to kinto.py 2020-10-11 00:57:07 -05:00
Ben Reaves
0b849d21e8 Update README.md 2020-10-10 13:53:08 -05:00
Ben Reaves
03029e22dc Update README.md 2020-10-10 13:52:04 -05:00
Ben Reaves
b87dfdab9c Update README.md 2020-10-10 01:18:52 -05:00
Ben Reaves
1bdef2f519 Update README.md 2020-10-03 23:52:44 -05:00
Ben Reaves
f4daa29040 Update README.md 2020-10-02 04:42:23 -05:00
Ben Reaves
cd9f3042bd Update README.md 2020-10-02 04:38:46 -05:00
Ben Reaves
139cff181f Merge pull request #280 from rbreaves/hotfix
- Fixes copy/paste for cmd/mintty in Win10
2020-09-29 04:09:28 -05:00
Ben Reaves
d642966ba8 - Fixes copy/paste for cmd/mintty in Win10 2020-09-29 04:06:28 -05:00
Ben Reaves
dc98778439 - Added additional copy/paste fixes for cmd and mintty under Win10 2020-09-29 04:01:28 -05:00
Ben Reaves
5d0454a22f - Fixed autodetect keyboard issue on Window with new toggle 2020-09-15 03:10:38 -05:00
Ben Reaves
2420518c60 - Fixed re-enabling defaults for Win/mac kb after switching from cb/ibm kb under Windows 2020-09-15 02:49:49 -05:00
Ben Reaves
90b27a3e85 - Fixes sys tray hover over (chrome) & adds RDP client app fix for Windows. 2020-09-09 00:01:46 -05:00
Ben Reaves
b2284aa970 - Updated Caps2 documentation 2020-08-28 12:44:58 -05:00
Ben Reaves
3ad2a7f518 - Prepping Kinto for Caps2Esc/Cmd, and Tweaks options 2020-08-28 01:12:23 -05:00
Ben Reaves
b029d1fbb3 - Added Tweaks menu option UI elements 2020-08-27 19:10:45 -05:00
Ben Reaves
2df52c8e37 - WIP Linux System Tray Update 2020-08-26 22:36:09 -05:00
Ben Reaves
fea76528cd - Merged ibm branch into alpha 2020-08-26 22:32:27 -05:00
Ben Reaves
0d8310670b - Fixed installer issues on Linux 2020-08-26 03:24:52 -05:00
Ben Reaves
e43df230f3 - Added IBM & Chromebook support to Windows 10. Added Autodetect toggle. 2020-08-25 22:19:15 -05:00
Ben Reaves
231f537b0d - Merged hotfixes 2020-08-25 04:44:35 -05:00
Ben Reaves
2a396325f2 - Merged hotfixes 2020-08-25 04:40:48 -05:00
Ben Reaves
7fe35cdec3 Merge pull request #270 from rbreaves/hotfix
- Added virtualbox fix
2020-08-25 04:35:25 -05:00
Ben Reaves
e702e461ac Merge pull request #269 from rbreaves/hotfix
- Added VS Code Quick File List traversing. #264
2020-08-25 04:22:44 -05:00
Ben Reaves
f7e3011b8c - Merged latest hotfixes into ibmmmm 2020-08-25 04:21:32 -05:00
Ben Reaves
45e637a2a6 - Added virtualbox fix 2020-08-25 04:15:07 -05:00
Ben Reaves
a4dca21c22 - Added VS Code Quick File List traversing 2020-08-25 04:10:07 -05:00
Ben Reaves
40c3d68336 - WIP Added Chromebook and IBM Model M Keyboard Support for Windows to Installer 2020-08-25 03:52:19 -05:00
Ben Reaves
9f2815d73b - Merged hotfixes and Windows IBM support 2020-08-25 03:23:50 -05:00
Ben Reaves
52f2112abd - Preliminary IBM Model M Support for Linux, partail Win setup 2020-08-25 02:05:38 -05:00
Ben Reaves
efe01c94d4 Merge pull request #268 from rbreaves/hotfix
- Additional fixes for Windows 10 user profile spaces
2020-08-24 14:31:40 -05:00
Ben Reaves
0a5c526941 - Additional fixes for Windows 10 user profile spaces 2020-08-24 14:30:50 -05:00
Ben Reaves
0c7ca8586b Merge pull request #267 from rbreaves/hotfix
- Adds Windows 10 Support for spaces in user profile, code completion fix.
2020-08-24 03:59:11 -05:00
Ben Reaves
b1c361080a - Prevents physical Ctrl+Space from remapping into Ctrl+Esc, aka start menu. #264 2020-08-24 03:57:22 -05:00
Ben Reaves
b1d5aa68f3 - Added support for user profiles with spaces under Windows 10. Closes #266 2020-08-24 03:50:16 -05:00
Ben Reaves
4dd1c26563 Merge pull request #265 from rbreaves/hotfix
- Added manual code completion for vscode and sublimetext. Closes #264
2020-08-24 01:51:11 -05:00
Ben Reaves
c38cccdb44 - Added manual code completion for vscode and sublimetext. Closes #264 2020-08-24 01:49:30 -05:00
Ben Reaves
558e86dd78 Merge pull request #258 from matteron/FixAltBackspaces
Fixing Alt + Backspace on Windows
2020-08-12 14:20:54 -05:00
Schiano, Mattia
463730fe1b Making autohotkey hotkey for ctrl + backspace only read raw keyboard input to prevent alt + backspace from triggering ctrl + backspace 2020-08-11 15:51:50 -04:00
Ben Reaves
79bcdeb89d Merge pull request #255 from rbreaves/alpha
- Added xfce system tray support
2020-08-05 01:42:22 -05:00
Ryan Reaves
a84afd5b10 - Restored ExecStop command to help end xkeysnail for some DEs (xfce) 2020-08-04 21:42:45 -05:00
Ryan Reaves
2e99c023bb - Correct xfce update for kinto system tray 2020-08-04 21:21:01 -05:00
Ben Reaves
98a1d8a0f1 - Added xfce to kinto system tray 2020-08-04 21:04:01 -05:00
Ben Reaves
72f2f93657 - Ensure Kinto is disabled on Windows during VirtualBox usage 2020-08-04 20:17:27 -05:00
Ben Reaves
9ea909af33 Merge pull request #254 from rbreaves/alpha
- Added ability to kill xkeysnail duplicate processes
2020-08-04 17:39:19 -05:00
Ben Reaves
f37d7d09ec - Updated killdups to end all orphaned processes before initiating a new process 2020-08-04 17:37:59 -05:00
Ben Reaves
d180b94bd9 - Added ability to kill xkeysnail duplicate processes 2020-08-04 17:05:48 -05:00
Ben Reaves
f5dc41589d Update README.md 2020-08-03 20:23:11 -05:00
Ben Reaves
4f562357d5 Merge pull request #253 from rbreaves/alpha
- System Tray added for Ubuntu/Gnome, Ubuntu Budgie, and Mate
2020-08-03 18:23:09 -05:00
Ben Reaves
91b58f0100 - Added system tray for gnome, ubuntu budgie, and mate 2020-08-03 18:21:44 -05:00
Ben Reaves
8795783d16 - Merged Dev into alpha 2020-08-03 16:52:31 -05:00
Ben Reaves
be0f2e67bb Merge branch 'dev' 2020-08-03 15:43:50 -05:00
Ben Reaves
2270ea5d0d - Enabled left clicks on Kinto system tray in Windows 2020-08-03 03:10:51 -05:00
Ben Reaves
73f2b44c73 - Added AppIndicator3 system tray app for Linux 2020-08-02 02:12:07 -05:00
Ben Reaves
dafaaeb2a4 - Added additional icons for system tray 2020-08-01 18:34:46 -05:00
Ben Reaves
791ab4e94a - Updated Budgie Applet to stopping xkeysnail universally 2020-08-01 03:30:40 -05:00
Ben Reaves
333c8b387b - Added config, keyboard, and region buttons to budgie applet 2020-08-01 01:01:04 -05:00
Ben Reaves
6da72654ba - Budgie Applet Completed 2020-07-31 23:30:19 -05:00
Ben Reaves
57d56261ed - WIP Updated installer to setup budgie system tray 2020-07-31 21:22:50 -05:00
Ben Reaves
83aaca7f6b - Added kinto solid black svg icon 2020-07-31 13:35:17 -05:00
Ben Reaves
394454aee2 - Added Linux system tray files WIP 2020-07-31 13:30:29 -05:00
Ben Reaves
b1d4aad618 - Added autostart flag for linux system tray apps 2020-07-30 15:42:47 -05:00
Ben Reaves
77e0a7fe19 Merge branch 'master' into alpha 2020-07-30 02:55:24 -05:00
Ben Reaves
52990b5bbe Merge branch 'dev' into alpha 2020-07-30 02:54:46 -05:00
Ben Reaves
7e69d6c03f Merge pull request #251 from rbreaves/dev
- Added missing intellij grouping for Windows 10
2020-07-30 02:54:20 -05:00
Ben Reaves
6f83fafc66 Merge branch 'master' into dev 2020-07-30 02:53:21 -05:00
Ben Reaves
eab147bd88 - Added missing intellij grouping for Windows 10 2020-07-30 02:52:54 -05:00
Ben Reaves
0c5a9775ec - Prepping for Ubuntu Budgie system tray 2020-07-30 02:41:37 -05:00
Ben Reaves
0df6d85571 Merge branch 'master' into alpha 2020-07-30 02:28:23 -05:00
Ben Reaves
03d5df306c Merge branch 'dev' into alpha 2020-07-30 02:28:16 -05:00
Ben Reaves
c4dcd3febc Update README.md 2020-07-24 01:43:30 -05:00
Ben Reaves
7c289b7d0c Update README.md 2020-07-24 01:22:21 -05:00
Ben Reaves
48ef1c596a Merge pull request #246 from rbreaves/dev
- Corrected Minimize all but current window
2020-07-22 23:09:44 -05:00
Ben Reaves
8c677e8ef0 - Corrected Minimize all but current window 2020-07-22 23:08:23 -05:00
Ben Reaves
bd8ea9c4e1 Merge pull request #245 from rbreaves/dev
- IntelliJ corrections, Minimize & Hide Additions for Windows 10
2020-07-22 22:48:16 -05:00
Ben Reaves
9df95e8b8d - Added 3 variations of hide combos for Windows 10 2020-07-22 22:46:42 -05:00
Ben Reaves
e654929d1e - Added show desktop, minimize windows and fixed syntax issues (Windows only) 2020-07-22 20:03:25 -05:00
Ben Reaves
f1b37a8cbd Merge pull request #244 from rbreaves/dev
- Adds budgie message and windows terminal hotkeys
2020-07-21 17:59:42 -05:00
Ben Reaves
f922caff78 - Added Beginning and End of line for terminals on Windows 10 more generically 2020-07-21 17:42:42 -05:00
Ben Reaves
68173fb5b6 Merge branch 'master' into dev 2020-07-21 17:39:59 -05:00
Ben Reaves
53f320e0b9 Update README.md 2020-07-16 13:03:54 -05:00
Ben Reaves
dfec4f7eb1 Update README.md 2020-07-16 11:19:29 -05:00
Ben Reaves
e8d9ae9e8e - Updated xkeysnail service to properly kill any xkeysnail instances running 2020-07-14 00:52:00 -05:00
Ben Reaves
d727489d4a - WIP adding proper closing of xkeysnail on logoff 2020-07-13 13:26:02 -05:00
Ben Reaves
619a395b65 - merged dev into alpha 2020-07-13 13:11:46 -05:00
Ben Reaves
1fb5bf2a4b - Added budgie message for user to reset cmd-tab 2020-07-12 21:10:10 -05:00
Ben Reaves
656e2fafc9 Merge pull request #241 from rbreaves/dev
- Added proper shortcut re-apply fix for mate and budgie
2020-07-12 00:47:12 -05:00
Ben Reaves
3af5eb286d - Added proper shortcut re-apply fix for mate and budgie 2020-07-12 00:45:24 -05:00
Ben Reaves
3945d5c29e Merge pull request #240 from rbreaves/dev
- Corrected kinto.py syntax and url for budgie-daemon
2020-07-12 00:19:40 -05:00
Ben Reaves
afefc5b0f1 - Corrected kinto.py syntax and url for budgie-daemon 2020-07-12 00:12:43 -05:00
Ben Reaves
b66f2c591a Merge pull request #239 from rbreaves/dev
- Added IntelliJ remaps, minor eOS fix, alias busting on which, fixed uninstaller, improved budgie support
2020-07-11 17:36:56 -05:00
Ben Reaves
e12c51f98f - Added IntelliJ remaps to Linux 2020-07-11 17:32:24 -05:00
Ben Reaves
8690436629 - Updated which to avoid alias overrides, Ubuntu Budgie Tab Switching support improvements, Uninstaller updated. 2020-07-11 15:46:50 -05:00
Ben Reaves
0eadd9b3a4 - Skip xkb modifications if install type is xkeysnail. Closes #238 2020-07-08 18:17:22 -05:00
Ben Reaves
1d6d367c39 - Added sigint Ctrl-C for VS Code & IntelliJ keymaps for Windows 2020-07-08 17:44:48 -05:00
Ben Reaves
1e46a4dc74 Merge pull request #237 from RedBearAK/patch-1
Update xkeysnail_service.sh

Looks good, thanks!
2020-07-08 11:39:16 -05:00
RedBearAK
7aeb3dc44c Update xkeysnail_service.sh
Add command to create ~/.config/autostart in case it doesn’t exist.
2020-07-07 23:27:00 -08:00
Ben Reaves
6968e08f2f Update README.md 2020-07-07 19:49:36 -05:00
Ben Reaves
40ea2b6175 Update README.md 2020-07-07 17:37:12 -05:00
Ben Reaves
367d55b04b Merge pull request #235 from rbreaves/dev
- Fixed alt/cmd swap append issue & added proper close all for browsers
2020-07-07 17:02:49 -05:00
Ben Reaves
2864ae409a - Added proper quit hotkey for browsers, except edge (windows). Closes
#232
2020-07-07 16:54:43 -05:00
Ben Reaves
e477848b59 - Removes appending argument from alt/cmd swap on official apple keyboards. Closes #233 2020-07-07 16:15:32 -05:00
Ben Reaves
26dacc7984 Merge pull request #234 from thebitstick/patch-1
Electron Apps have their own names unfortunately
2020-07-06 23:53:23 -05:00
TheBitStick
a3d8ac782a Electron Apps have their own names unfortunately
#232
2020-07-06 23:23:30 -05:00
Ben Reaves
acd0b8031e - Added proper quit hotkey for browsers (linux) 2020-07-06 20:20:16 -05:00
Ben Reaves
9543eba753 Merge pull request #231 from rbreaves/dev
- Multi-language on Right Alt key was incompleted. Closes #192
2020-07-04 17:54:16 -05:00
Ben Reaves
738aee9465 - Multi-language on Right Alt key was incompleted. Closes #192 2020-07-04 17:52:48 -05:00
Ben Reaves
dc826b8454 Merge pull request #230 from rbreaves/dev
- Added copy/paste/sigint for mintty (Windows)
2020-07-03 23:16:41 -05:00
Ben Reaves
8bd6ed242f - Added copy/paste/sigint for mintty (Windows) 2020-07-03 23:15:51 -05:00
Ben Reaves
d96e238550 Merge pull request #226 from rbreaves/dev
- Fuller description of the install type options
2020-07-01 16:04:51 -05:00
Ben Reaves
e1948dcb08 - Fuller description of the install type options 2020-07-01 16:03:34 -05:00
Ben Reaves
7e0680ff75 Update README.md 2020-06-28 12:28:37 -05:00
Ben Reaves
45d413a1ba - Added intellij keymaps to autohotkey 2020-06-22 22:22:17 -05:00
Ben Reaves
a46bb911c9 Update README.md 2020-06-21 19:42:50 -05:00
Ben Reaves
f4cad2a1e3 Update README.md 2020-06-21 19:37:24 -05:00
Ben Reaves
ba10ff6ced Update README.md 2020-06-20 02:21:52 -05:00
60 changed files with 4732 additions and 1574 deletions

BIN
Kinto.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

279
README.md
View File

@@ -1,6 +1,6 @@
# Kinto
# Kinto.sh
![kinto-color-132](https://user-images.githubusercontent.com/10969616/84361571-7d5bd780-ab91-11ea-81bc-4d3a2ca51c4e.png)
![kinto-color-132](https://user-images.githubusercontent.com/10969616/94909977-9d2d4900-0469-11eb-8710-986289fe7240.gif)
[![GitHub release](https://img.shields.io/github/release/rbreaves/kinto.svg)](https://github.com/rbreaves/kinto/releases/latest)
@@ -9,23 +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 (Xkeysnail)](#Shortcut-Creation-Xkeysnail)
[What does Kinto require?](#What-does-Kinto-require)
[Shortcut Creation (Autohotkey)](#Shortcut-Creation-Autohotkey)
[Other Notes Related to Install](#Other-Notes-Related-to-Install)
[Shortcut Creation](#Shortcut-Creation)
[How to Upgrade/Control Kinto](#How-to-Upgrade-Kinto)
@@ -61,9 +59,11 @@ 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 thousand papercuts from trying to support every shortcut key under the sun.
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.
It also retains some of the most commonly used system level shortcut keys, such as Cmd-C/V, Cmd-Tab, and Ctrl-Tab among others. You will keep seamless copy & paste between all apps, ability to switch Windows while still using the physical Cmd/Alt key position; switch tabs in your favorite terminals, code editors, or web browsers. Depending on your OS and/or Desktop Environment you may also be able to switch Virtual Desktop environments the same way as well and other basic system level shortcuts.
@@ -71,48 +71,14 @@ 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)
*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 navigate to your "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.
Does not have complete parity with the Linux edition, but it is getting very close now. Only lacks some Sublime Text 3 remaps at this point.
Users can now hotswap between Apple and Windows based keyboards without having to logoff and back on, and Windows is currently the only implementation with a system tray (but this feature is coming to Budgie, XFCE, Mate, Gnome, and lastly KDE).
<img src="https://user-images.githubusercontent.com/10969616/84471498-100c7d00-ac4b-11ea-972d-60c1907831ec.png" width="50%">
<img src="https://user-images.githubusercontent.com/10969616/84471501-10a51380-ac4b-11ea-9e0e-c19a7ebfad6d.png" width="50%">
## How to install (Linux)
<img src="https://user-images.githubusercontent.com/10969616/97070698-179c4500-15a0-11eb-8064-c03aa7f4d4a5.png" width="75%">
1. clone this repo
```
git clone https://github.com/rbreaves/kinto.git
cd kinto
```
2. Install python3 (If needed)
@@ -122,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)
@@ -161,7 +129,43 @@ To Uninstall Kinto - Select Uninstall
py setup.py
```
## Shortcut Creation (Xkeysnail)
## 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.
[Linux Shortcut Creation (Xkeysnail)](#Linux-Xkeysnail)
[Windows Shortcut Creation (Autohotkey)](#Windows-Autohotkey)
## Linux (Xkeysnail)
**GUI Keys**
| Value| Description|Mac/Kinto Equivalent|
@@ -199,7 +203,7 @@ sudo systemctl restart xkeysnail
More information can be seen on the readme page of [xkeysnail](https://github.com/mooz/xkeysnail).
## Shortcut Creation (Autohotkey)
## Windows (Autohotkey)
This applies to the Windows version of Kinto and how to add additional support for Applications. The configuration file location is `~/.kinto/kinto.ahk` and after updating it you will want to right click on the tray icon and click on setting your keyboard type again and it will re-apply the latest changes.
@@ -237,38 +241,16 @@ With this being Autohotkey you can easily pull knowledge from the Autohotkey for
#If
```
I don't have too many examples on this one have only ran into a single UWP app, and most developers seem to be shying away from it. Kinto currently support "Fluent Terminal" which is a UWP app, but it is also being grouped together with other Terminal apps for hotkey remapping. You may take a look at that, but you may also create a new Autohotkey file and use the Window Spy feature built into Autohotkey to help you discover the full name and class names of any application.
I don't have too many examples on this one, most developers seem to be shying away from UWP. Kinto currently supports "Fluent Terminal" which is a UWP app, but it is also being grouped with other Terminal apps for hotkey remapping. You may take a look at that, but you may also want to try creating a new Autohotkey file and use the Window Spy feature built into Autohotkey to help you discover the full name and class names of any application.
## 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.
Simply bring down the latest 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
@@ -277,91 +259,67 @@ 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?
Are you using a VM on macOS? If so you may need to disable automatic remapping of the Cmd key when using Vmware Fusion of Parallels.
Disable Parallels Re-mapping:
1) Open Parallels and go to Preferences.
2) Click Keyboard and disable the Virtual machine shortcuts.
3) Close Preferences.
To disable keyboard mapping:
1) From Fusion's menu bar, click VMware Fusion > Preferences...
2) Click Keyboard & Mouse.
3) Click the Key Mappings tab.
4) Deselect Enable Key Mapping.
### Does not start when you log in or after you reboot?
Kinto (xkb/x11) = keyswap
Kinto (udev/xkeysnail/x11) = xkeysnail
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
```
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.
Another possibility is the SELinux could be enabled and needs to be set to permissive. (aka /etc/selinux/config)
To reset the display variable
```
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
```
@@ -375,73 +333,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.

View File

@@ -1,344 +0,0 @@
#!/usr/bin/env python3
# pip3 install pynput
# pip3 install --no-deps pynput
# from pynput.keyboard import Key, Listener
import sys, subprocess, time, os
from subprocess import PIPE, Popen
delay=3
def cmdline(command):
process = Popen(
args=command,
stdout=PIPE,
universal_newlines=True,
shell=True
)
return process.communicate()[0]
class color:
PURPLE = '\033[95m'
CYAN = '\033[96m'
DARKCYAN = '\033[36m'
BLUE = '\033[94m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
END = '\033[0m'
def countdown(secs):
for i in range(0,secs):
print(secs-i, end="\r", flush=True)
time.sleep(1)
def on_press(key):
print('{0} pressed'.format(key))
def on_release(key):
# print('{0} release'.format(key))
if key == Key.esc:
# Stop listener
return False
def yn_choice(message, default='y'):
choices = 'Y/n' if default.lower() in ('y', 'yes') else 'y/N'
choice = input("%s (%s) " % (message, choices))
values = ('y', 'yes', '') if choices == 'Y/n' else ('y', 'yes')
return choice.strip().lower() in values
modifier_keys = {
"primary":"",
"secondary":"",
"rprimary":"",
"rsecondary":"",
"capslock":"",
"capswap":""
}
def set_key(key):
global modifier_keys
print("\nWhich key would you like to set?\n")
while True:
try:
keytype = int(input(
"1) Ctrl\n" +
"2) Alt\n" +
"3) Super/Win/Cmd/Chrome search key\n"))
if keytype < 4 and keytype > 0:
break
except:
print("That's not a valid option!")
print("")
if keytype == 1:
modifier_keys[key] = "Ctrl"
elif keytype == 2:
modifier_keys[key] = "Alt"
elif keytype == 3:
modifier_keys[key] = "Cmd"
def set_cap():
global modifier_keys
print("\nWhich key would you like to swap?\n")
while True:
try:
keytype = int(input(
"1) Ctrl (swap)\n" +
"2) Ctrl (duplicate)\n" +
"3) Esc (swap)\n"))
if keytype < 4 and keytype > 0:
break
except:
print("That's not a valid option!")
print("")
if keytype == 1:
modifier_keys["capslock"] = "Ctrl-swap"
elif keytype == 2:
modifier_keys["capslock"] = "Ctrl-dup"
elif keytype == 3:
modifier_keys["capswap"] = "Escape"
def is_primary(key):
global modifier_keys
if not (str(key).replace("Key.", "").title() == "Enter" or str(key).replace("Key.", "").title() == "Escape"):
print(str(key).replace("Key.", "").title() + " will be remapped to Ctrl, the Cmd ⌘ key position.")
# countdown(3)
modifier_keys["primary"] = str(key).replace("Key.", "").title()
elif str(key).replace("Key.", "").title() == "Escape":
modifier_keys["primary"] = "Escape"
# countdown(3)
else:
return True
return False
def is_secondary(key):
global modifier_keys
if not (str(key).replace("Key.", "").title() == "Enter" or str(key).replace("Key.", "").title() == "Escape"):
print(str(key).replace("Key.", "").title() + " will be remapped to Alt, the Option ⌥ key position.")
# countdown(3)
modifier_keys["secondary"] = str(key).replace("Key.", "").title()
return False
elif str(key).replace("Key.", "").title() == "Escape":
modifier_keys["secondary"] = "Escape"
# countdown(3)
return False
else:
return True
def is_rprimary(key):
global modifier_keys
if not (str(key).replace("Key.", "").title() == "Enter" or str(key).replace("Key.", "").title() == "Escape"):
print(str(key).replace("Key.", "").title() + " will be remapped to Ctrl, the Cmd ⌘ key position.")
# countdown(3)
modifier_keys["rprimary"] = str(key).replace("Key.", "").title()
return False
elif str(key).replace("Key.", "").title() == "Escape":
modifier_keys["rprimary"] = "Escape"
# countdown(3)
return False
else:
return True
def is_rsecondary(key):
global modifier_keys
if not (str(key).replace("Key.", "").title() == "Enter" or str(key).replace("Key.", "").title() == "Escape"):
print(str(key).replace("Key.", "").title() + " will be remapped to Alt, the Option ⌥ key position.")
# countdown(3)
modifier_keys["rsecondary"] = str(key).replace("Key.", "").title()
return False
elif str(key).replace("Key.", "").title() == "Escape":
modifier_keys["rsecondary"] = "Escape"
# countdown(3)
return False
else:
return True
print(color.UNDERLINE + color.YELLOW + "\n\nPlease ignore the FN key." + color.END + " FN cannot be remapped by software, some Thinkpads can swap it with Ctrl in the BIOS.\n")
input("Press Enter to continue...\n\n")
print(chr(27) + "[2J")
counter = 0
while True:
print(color.UNDERLINE + color.YELLOW + "\n\nPress the 1st key Left of the spacebar" + color.END + " (Press Esc to set manaully)\n")
print(" 👇")
print(" □ □ ▣ ░░░░░░░\n")
# listener = Listener(on_release=is_primary,suppress=True)
# listener.start()
# with Listener(
# on_release=is_primary,suppress=True) as listener:
# try:
# listener.join()
# except MyException as e:
# print('{0} was pressed'.format(e.args[0]))
modifier_keys["primary"] = cmdline("xbindkeys -k | awk 'END {print $NF}'").strip()
print(modifier_keys["primary"] + " will be remapped to Ctrl, the Cmd ⌘ key position.")
if modifier_keys["primary"] != "Escape":
choice = yn_choice("Is this correct?")
if(choice):
# print("Left Physical " + modifier_keys["primary"] + " = Ctrl/Cmd ⌘")
# listener.stop()
# input("Press Enter to continue...\n\n")
break
else:
set_key("primary")
print("Left Physical " + modifier_keys["primary"] + " = Ctrl/Cmd ⌘\n")
# listener.stop()
input("Press Enter to continue...\n\n")
break
counter += 1
print(str(counter)+"\n")
time.sleep(1)
print(chr(27) + "[2J")
while True:
print(color.UNDERLINE + color.YELLOW + "\n\nPress the 2nd key Left of the spacebar" + color.END + " (Press Esc to set manaully)\n")
print(" 👇")
print(" □ ▣ □ ░░░░░░░\n")
# with Listener(
# on_release=is_secondary,suppress=True) as listener:
# try:
# listener.join()
# except MyException as e:
# print('{0} was pressed'.format(e.args[0]))
modifier_keys["secondary"] = cmdline("xbindkeys -k | awk 'END {print $NF}'").strip()
print(modifier_keys["secondary"] + " will be remapped to Alt, the Option ⌥ key position.")
if modifier_keys["secondary"] != "Escape":
choice = yn_choice("Is this correct?")
if(choice):
# listener.stop()
# print("Left Physical " + modifier_keys["secondary"] + " = Alt/Option ⌥")
# input("Press Enter to continue...\n\n")
break
else:
set_key("secondary")
print("Left Physical " + modifier_keys["secondary"] + " = Alt/Option ⌥\n")
# listener.stop()
input("Press Enter to continue...\n\n")
break
print(chr(27) + "[2J")
while True:
print(color.UNDERLINE + color.YELLOW + "\n\nPress the 1st key Right of the spacebar" + color.END + " (Press Esc to set manaully)\n")
print(" 👇")
print(" ░░░░░░░ ▣ □")
# with Listener(
# on_release=is_rprimary,suppress=True) as listener:
# try:
# listener.join()
# except MyException as e:
# print('{0} was pressed'.format(e.args[0]))
modifier_keys["rprimary"] = cmdline("xbindkeys -k | awk 'END {print $NF}'").strip()
print(modifier_keys["rprimary"] + " will be remapped to Ctrl, the Cmd ⌘ key position.")
if modifier_keys["rprimary"] != "Escape":
choice = yn_choice("Is this correct?")
if(choice):
# listener.stop()
# print("Right Physical " + modifier_keys["rprimary"] + " = Ctrl/Cmd ⌘")
# input("Press Enter to continue...\n\n")
break
else:
set_key("rprimary")
print("Right Physical " + modifier_keys["rprimary"] + " = Ctrl/Cmd ⌘\n")
# listener.stop()
input("Press Enter to continue...\n\n")
break
print(chr(27) + "[2J")
while True:
print(color.UNDERLINE + color.YELLOW + "\n\nPress the 2nd key Right of the spacebar" + color.END + " (Press Esc to set manaully)\n")
print(" 👇")
print(" ░░░░░░░ □ ▣")
# with Listener(
# on_release=is_rsecondary,suppress=True) as listener:
# try:
# listener.join()
# except MyException as e:
# print('{0} was pressed'.format(e.args[0]))
modifier_keys["rsecondary"] = cmdline("xbindkeys -k | awk 'END {print $NF}'").strip()
print(modifier_keys["rsecondary"] + " will be remapped to Alt, the Option ⌥ key position.")
if modifier_keys["rsecondary"] != "Escape":
choice = yn_choice("Is this correct?")
if(choice):
# listener.stop()
# print("Right Physical " + modifier_keys["rsecondary"] + " = Alt/Option ⌥")
# modifier_keys["rsecondary"] = str(os.system("xbindkeys -k | awk 'END {print $NF}'"))
break
else:
set_key("rsecondary")
print("Right Physical " + modifier_keys["rsecondary"] + " = Alt/Option ⌥\n")
# listener.stop()
input("Press Enter to continue...\n\n")
break
print(chr(27) + "[2J")
if not (modifier_keys["secondary"] == "Ctrl" or modifier_keys["secondary"] == "Control_R"):
print(color.UNDERLINE + color.YELLOW + "GUI Usage (Physical Ctrl key)\n"+ color.END)
print("Ctrl key will be mapped to Super. (Search key on chromebooks)")
print("👇")
print(" ▣ □ □ ░░░░░░░\n")
print("Note: Super may still activate Ctrl based shortcuts\n")
print("at times depending on application or system level shortcuts.\n")
print("This will only be done to align shortcuts to their expected functionality.\n")
input("Press Enter to continue...\n\n")
# print(chr(27) + "[2J")
print(color.UNDERLINE + color.YELLOW + "Terminal Usage" + color.END + "\n")
print("Ctrl key will be the Ctrl key.")
print("👇")
print(" ▣ □ □ ░░░░░░░\n")
print("The Cmd ⌘ key position during terminal usage will usually be Ctrl+Shift.")
print(" 👇 ")
print(" □ □ ▣ ░░░░░░░\n")
input("Press Enter to continue...\n")
else:
print("Chromebook detected.")
print(color.UNDERLINE + color.YELLOW + "GUI Usage\n"+ color.END)
print("Search key (capslock position) on chromebooks will be Super\n")
print("Note: Super may still activate Ctrl based shortcuts")
print("at times depending on application or system level shortcuts.\n")
print("Efforts have been made though to use the physical Ctrl key")
print("when it makes sense to do so, and more often than standard")
print("keyboards. How it feels to type is more important than technical")
print("accuracy.\n")
print("If you believe an improvement can be made or an error was made")
print("please let me know on github or you can fork this project.\n")
input("Press Enter to continue...\n\n")
print(color.UNDERLINE + color.YELLOW + "Terminal Usage" + color.END + "\n")
print(" □ capslock/search key = Alt")
print(" shift")
print(" ▣ □ ░░░░░░░")
print("☝️\n")
input("Press Enter to continue...\n\n")
print(chr(27) + "[2J")
choice = yn_choice(color.UNDERLINE + color.YELLOW + "Do you want to swap Capslock with another key?" + color.END + "\n","n")
if(choice):
set_cap()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

0
keyswap_service.sh → kinto_old/keyswap_service.sh Executable file → Normal file
View File

View File

631
kinto_old/setup.py Normal file
View File

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

View File

View File

508
kinto_old/xkeysnail_service.sh Executable file
View File

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

567
setup.py
View File

@@ -1,32 +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:
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")
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...")
@@ -35,27 +47,41 @@ def windows_setup():
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')
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')
os.system('copy /Y ' + path + '\\windows\\kinto-start.vbs "%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('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('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")
os.system("%userprofile%\\AppData\\Roaming\\Microsoft\\Windows\\STARTM~1\\Programs\\Startup\\kinto-start.vbs")
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:
@@ -91,511 +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']\"")
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":
# 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')
# 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")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

View File

@@ -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 -a /sys/module/hid_apple/parameters/swap_opt_cmd
echo 'options hid_apple swap_opt_cmd=0' | sudo tee -a /etc/modprobe.d/hid_apple.conf
sudo update-initramfs -u -k all
fi
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

View File

@@ -11,13 +11,12 @@ WinHide % "ahk_id " DllCall("GetConsoleWindow", "ptr")
notify_change(wParam, lParam, msg, hwnd)
{
global lastkb
; kbtype = % ComObjCreate("WScript.Shell").Exec("cscript /nologo usb.vbs").StdOut.ReadAll()
DetectHiddenWindows On
Run %ComSpec%,, Hide, pid
WinWait ahk_pid %pid%
DllCall("AttachConsole", "UInt", pid)
WshShell := ComObjCreate("Wscript.Shell")
exec := WshShell.Exec("cscript /nologo usb.vbs")
exec := WshShell.Exec("cscript /nologo ""%userprofile%\.kinto\usb.vbs""")
kbtype := exec.StdOut.ReadAll()
DllCall("FreeConsole")
Process Close, %pid%
@@ -27,11 +26,11 @@ notify_change(wParam, lParam, msg, hwnd)
if InStr(kbtype, "Apple")
{
; MsgBox, Apple
Run, %A_ScriptDir%\NoShell.vbs %A_ScriptDir%\toggle_kb.bat mac, %A_ScriptDir%
Run, "%A_ScriptDir%\NoShell.vbs" "%A_ScriptDir%\toggle_kb.bat" mac, "%A_ScriptDir%"
}
else{
; MsgBox, Windows
Run, %A_ScriptDir%\NoShell.vbs %A_ScriptDir%\toggle_kb.bat win, %A_ScriptDir%
Run, "%A_ScriptDir%\NoShell.vbs" "%A_ScriptDir%\toggle_kb.bat" win, "%A_ScriptDir%"
}
; MsgBox % kbtype
}

View File

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

View File

@@ -2,36 +2,91 @@
#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
OnMessage(0x404, "AHK_NOTIFYICON")
AHK_NOTIFYICON(wParam, lParam)
{
if (lParam = 0x202) { ; user left-clicked tray icon
;ADD ANY SUBROUTINE OR FUNCTION HERE
Menu, Tray, Show
return
}
else if (lParam = 0x203) { ; user double left-clicked tray icon
;ADD ANY SUBROUTINE OR FUNCTION HERE
Menu, Tray, Show
return
}
}
; End Enable Left clicks
; I_Icon = %A_ScriptDir%\assets\kinto-white.ico ; MacModifiers
; IfExist, %I_Icon% ; MacModifiers
; 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
winkb(){
Run, %A_ScriptDir%\NoShell.vbs %A_ScriptDir%\toggle_kb.bat win, %A_ScriptDir%
Run, "%A_ScriptDir%\NoShell.vbs" "%A_ScriptDir%\toggle_kb.bat" win, "%A_ScriptDir%"
}
mackb(){
Run, %A_ScriptDir%\NoShell.vbs %A_ScriptDir%\toggle_kb.bat mac, %A_ScriptDir%
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(){
@@ -52,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
}
@@ -75,6 +130,7 @@ GroupAdd, terminals, ahk_exe ConEmu64.exe
GroupAdd, terminals, ahk_exe powershell.exe
GroupAdd, terminals, ahk_exe WindowsTerminal.exe
GroupAdd, terminals, ahk_exe Hyper.exe
GroupAdd, terminals, ahk_exe mintty.exe
GroupAdd, terminals, ahk_exe Cmd.exe
GroupAdd, terminals, ahk_exe Terminus.exe
GroupAdd, terminals, Fluent Terminal ahk_class ApplicationFrameWindow
@@ -91,269 +147,470 @@ 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
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
GroupAdd, vscode, ahk_exe VSCodium.exe
GroupAdd, vscode, ahk_exe Code.exe
GroupAdd, vstudio, ahk_exe devenv.exe
; New AltTab and CtrlTab fix
*tab::
{
; Tertiary
if (GetKeyState("LCtrl", "P") AND GetKeyState("LShift", "P") = false) {
GroupAdd, intellij, ahk_exe idea.exe
GroupAdd, intellij, ahk_exe idea64.exe
; 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}
; 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}
; Sublime Text Remaps for VS Code
#IfWinActive ahk_group vscode
; 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
#If
#IfWinActive ahk_exe sublime_text.exe
#^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
; 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_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
; End of Line
^e::
SetKeyDelay -1
Send {Blind}{e DownTemp}
return
^e up::
SetKeyDelay -1
Send {Blind}{e Up}
return
; Beginning of Line
^a::
SetKeyDelay -1
Send {Blind}{a DownTemp}
return
^a up::
SetKeyDelay -1
Send {Blind}{a Up}
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

View File

@@ -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

View File

@@ -1,5 +1,5 @@
Option Explicit
Dim oWMISrv, collDvcs, iUSBDvc , iDvc, sDvcID, sPID, sVID
Dim oWMISrv, collDvcs, iUSBDvc , iDvc, sDvcID, sPID, sVID, deviceID
' add item to array
Function AddItem(arr, val)
@@ -49,21 +49,23 @@ Dim nonApple: nonApple = 0
Dim i
If vcount = 1 Then
deviceID = deviceVID(0)
If StrComp(deviceVID(0), "05AC") = 0 Then
Wscript.Echo "Apple"
Wscript.Echo "Apple " & deviceID
Else
Wscript.Echo "Windows"
Wscript.Echo "Windows " & deviceID
End If
Else
For i = 0 To counter-1
deviceID = deviceVID(i)
If StrComp(deviceVID(i), "05AC") = -1 Then
nonApple = 1
End If
Next
If nonApple = 1 Then
Wscript.Echo "Windows"
Wscript.Echo "Windows " & deviceID
Else
Wscript.Echo "Apple"
Wscript.Echo "Apple " & deviceID
End If
End If

View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

1362
xkeysnail-config/gui/kinto-gui.py Executable file

File diff suppressed because it is too large Load Diff

View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

40
xkeysnail-config/initkb Normal file
View 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
View 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

View File

@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
# autostart = true
import re
from xkeysnail.transform import *
@@ -6,39 +7,74 @@ 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)
# Use for browser specific hotkeys
browsers = ["Chromium","Chromium-browser","Google-chrome","Epiphany","Firefox","Discord"]
browsers = [browser.casefold() for browser in browsers]
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
# Key.RIGHT_CTRL: Key.RIGHT_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
# Key.RIGHT_ALT: Key.RIGHT_CTRL, # WinMac
# Key.RIGHT_META: Key.RIGHT_ALT, # WinMac
# Key.RIGHT_CTRL: Key.RIGHT_META, # WinMac
# Key.RIGHT_ALT: Key.RIGHT_CTRL, # WinMac - Multi-language (Remove)
# 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
# Key.RIGHT_CTRL: Key.RIGHT_META, # Mac
# Key.RIGHT_META: Key.RIGHT_CTRL, # Mac - Multi-language (Remove)
# Key.RIGHT_CTRL: Key.RIGHT_META, # Mac - Multi-language (Remove)
})
# [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
@@ -46,19 +82,110 @@ 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
# Key.RIGHT_ALT: Key.RIGHT_CTRL, # WinMac - Multi-language (Remove)
# Key.RIGHT_META: Key.RIGHT_ALT, # WinMac
# Key.RIGHT_CTRL: Key.LEFT_CTRL, # WinMac
# 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
# Key.RIGHT_CTRL: Key.LEFT_CTRL, # Mac
# Key.RIGHT_META: Key.RIGHT_CTRL, # Mac - Multi-language (Remove)
# Key.RIGHT_CTRL: Key.LEFT_CTRL, # Mac - Multi-language (Remove)
})
# Keybindings for IntelliJ
define_keymap(re.compile("jetbrains-idea", re.IGNORECASE),{
# General
K("C-Key_0"): K("M-Key_0"), # Open corresponding tool window
K("C-Key_1"): K("M-Key_1"), # Open corresponding tool window
K("C-Key_2"): K("M-Key_2"), # Open corresponding tool window
K("C-Key_3"): K("M-Key_3"), # Open corresponding tool window
K("C-Key_4"): K("M-Key_4"), # Open corresponding tool window
K("C-Key_5"): K("M-Key_5"), # Open corresponding tool window
K("C-Key_6"): K("M-Key_6"), # Open corresponding tool window
K("C-Key_7"): K("M-Key_7"), # Open corresponding tool window
K("C-Key_8"): K("M-Key_8"), # Open corresponding tool window
K("C-Key_9"): K("M-Key_9"), # Open corresponding tool window
K("Super-Grave"): K("C-Grave"), # Quick switch current scheme
K("C-Comma"): K("C-M-s"), # Open Settings dialog
K("C-Semicolon"): K("C-M-Shift-s"), # Open Project Structure dialog
# Debugging
K("C-M-r"): K("F9"), # Resume program
# Search/Replace
K("C-g"): K("F3"), # Find next
K("C-Shift-F3"): K("Shift-F3"), # Find previous
K("Super-g"): K("M-j"), # Select next occurrence
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("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
K("Super-i"): K("C-i"), # Implement methods
K("M-Up"): K("C-w"), # Extend selection
K("M-Down"): K("C-Shift-w"), # Shrink selection
K("Super-Shift-q"): K("M-q"), # Context info
K("Super-M-o"): K("C-M-o"), # Optimize imports
K("Super-M-i"): K("C-M-i"), # Auto-indent line(s)
K("C-Backspace"): K("C-y"), # Delete line at caret
K("Super-Shift-j"): K("C-Shift-j"), # Smart line join
K("M-Delete"): K("C-Delete"), # Delete to word end
K("M-Backspace"): K("C-Backspace"), # Delete to word start
K("C-Shift-Equal"): K("C-KPPLUS"), # Expand code block
K("C-Minus"): K("C-KPMINUS"), # Collapse code block
K("C-Shift-Equal"): K("C-Shift-KPPLUS"), # Expand all
K("C-Shift-Minus"): K("C-Shift-KPMINUS"), # Collapse all
K("C-w"): K("C-F4"), # Close active editor tab
# Refactoring
K("C-Delete"): K("M-Delete"), # Safe Delete
K("C-T"): K("C-M-Shift-t"), # Refactor this
# Navigation
K("C-o"): K("C-n"), # Go to class
K("C-Shift-o"): K("C-Shift-n"), # Go to file
K("C-M-o"): K("C-M-Shift-n"), # Go to symbol
K("Super-Right"): K("M-Right"), # Go to next editor tab
K("Super-Left"): K("M-Left"), # Go to previous editor tab
K("Super-l"): K("C-g"), # Go to line
K("Super-e"): K("C-e"), # Recent files popup
K("M-Space"): K("C-Shift-i"), # Open quick definition lookup
K("C-Y"): K("C-Shift-i"), # Open quick definition lookup
K("Super-Shift-b"): K("C-Shift-b"), # Go to type declaration
K("Super-Up"): K("M-Up"), # Go to previous
K("Super-Down"): K("M-Down"), # Go to next method
K("Super-h"): K("C-h"), # Type hierarchy
K("Super-M-h"): K("C-M-h"), # Call hierarchy
K("C-Down"): K("C-Enter"), # Edit source/View source
K("M-Home"): K("M-Home"), # Show navigation bar
K("F2"): K("F11"), # Toggle bookmark
K("Super-F3"): K("C-F11"), # Toggle bookmark with mnemonic
K("Super-Key_0"): K("C-Key_0"), # Go to numbered bookmark
K("Super-Key_1"): K("C-Key_1"), # Go to numbered bookmark
K("Super-Key_2"): K("C-Key_2"), # Go to numbered bookmark
K("Super-Key_3"): K("C-Key_3"), # Go to numbered bookmark
K("Super-Key_4"): K("C-Key_4"), # Go to numbered bookmark
K("Super-Key_5"): K("C-Key_5"), # Go to numbered bookmark
K("Super-Key_6"): K("C-Key_6"), # Go to numbered bookmark
K("Super-Key_7"): K("C-Key_7"), # Go to numbered bookmark
K("Super-Key_8"): K("C-Key_8"), # Go to numbered bookmark
K("Super-Key_9"): K("C-Key_9"), # Go to numbered bookmark
K("C-F3"): K("Shift-F11"), # Show bookmarks
# Compile and Run
K("Super-M-r"): K("M-Shift-F10"), # Select configuration and run
K("Super-M-d"): K("M-Shift-F9"), # Select configuration and debug
K("Super-r"): K("Shift-F10"), # Run
K("Super-d"): K("Shift-F9"), # Debug
K("Super-Shift-r"): K("C-Shift-F10"), # Run context configuration from editor
K("Super-Shift-d"): K("C-Shift-F9"), # Debug context configuration from editor
# VCS/Local History
K("Super-v"): K("M-Grave"), # VCS quick popup
K("Super-c"): K("LC-c"), # Sigints - interrupt
})
# Keybindings for Nautilus
@@ -69,22 +196,47 @@ define_keymap(re.compile("org.gnome.nautilus", re.IGNORECASE),{
K("RC-Right"): K("M-Right"), # Go Forward
})
# Keybindings for Browsers
define_keymap(re.compile(browserStr, re.IGNORECASE),{
K("RC-Q"): K("RC-Q"), # Close all browsers Instances
})
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
@@ -103,11 +255,11 @@ 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(""), #
})
@@ -137,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
@@ -161,8 +314,9 @@ define_keymap(re.compile(codeStr, re.IGNORECASE),{
K("C-g"): K("f3"), # find_next
K("Shift-f3"): pass_through_key, # cancel find_prev
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
@@ -171,6 +325,7 @@ define_keymap(re.compile(codeStr, re.IGNORECASE),{
# Keybindings for Sublime Text
define_keymap(re.compile("Sublime_text", re.IGNORECASE),{
K("Super-Space"): K("C-Space"), # Basic code completion
K("C-Super-up"): K("M-o"), # Switch file
K("Super-RC-f"): K("f11"), # toggle_full_screen
K("C-M-v"): [K("C-k"), K("C-v")], # paste_from_history
@@ -203,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
@@ -251,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"),

View File

@@ -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

View 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

View 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="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

View 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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View 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

View 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

View 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

View 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()

View File

@@ -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

View File

@@ -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}

View File

@@ -4,31 +4,32 @@
# 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)
function uninstall {
echo -e "\nNote: Restoring keys is only relevant if you had installed a version prior to 1.2 of Kinto. You should skip this step if 1.2+ is all you have installed."
while true; do
read -rep $'\nPress R to restore your original shortcuts.\nPress F to reset to factory shortcuts. (f/r)\n' yn
read -rep $'\nPress R to restore your original shortcuts.\nPress F to reset to factory shortcuts.\nPress N to skip. (f/r/N)\n' yn
case $yn in
[Ff]* ) yn="f"; break;;
[Rr]* ) yn="r";break;;
* ) echo "Please answer yes or no.";;
[Nn]* ) yn="n";break;;
* ) yn="n";break;;
esac
done
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
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
@@ -41,7 +42,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,35 +61,43 @@ 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
elif [ "$yn" == "n" ]; then
echo "Skipping..."
fi
if [[ $dename == "gnome" || $dename == "budgie" ]]; then
echo -e "\nWill still be restoring the overlay key"
echo -e "gsettings set org.gnome.mutter overlay-key 'super'\n"
gsettings set org.gnome.mutter overlay-key 'super'
fi
}
function removeAppleKB {
# Undo Apple keyboard cmd & alt swap
if test -f "/sys/module/hid_apple/parameters/swap_opt_cmd" && [ `cat /sys/module/hid_apple/parameters/swap_opt_cmd` == "1" ]; then
echo '0' | sudo tee -a /sys/module/hid_apple/parameters/swap_opt_cmd
echo 'options hid_apple swap_opt_cmd=0' | sudo tee -a /etc/modprobe.d/hid_apple.conf
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 -a /sys/module/applespi/parameters/swap_opt_cmd
echo 'options applespi swap_opt_cmd=0' | sudo tee -a /etc/modprobe.d/applespi.conf
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 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 +113,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;;
@@ -115,7 +124,7 @@ function budgieUpdate {
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/raw/f112e0e349c021c1bbfa7e45c16083eae0d92fac/binaries/budgie-daemon_10.5.1 -O ./system-config/budgie-daemon_10.5.1
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 }')
@@ -149,161 +158,291 @@ function budgieUpdate {
fi
}
if [ $# -eq 0 ]; then
echo "Install Kinto - xkeysnail (udev)"
echo " 1) Windows & Mac (HID driver)"
echo " 2) Mac Only & VMs on Macbooks"
echo " 3) Chromebook"
# echo " 5) Uninstall"
read n
set "$n"
if [[ $1 == "5" || $1 == "uninstall" || $1 == "Uninstall" ]]; then
echo "Uninstalling Kinto - xkeysnail (udev)"
uninstall
echo "Removing any Apple driver settings Kinto may have have set..."
removeAppleKB
echo "Killing the Kinto tray..."
pkill -f kintotray >/dev/null 2>&1
echo "Stopping the Kinto service..."
sudo systemctl stop xkeysnail >/dev/null 2>&1
echo "Disabling the Kinto service..."
sudo systemctl disable xkeysnail >/dev/null 2>&1
echo "Killing any remaining xkeysnail processes..."
sudo pkill -f bin/xkeysnail >/dev/null 2>&1
echo "Killing any Kinto related threads from Kinto tray or the gui..."
sudo pkill -f "is-active xkeysnail" >/dev/null 2>&1
echo -e "\nRemoving Kinto..."
echo "rm /etc/sudoers.d/limitedadmins"
echo "rm ~/.config/autostart/xkeysnail.desktop"
echo "rm ~/.config/autostart/kintotray.desktop"
echo "rm -rf ~/.config/kinto"
echo "rm /usr/share/applications/kinto.desktop"
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 /usr/share/applications/kinto.desktop >/dev/null 2>&1
echo -e "\nRemoving Kinto's systemd service files..."
echo "rm /etc/systemd/system/xkeysnail.service"
echo "rm /etc/systemd/system/graphical.target.wants/xkeysnail.service"
echo "rm /usr/lib/systemd/system/xkeysnail.service"
echo "rm /lib/systemd/system/xkeysnail.service"
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
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
exit 0
fi
# multi-language
rightalt=false
# VS code remap
vssublime=false
# Add additional shortcuts if needed, does not modify existing ones
if [[ $1 == "1" || $1 == "2" || $1 == "3" || $1 == "winmac" || $1 == "mac" || $1 == "chromebook" ]]; then
while true; do
read -rep $'\nDo you want multi-language support (the right Alt key will not remap)? (y/N)\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
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.."
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 $'\nExperimental Support for Firefox/Chrome Back/Forward hotkeys (Cmd+Left/Right)?\n(Keys could get stuck, switch windows or press ctrl &/or super to release) (y/n)\n' yn
read -rep $'\nWould you like to update your SELinux state from enforcing to permissive? (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;;
[Yy]* ) setSE='yes'; break;;
[Nn]* ) exp='no'; expsh=" " break;;
# * ) echo "Please answer yes or no.";;
esac
done
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 -e "\nSupport for Firefox/Chrome Back/Forward hotkeys (Cmd+Left/Right) disabled on $branch w/ xkeysnail \n"
exp=" "
expsh=" "
echo "SELinux state should be ok for Kinto to install"
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
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
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
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 [[ $(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
if [[ $1 == "1" || $1 == "winmac" ]]; then
if ls /sys/module | grep hid_apple >/dev/null 2>&1 ; then
echo '1' | sudo tee -a /sys/module/hid_apple/parameters/swap_opt_cmd;echo 'options hid_apple swap_opt_cmd=1' | sudo tee -a /etc/modprobe.d/hid_apple.conf;sudo update-initramfs -u -k all
# 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
# 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" == 'linuxmint' ]; then
pydev="python3-dev"
elif [ "$distro" == "fedora" ]; then
pydev="python3-devel"
fi
if ls /sys/module | grep applespi >/dev/null 2>&1 ; then
echo '1' | sudo tee -a /sys/module/applespi/parameters/swap_opt_cmd;echo 'options applespi swap_opt_cmd=1' | sudo tee -a /etc/modprobe.d/applespi.conf;sudo update-initramfs -u -k all
if [ "$distro" == "gnome" ] || [ "$distro" == "fedora" ] || [ "$distro" == "debian" ] || [ "$distro" == 'linuxmint' ]; then
echo "Will need to install $pydev..."
sudo ./system-config/unipkg.sh "$pydev"
fi
if ! ls /sys/module | grep apple ; then
removeAppleKB
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
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
fi
if [ "$distro" == 'linuxmint' ]; then
pip3 install setuptools
fi
# echo "Transferring files..."
mkdir -p ~/.config/kinto
# KDE xhost fix
# mkdir -p ~/.kde/Autostart
# echo -e '#!/bin/sh\rxhost +SI:localuser:root' > ~/.kde/Autostart/kintohost.sh
# chmod +x ~/.kde/Autostart/kintohost.sh
# KDE startup - xhost fix
mkdir -p ~/.config/autostart
yes | cp -rf ./xkeysnail-config/xkeysnail.desktop ~/.config/kinto/xkeysnail.desktop
# yes | cp -rf ./xkeysnail-config/xkeystart.sh ~/.config/kinto/xkeystart.sh
# *** More testing needing, universal way of killing kinto on user log out? ***
# yes | sudo cp -rf xkeysnail-config/root_logoff.sh /usr/local/bin/logoff.sh
# sudo chown root:root /usr/local/bin/logoff.sh
# sudo chmod u+rwx /usr/local/bin/logoff.sh
# sudo chmod go-w+rx /usr/local/bin/logoff.sh
# *** End universal killing of kinto
# logoff fix - not solid for every os. Prevents missed 1 character input on login
# yes | sudo cp -rf xkeysnail-config/gnome_logoff.sh ~/.config/kinto/logoff.sh
echo "$(git describe --tag --abbrev=0 | head -n 1)" "build" "$(git rev-parse --short HEAD)" > ~/.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
@@ -315,8 +454,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
@@ -330,13 +470,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"
@@ -359,43 +507,5 @@ 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
sudo systemctl daemon-reload
sudo systemctl --state=not-found --all | grep xkeysnail
budgieUninstall
exit 0
elif [[ $1 == "5" || $1 == "budgieUpdate" ]]; then
budgieUpdate
else
echo "Expected argument was not provided"
fi