Compare commits

..

11 Commits

6 changed files with 74 additions and 35 deletions

View File

@@ -23,12 +23,12 @@ default partial xkb_symbols "mac_levelssym" {
symbols[Group1]= [ Down, Down, NoSymbol ],
actions[Group1]= [ NoAction(), NoAction(), RedirectKey(key=<END>)]
};
// CTRL BKSP to DELETE
// replace key <BKSP> {
// type[Group1]= "TWO_LEVEL_CTRL",
// symbols[Group1]= [ BackSpace, BackSpace, NoSymbol ],
// actions[Group1]= [ NoAction(), NoAction(), RedirectKey(key=<DELE>,clearmods=Control)]
// };
// Alt BKSP to DELETE
replace key <BKSP> {
type[Group1]= "ONE_LEVEL_CTRL",
symbols[Group1]= [ BackSpace, BackSpace, NoSymbol ],
actions[Group1]= [ NoAction(), RedirectKey(key=<DELE>,clearmods=Mod1), NoAction()]
};
};
partial xkb_symbols "mac_chrome" {
// Back Button

View File

@@ -32,20 +32,16 @@ Kinto works for standard Windows, Apple and Chromebook keyboards. The following
- Python (initial install only)
- systemd
- x11
- IBus
- IBus*
- Debian/Ubuntu based distro 16.04+
If you need kintox11 recompiled for your distro please let me know and I will add a binary for your distro if my binary fails.
You can also attempt to compile kintox11.c on your system as well, but you will need to compile and install json-c first as its libraries will be required to compile and run the program.
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. You may install ibus with the following.
*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.
```
ibus-setup
```
And then navigate to your "Language Support" and set "Keyboard input method system:" to IBus for full word-wise support with web browsers.
To 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.
@@ -185,7 +181,25 @@ systemctl --user status keyswap
journalctl -xe
```
Open a ticket and send me the info.
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.
```
echo $DISPLAY
# :0.0
```
nano ~/.config/systemd/user/keyswap.service
```
...
[Service]
Type=simple
Restart=always
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.
@@ -231,3 +245,22 @@ https://medium.com/@benreaves/kinto-a-mac-inspired-keyboard-mapping-for-linux-58
## License
GPL v2
## Credits and Contributions
I would just like to thank a few people here directly that have helped me tremendously with completing this project and without their support, direct, indirect or otherwise I would have had difficulty completing this undertaking. I will list these things off in chronological order mostly.
First off I'd like to thank the Stackoverflow and Stackexchange community. I have probably rubbed some mods the wrong way over there, but the people from the community in general are extremely helpful and gracious and without their contributions would have made this much more difficult. The person I'd like to thank most though from over there is Glen Whitney. Without his detailed explaining of how to rebind keys in xkb this would not have come together at all, as every other remapping solution were non-starters as complexity increases.
Secondarily I'd like to thank Christian Eriksson*, as he provided information that kept me up at night.. literally. Even after I implemented a similar bash script to one he had suggested I knew that fully implementing a c/c++ solution was where Kinto needed to head to and his explaination was better than I remember it being now that I have gone back to read it again. He also never provided a full implementation of a c/c++ solution - he did hit on the pain points pretty well of what one would need to do and watch out for. I am not sure where I got the first example code of implementing a based solution, but he definitely went over it well.
Kui and his gist file** was really the c based solution that I found had the fewest issues to resolve to making it a reliable solution. It didn't account for all failures very well, aka BadWindow issues, but it made for a great foundation on which Kintox11 is built. I cannot thank him enough for putting it out there for others to work with.
Lastly these four people were also very helpful to me as well. @probonopd for being one of the first people to install and use Kinto and gave me the initial feedback to include wordwise support! He also has really great articles*** posted on HackerNews & Medium about UI/UX design. Another person I'd like to thank is @owzim, his feedback allowed me to rapidly iterate and fix several bugs to support additional platforms better. The last two are members of the #ubuntu channel in IRC on freenode, tarzeau ( @alexmyczko ) and sarnold. Alex contributing a proper Makefile, so the project can be packaged properly, and sarnold help me find that IBus could resolve an issue I was having with needing to detect the caret status.
If I left anyone out then I apologize, that was not intentional. I am happy to say that this project is at a state of completion. Bug fixes will primarily be the only activity happening going forward and possibly a rewrite for Wayland at some point. Contributions as mentioned above are welcomed, and will be merged into master if they help with the goal of making typing on linux more like a mac.
*https://askubuntu.com/questions/1010276/can-i-act-on-the-event-that-a-window-opens-without-polling
**https://gist.github.com/kui/2622504
***https://medium.com/@probonopd/make-it-simple-linux-desktop-usability-part-1-5fa0fb369b42

View File

@@ -47,32 +47,19 @@ static int wait_fd(int fd, double seconds)
int XNextEventTimeout(Display *d, XEvent *e, double seconds, long long event_ts, int last_event, long long *event_ts_ptr, int *last_event_ptr)
{
if (XPending(d) || wait_fd(ConnectionNumber(d),seconds)) {
// XNextEvent(d, e);
// while (1) {
// XNextEvent(d, e);
// if(e->type != 16){
// printf("Inside XNextEvent timeout\n");
// break;
// }
// }
while (1) {
XNextEvent(d, e);
long long int new_ts = timeInMilliseconds();
// Make sure window dragging or resizing is not occuring
if(!(e->type == 22 && (e->type == last_event) && timeInMilliseconds()-event_ts < 419)){
// printf("%d == %d\n",e->type, last_event);
// printf("Timestamp: %lld\n",timeInMilliseconds()-event_ts);
*event_ts_ptr = new_ts;
*last_event_ptr = e->type;
// printf("in event_ts_ptr: %lld\n",*event_ts_ptr);
// printf("in last_event_ptr: %d\n",*last_event_ptr);
break;
}
*event_ts_ptr = new_ts;
*last_event_ptr = e->type;
// printf("event_ts_ptr: %lld\n",*event_ts_ptr);
// printf("last_event_ptr: %d\n",*last_event_ptr);
}
return 0;
} else {
@@ -541,15 +528,12 @@ int main(void){
system(run_offInput);
ran_onInput = 0;
}
// e.type = Expose;
// e.xexpose.count = 0;
}
}
else{
// XNextEvent(d, &e);
while (1) {
XNextEvent(d, &e);
// Make sure window dragging or resizing is not occuring
if(!(e.type == 22 && (e.type == last_event) && timeInMilliseconds()-event_ts < 300)){
// printf("%d == %d\n",e.type, last_event);
// printf("Timestamp: %lld\n",timeInMilliseconds()-event_ts);

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env python3
import json, time, os
import json, time, os, sys
from shutil import copyfile
from subprocess import PIPE, Popen
from prekinto import *
@@ -23,6 +23,16 @@ def requirements():
os.system("sudo apt-get install -y " + run_pkg)
print("\n")
def install_ibus():
print(bcolors.CYELLOW + "You need to set IBus as the default Input Method for full word-wise support and re-run this installer.\n" + bcolors.ENDC)
print("im-config -n ibus\n")
run_install = yn_choice(bcolors.CYELLOW + "Would you like to run it now? (Will require logoff and logon.)\n" + bcolors.ENDC)
if(run_install):
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()
check_xbind = symbols_gui_line = cmdline("which xbindkeys").strip()
check_xdotool = symbols_gui_line = cmdline("which xdotool").strip()
@@ -41,6 +51,18 @@ if len(check_xdotool) == 0:
if runpkg != 0:
requirements()
if 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:
@@ -116,7 +138,7 @@ if 'hack' in keyboardconfigs[defaultkb-1]:
os.system(keyboardconfigs[defaultkb-1]['hack'])
# Setup the selected keyboards config
os.system("cp -rf ./.xkb ~/.xkb/")
os.system("cp -TRv ./.xkb ~/.xkb/")
if os.path.isdir(homedir + "/.xkb/keymap") == False:
os.mkdir(homedir + "/.xkb/keymap")
time.sleep(0.5)

0
system-config/cleanup.sh Normal file → Executable file
View File

View File

@@ -36,7 +36,7 @@
"symbols": "",
"types": "",
"de": [],
"appnames": [ "Chromium","Chromium-browser" ]
"appnames": [ "Chromium","Chromium-browser","Google-chrome" ]
}],
"init": [],
"detypes":["gnome2","gnome3","kde4","kde5","xfce","i3wm"],