mirror of
https://github.com/rbreaves/kinto.git
synced 2025-08-05 18:38:26 +02:00
Compare commits
25 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
336d883b03 | ||
![]() |
61e357b5da | ||
![]() |
407f781af0 | ||
![]() |
4250967d5a | ||
![]() |
c0785ac045 | ||
![]() |
c57b5a3603 | ||
![]() |
4d423de14b | ||
![]() |
ca4f9be6ee | ||
![]() |
afcb4c3a73 | ||
![]() |
2846125c23 | ||
![]() |
25ce34a2fc | ||
![]() |
e1226afad8 | ||
![]() |
ead90abf94 | ||
![]() |
5bf6b06917 | ||
![]() |
e892f045f5 | ||
![]() |
c1c473c097 | ||
![]() |
969b74adda | ||
![]() |
7e6f872983 | ||
![]() |
b50522c5b1 | ||
![]() |
6a887ebdea | ||
![]() |
d7433092ff | ||
![]() |
d670579db8 | ||
![]() |
3389c512e2 | ||
![]() |
f3ab1e043b | ||
![]() |
78e537ac71 |
42
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
42
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: ''
|
||||||
|
labels: bug
|
||||||
|
assignees: rbreaves
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Install Type:** Bare Metal or VM
|
||||||
|
**Distro:** Name + Version
|
||||||
|
**DE:** Gnome, XFCE, KDE
|
||||||
|
**Branch:** master, dev
|
||||||
|
**Commit:** git rev-parse --short HEAD
|
||||||
|
|
||||||
|
**Kinto Input Caret Status**
|
||||||
|
```
|
||||||
|
cat /tmp/kinto/caret
|
||||||
|
```
|
||||||
|
|
||||||
|
**Kinto Standard Log**
|
||||||
|
```
|
||||||
|
journalctl --user-unit=keyswap.service -b
|
||||||
|
```
|
||||||
|
**Kinto Debug Log (1.0.6-2+)**
|
||||||
|
```
|
||||||
|
systemctl --user stop keyswap
|
||||||
|
cd ~/.config/kinto
|
||||||
|
./kintox11 --debug
|
||||||
|
```
|
||||||
|
|
||||||
|
**Screenshots**
|
||||||
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context about the problem here.
|
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: ''
|
||||||
|
labels: enhancement
|
||||||
|
assignees: rbreaves
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
10
.github/ISSUE_TEMPLATE/gratitude.md
vendored
Normal file
10
.github/ISSUE_TEMPLATE/gratitude.md
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
name: Gratitude
|
||||||
|
about: Just wants to give a shout out!
|
||||||
|
title: ''
|
||||||
|
labels: gratitude
|
||||||
|
assignees: rbreaves
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
10
.github/ISSUE_TEMPLATE/question.md
vendored
Normal file
10
.github/ISSUE_TEMPLATE/question.md
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
name: Question
|
||||||
|
about: Question about Kinto functionality
|
||||||
|
title: ''
|
||||||
|
labels: question
|
||||||
|
assignees: rbreaves
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
@@ -3,6 +3,15 @@ xkb_symbols "swapescape" {
|
|||||||
key <CAPS> { [ Escape ] };
|
key <CAPS> { [ Escape ] };
|
||||||
key <ESC> { [ Caps_Lock ] };
|
key <ESC> { [ Caps_Lock ] };
|
||||||
};
|
};
|
||||||
|
hidden partial modifier_keys
|
||||||
|
xkb_symbols "caps_shiftlock" {
|
||||||
|
replace key <CAPS> { [ Shift_Lock ] };
|
||||||
|
modifier_map Shift { Shift_Lock };
|
||||||
|
};
|
||||||
|
hidden partial modifier_keys
|
||||||
|
xkb_symbols "caps_none" {
|
||||||
|
key <CAPS> { [ VoidSymbol ] };
|
||||||
|
};
|
||||||
default partial xkb_symbols "mac_levelssym" {
|
default partial xkb_symbols "mac_levelssym" {
|
||||||
// LEFT to Begin Line or Beginning of word
|
// LEFT to Begin Line or Beginning of word
|
||||||
replace key <LEFT> {
|
replace key <LEFT> {
|
||||||
|
18
README.md
18
README.md
@@ -28,6 +28,12 @@ Kinto works for standard Windows, Apple and Chromebook keyboards. The following
|
|||||||
- IBus*
|
- IBus*
|
||||||
- Fedora/RHEL/Manjaro/Arch/Debian/Ubuntu based distro 16.04+
|
- Fedora/RHEL/Manjaro/Arch/Debian/Ubuntu based distro 16.04+
|
||||||
|
|
||||||
|
- Windows 10 & WSL is now supported
|
||||||
|
- Powershell - run as Administrator (for install)
|
||||||
|
- Chocolatey (for install)
|
||||||
|
- Python (for install)
|
||||||
|
- Autohotkey
|
||||||
|
|
||||||
Binary is included and will be installed, but you can also compile kintox11.c on your system. You will need to compile and install json-c first as its libraries will be required to compile and run the program.
|
Binary is included and will be installed, but you can also compile kintox11.c on your system. 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. Setup.py will set it but you can manually set it as well or check your current Input Method.
|
*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.
|
||||||
@@ -363,7 +369,7 @@ You can also add additional Desktop Environment related tweaks to user_config.js
|
|||||||
"name":"term",
|
"name":"term",
|
||||||
"run":"setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.term $DISPLAY",
|
"run":"setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.term $DISPLAY",
|
||||||
"de":[2],
|
"de":[2],
|
||||||
"appnames":[ "Gnome-terminal","konsole","io.elementary.terminal","terminator","sakura","guake","tilda","xterm","eterm" ],
|
"appnames":[ "Gnome-terminal","konsole","io.elementary.terminal","terminator","sakura","guake","tilda","xterm","eterm","kitty" ],
|
||||||
"run_onInput":"",
|
"run_onInput":"",
|
||||||
"run_offInput": "killall xbindkeys > /dev/null 2>&1",
|
"run_offInput": "killall xbindkeys > /dev/null 2>&1",
|
||||||
"symbols":"",
|
"symbols":"",
|
||||||
@@ -481,6 +487,16 @@ cd ~/.config/kinto
|
|||||||
./kintox11
|
./kintox11
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Debug
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
```
|
||||||
|
systemctl --user stop keyswap
|
||||||
|
cd ~/.config/kinto
|
||||||
|
./kintox11 --debug
|
||||||
|
```
|
||||||
|
|
||||||
## Language Support
|
## Language Support
|
||||||
I'd appreciate any help from people with non-US based keyboards, to help ensure that these keymaps and keyswap methods work in all or most languages.
|
I'd appreciate any help from people with non-US based keyboards, to help ensure that these keymaps and keyswap methods work in all or most languages.
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{"defaultapps":[{
|
{"defaultapps":[{
|
||||||
"name":"term",
|
"name":"term",
|
||||||
"appnames":[ "Gnome-terminal","konsole","io.elementary.terminal","terminator","sakura","guake","tilda","xterm","eterm" ]
|
"appnames":[ "Gnome-terminal","konsole","io.elementary.terminal","terminator","sakura","guake","tilda","xterm","eterm","kitty" ]
|
||||||
}],
|
}],
|
||||||
"defaulttypes":["windows","mac","chromebook"],
|
"defaulttypes":["windows","mac","chromebook"],
|
||||||
"defaults":[{
|
"defaults":[{
|
||||||
|
Binary file not shown.
@@ -13,8 +13,10 @@
|
|||||||
// gcc -L/usr/local/lib/ kintox11.c -ljson-c -lXmu -lXt -lX11 -O2 -o kintox11
|
// gcc -L/usr/local/lib/ kintox11.c -ljson-c -lXmu -lXt -lX11 -O2 -o kintox11
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#define _GNU_SOURCE 1
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@@ -26,6 +28,13 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
char * append(char * string1, char * string2)
|
||||||
|
{
|
||||||
|
char * result = NULL;
|
||||||
|
asprintf(&result, "%s,%s", string1, string2);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
long long timeInMilliseconds(void) {
|
long long timeInMilliseconds(void) {
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
|
||||||
@@ -53,7 +62,7 @@ int XNextEventTimeout(Display *d, XEvent *e, double seconds, long long event_ts,
|
|||||||
long long int new_ts = timeInMilliseconds();
|
long long int new_ts = timeInMilliseconds();
|
||||||
|
|
||||||
// Make sure window dragging or resizing is not occuring
|
// Make sure window dragging or resizing is not occuring
|
||||||
if(!(e->type == 22 && (e->type == last_event) && timeInMilliseconds()-event_ts < 419)){
|
if(!(e->type == ConfigureNotify && (e->type == last_event) && timeInMilliseconds()-event_ts < 419)){
|
||||||
*event_ts_ptr = new_ts;
|
*event_ts_ptr = new_ts;
|
||||||
*last_event_ptr = e->type;
|
*last_event_ptr = e->type;
|
||||||
break;
|
break;
|
||||||
@@ -175,15 +184,26 @@ int handle_error(Display* display, XErrorEvent* error){
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Window get_focus_window(Display* d){
|
Window get_focus_window(Display* d, int etype, char const *eventName, char const *current_app, bool debug){
|
||||||
Window w;
|
Window w;
|
||||||
int revert_to;
|
int revert_to;
|
||||||
XGetInputFocus(d, &w, &revert_to); // see man
|
|
||||||
|
if(debug == true){
|
||||||
|
printf("\n get focus window\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!(etype == DestroyNotify || etype == UnmapNotify)) {
|
||||||
|
XGetInputFocus(d, &w, &revert_to); // see man
|
||||||
|
if(debug == true){
|
||||||
|
printf(" -%s: event: %d, window_id: %ld\n",current_app,etype,w);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(xerror){
|
if(xerror){
|
||||||
printf("Error getting focused window\n");
|
printf("*Error getting focused window, e.type: %d, current_app: %s\n",etype,current_app);
|
||||||
exit(1);
|
exit(1);
|
||||||
}else if(w == None){
|
}else if(w == None){
|
||||||
printf("no focus window\n");
|
printf("*no focus window, e.type: %d, current_app: %s\n",etype,current_app);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,45 +214,68 @@ Window get_focus_window(Display* d){
|
|||||||
// a top window have the following specifications.
|
// a top window have the following specifications.
|
||||||
// * the start window is contained the descendent windows.
|
// * the start window is contained the descendent windows.
|
||||||
// * the parent window is the root window.
|
// * the parent window is the root window.
|
||||||
Window get_top_window(Display* d, Window start, int etype, int last_event, char const *current_app){
|
Window get_top_window(Display* d, Window start, int etype, char const *eventName, char const *current_app, bool debug){
|
||||||
Window w = start;
|
Window w = start;
|
||||||
Window parent = start;
|
Window parent = start;
|
||||||
Window root = None;
|
Window root = None;
|
||||||
Window *children;
|
Window *children;
|
||||||
unsigned int nchildren;
|
unsigned int nchildren;
|
||||||
Status s;
|
Status s;
|
||||||
|
char * ws;
|
||||||
|
char * wstr;
|
||||||
|
ws = malloc(sizeof(char)*4096);
|
||||||
|
wstr = malloc(sizeof(char)*100);
|
||||||
|
// strcpy(wstr,"test,");
|
||||||
|
|
||||||
|
if(debug == true){
|
||||||
|
printf("\n get top window\n");
|
||||||
|
}
|
||||||
// Checking for Destroy and Unmap Notify events here too
|
// Checking for Destroy and Unmap Notify events here too
|
||||||
// Sometimes they still get passed through and if so need
|
// Sometimes they still get passed through and if so need
|
||||||
// to be ignored or XQueryTree will cause a segmentation fault
|
// to be ignored or XQueryTree will cause a segmentation fault
|
||||||
while (parent != root && parent != 0 && !(etype == 17 || etype == 18)) {
|
while (parent != root && parent != 0 && !(etype == DestroyNotify || etype == UnmapNotify)) {
|
||||||
w = parent;
|
w = parent;
|
||||||
|
|
||||||
s = XQueryTree(d, w, &root, &parent, &children, &nchildren); // see man
|
s = XQueryTree(d, w, &root, &parent, &children, &nchildren); // see man
|
||||||
|
|
||||||
|
sprintf(wstr, "%ld", w);
|
||||||
|
if ((ws != NULL) && (ws[0] == '\0')) {
|
||||||
|
strcpy(ws,wstr);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
ws = append(ws, wstr);
|
||||||
|
}
|
||||||
|
|
||||||
if (s)
|
if (s)
|
||||||
XFree(children);
|
XFree(children);
|
||||||
|
|
||||||
if(xerror){
|
if(xerror){
|
||||||
printf("fail to get top window: %ld, e.type: %d, last_event: %d, current_app: %s\n",w,etype,last_event, current_app);
|
printf("*fail to get top window: %ld, e.type: %d, current_app: %s\n",w,etype,current_app);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// printf(" get parent (window: %d)\n", (int)w);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// printf("success (window: %d)\n", (int)w);
|
if(debug == true){
|
||||||
// printf("hello\n");
|
printf(" -%s: event: %d, window_id: %s\n",current_app,etype,ws);
|
||||||
|
}
|
||||||
|
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
// search a named window (that has a WM_STATE prop)
|
// search a named window (that has a WM_STATE prop)
|
||||||
// on the descendent windows of the argment Window.
|
// on the descendent windows of the argment Window.
|
||||||
Window get_named_window(Display* d, Window start){
|
Window get_named_window(Display* d, Window start, int etype, char const *eventName, char const *current_app, bool debug){
|
||||||
Window w;
|
Window w;
|
||||||
|
|
||||||
|
if(debug == true){
|
||||||
|
printf("\n get named window\n");
|
||||||
|
}
|
||||||
// printf("getting named window ... ");
|
// printf("getting named window ... ");
|
||||||
w = XmuClientWindow(d, start); // see man
|
w = XmuClientWindow(d, start); // see man
|
||||||
|
|
||||||
|
if(debug == true){
|
||||||
|
printf(" -%s: event: %d, window_id: %ld\n\n",current_app,etype,w);
|
||||||
|
}
|
||||||
// if(w == start)
|
// if(w == start)
|
||||||
// printf("fail\n");
|
// printf("fail\n");
|
||||||
// printf("success (window: %d)\n", (int) w);
|
// printf("success (window: %d)\n", (int) w);
|
||||||
@@ -263,7 +306,53 @@ const char * str_window_class(Display* d, Window w, char *prior_app ){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(void){
|
int main(int argc, char *argv[]){
|
||||||
|
|
||||||
|
bool debug;
|
||||||
|
|
||||||
|
if(argc < 2){
|
||||||
|
debug = false;
|
||||||
|
}
|
||||||
|
if(argc > 1 && (strcmp(argv[1], "-d") == 0 || strcmp(argv[1], "--debug") == 0 )){
|
||||||
|
debug = true;
|
||||||
|
printf("Running in debug mode\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *eventNames[34];
|
||||||
|
eventNames[0] = "None";
|
||||||
|
eventNames[1] = "KeyPress";
|
||||||
|
eventNames[2] = "KeyRelease";
|
||||||
|
eventNames[3] = "ButtonPress";
|
||||||
|
eventNames[4] = "ButtonRelease";
|
||||||
|
eventNames[5] = "MotionNotify";
|
||||||
|
eventNames[6] = "EnterNotify";
|
||||||
|
eventNames[7] = "LeaveNotify";
|
||||||
|
eventNames[8] = "FocusIn";
|
||||||
|
eventNames[9] = "FocusOut";
|
||||||
|
eventNames[10] = "KeymapNotify";
|
||||||
|
eventNames[11] = "Expose";
|
||||||
|
eventNames[12] = "GraphicsExpose";
|
||||||
|
eventNames[13] = "NoExpose";
|
||||||
|
eventNames[14] = "VisibilityNotify";
|
||||||
|
eventNames[15] = "CreateNotify";
|
||||||
|
eventNames[16] = "DestroyNotify";
|
||||||
|
eventNames[17] = "UnmapNotify";
|
||||||
|
eventNames[18] = "MapNotify";
|
||||||
|
eventNames[19] = "MapRequest";
|
||||||
|
eventNames[20] = "ReparentNotify";
|
||||||
|
eventNames[21] = "ConfigureNotify";
|
||||||
|
eventNames[22] = "ConfigureRequest";
|
||||||
|
eventNames[23] = "ResizeRequest";
|
||||||
|
eventNames[25] = "CirculateNotify";
|
||||||
|
eventNames[26] = "CirculateRequest";
|
||||||
|
eventNames[27] = "PropertyNotify";
|
||||||
|
eventNames[28] = "SelectionClear";
|
||||||
|
eventNames[29] = "SelectionRequest";
|
||||||
|
eventNames[30] = "SelectionNotify";
|
||||||
|
eventNames[31] = "ColormapNotify";
|
||||||
|
eventNames[32] = "ClientMessage";
|
||||||
|
eventNames[33] = "MappingNotify";
|
||||||
|
|
||||||
|
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char buffer[10240];
|
char buffer[10240];
|
||||||
@@ -435,13 +524,13 @@ int main(void){
|
|||||||
printf("Starting keyswap...\n");
|
printf("Starting keyswap...\n");
|
||||||
|
|
||||||
// get active window
|
// get active window
|
||||||
w = get_focus_window(d);
|
w = get_focus_window(d, 0, eventNames[0], current_app, debug);
|
||||||
w = get_top_window(d, w, 0, 0, current_app);
|
w = get_top_window(d, w, 0, eventNames[0], current_app, debug);
|
||||||
w = get_named_window(d, w);
|
w = get_named_window(d, w, 0, eventNames[0], current_app, debug);
|
||||||
|
|
||||||
// XFetchName(d, w, &name);
|
// XFetchName(d, w, &name);
|
||||||
// printf("window:%#x name:%s\n", w, name);
|
// printf("window:%#x name:%s\n", w, name);
|
||||||
printf("First window name: %s \n",str_window_class(d, w,prior_app));
|
printf("First window name: %s \n\n",str_window_class(d, w,prior_app));
|
||||||
|
|
||||||
int breakouter;
|
int breakouter;
|
||||||
int last_event=0;
|
int last_event=0;
|
||||||
@@ -488,7 +577,9 @@ int main(void){
|
|||||||
|
|
||||||
if(strcicmp(prior_category, current_category) != 0){
|
if(strcicmp(prior_category, current_category) != 0){
|
||||||
printf("%s: %s\n",current_category,current_app);
|
printf("%s: %s\n",current_category,current_app);
|
||||||
// printf("run: %s\n",run_array[category_idx]);
|
if(debug == true){
|
||||||
|
printf("run: %s\n",run_array[category_idx]);
|
||||||
|
}
|
||||||
system(run_array[category_idx]);
|
system(run_array[category_idx]);
|
||||||
strcpy(run_normal,run_array[category_idx]);
|
strcpy(run_normal,run_array[category_idx]);
|
||||||
ran_onInput = 0;
|
ran_onInput = 0;
|
||||||
@@ -499,11 +590,15 @@ int main(void){
|
|||||||
if(config_de_array[category_idx][r] != -1){
|
if(config_de_array[category_idx][r] != -1){
|
||||||
int de_id_idx = in_int(de_id_array, de_len, config_de_array[category_idx][r]);
|
int de_id_idx = in_int(de_id_array, de_len, config_de_array[category_idx][r]);
|
||||||
if(strcicmp(current_category, "term") == 0){
|
if(strcicmp(current_category, "term") == 0){
|
||||||
// printf("Running de term command: %s\n",de_runterm_array[de_id_idx]);
|
if(debug == true){
|
||||||
|
printf("Running de term command: %s\n",de_runterm_array[de_id_idx]);
|
||||||
|
}
|
||||||
system(de_runterm_array[de_id_idx]);
|
system(de_runterm_array[de_id_idx]);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
// printf("Running de gui command: %s\n",de_rungui_array[de_id_idx]);
|
if(debug == true){
|
||||||
|
printf("Running de gui command: %s\n",de_rungui_array[de_id_idx]);
|
||||||
|
}
|
||||||
system(de_rungui_array[de_id_idx]);
|
system(de_rungui_array[de_id_idx]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -524,12 +619,16 @@ int main(void){
|
|||||||
if(strlen(run_onInput) > 0){
|
if(strlen(run_onInput) > 0){
|
||||||
while(XNextEventTimeout(d, &e, .5, event_ts, last_event, &event_ts, &last_event)){
|
while(XNextEventTimeout(d, &e, .5, event_ts, last_event, &event_ts, &last_event)){
|
||||||
if(check_caret() && ran_onInput == 0){
|
if(check_caret() && ran_onInput == 0){
|
||||||
// printf("run_onInput: %s\n",run_onInput);
|
if(debug == true){
|
||||||
|
printf("run_onInput: %s\n",run_onInput);
|
||||||
|
}
|
||||||
system(run_onInput);
|
system(run_onInput);
|
||||||
ran_onInput = 1;
|
ran_onInput = 1;
|
||||||
}
|
}
|
||||||
else if(!check_caret() && ran_onInput == 1){
|
else if(!check_caret() && ran_onInput == 1){
|
||||||
// printf("run_offInput: %s\n",run_offInput);
|
if(debug == true){
|
||||||
|
printf("run_offInput: %s\n",run_offInput);
|
||||||
|
}
|
||||||
system(run_offInput);
|
system(run_offInput);
|
||||||
ran_onInput = 0;
|
ran_onInput = 0;
|
||||||
}
|
}
|
||||||
@@ -539,9 +638,11 @@ int main(void){
|
|||||||
while (1) {
|
while (1) {
|
||||||
XNextEvent(d, &e);
|
XNextEvent(d, &e);
|
||||||
// Make sure window dragging or resizing is not occuring
|
// Make sure window dragging or resizing is not occuring
|
||||||
if(!(e.type == 22 && (e.type == last_event) && timeInMilliseconds()-event_ts < 300)){
|
if(!(e.type == ConfigureNotify && (e.type == last_event) && timeInMilliseconds()-event_ts < 300)){
|
||||||
// printf("%d == %d\n",e.type, last_event);
|
if(debug == true){
|
||||||
// printf("Timestamp: %lld\n",timeInMilliseconds()-event_ts);
|
printf(" event: %s %d\n",eventNames[e.type-1],e.type);
|
||||||
|
printf(" duration: %lldms\n",timeInMilliseconds()-event_ts);
|
||||||
|
}
|
||||||
event_ts = timeInMilliseconds();
|
event_ts = timeInMilliseconds();
|
||||||
last_event = e.type;
|
last_event = e.type;
|
||||||
break;
|
break;
|
||||||
@@ -551,35 +652,17 @@ int main(void){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(strcicmp(current_app, "plasmashell") == 0){
|
|
||||||
// XNextEvent(d, &e);
|
|
||||||
// }
|
|
||||||
// if(strcicmp(current_app, "plasmashell") == 0 && e.type == 18 && last_event == 22){
|
|
||||||
// XNextEvent(d, &e);
|
|
||||||
// }
|
|
||||||
// if(strcicmp(prior_app, "plasmashell") == 0){
|
|
||||||
// XNextEvent(d, &e);
|
|
||||||
// }
|
|
||||||
// if(strcicmp(current_app, "dolphin") == 0){
|
|
||||||
// XNextEvent(d, &e);
|
|
||||||
// }
|
|
||||||
// if(strcicmp(prior_app, "dolphin") == 0){
|
|
||||||
// XNextEvent(d, &e);
|
|
||||||
// }
|
|
||||||
// if(strcicmp(current_app, "dolphin") == 0 && e.type == 18 && last_event == 16){
|
|
||||||
// XNextEvent(d, &e);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Reference http://www.rahul.net/kenton/xproto/xevents_errors.html
|
// Reference http://www.rahul.net/kenton/xproto/xevents_errors.html
|
||||||
// event type 17 - DestroyNotify
|
// event type 17 - DestroyNotify
|
||||||
// event type 18 - UnmapNotify
|
// event type 18 - UnmapNotify
|
||||||
|
// event type 22 - ConfigureNotify
|
||||||
// Dismiss the following events by initiating another XNextEvent
|
// Dismiss the following events by initiating another XNextEvent
|
||||||
while(e.type == 17 || e.type == 18){
|
while(e.type != ConfigureNotify){
|
||||||
XNextEvent(d, &e);
|
XNextEvent(d, &e);
|
||||||
}
|
}
|
||||||
|
|
||||||
w = get_focus_window(d);
|
w = get_focus_window(d, e.type, eventNames[e.type-1], current_app, debug);
|
||||||
w = get_top_window(d, w, e.type, last_event, current_app);
|
w = get_top_window(d, w, e.type, eventNames[e.type-1], current_app, debug);
|
||||||
w = get_named_window(d, w);
|
w = get_named_window(d, w, e.type, eventNames[e.type-1], current_app, debug);
|
||||||
}
|
}
|
||||||
}
|
}
|
42
setup.py
42
setup.py
@@ -36,12 +36,50 @@ def install_ibus():
|
|||||||
input("IBus has been set as the default Input Method.\nPress any key to exit and re-run after logoff & logon...")
|
input("IBus has been set as the default Input Method.\nPress any key to exit and re-run after logoff & logon...")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
def windows_setup():
|
||||||
|
keymaps = ["Apple keyboard standard", "Apple keyboard w/ Caps lock as Esc", "Windows keyboard standard", "Windows keyboard w/ Caps lock as Esc","Uninstall"]
|
||||||
|
for index, item in enumerate(keymaps):
|
||||||
|
print(" %i. %s" % (index+1, item.capitalize()))
|
||||||
|
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("")
|
||||||
|
path= cmdline('echo %cd%')[:-1]
|
||||||
|
if default == 1:
|
||||||
|
os.system("regedit " + path + "\\windows\\macbook_winctrl_swap.reg")
|
||||||
|
elif default == 2:
|
||||||
|
os.system("regedit " + path + "\\windows\\macbook_winctrl_capsesc_swap.reg")
|
||||||
|
elif default == 3:
|
||||||
|
os.system("regedit " + path + "\\windows\\standard_ctrlalt_swap.reg")
|
||||||
|
elif default == 4:
|
||||||
|
os.system("regedit " + path + "\\windows\\standard_ctrlalt_capsesc_swap.reg")
|
||||||
|
elif default == 5:
|
||||||
|
os.system("regedit " + path + "\\windows\\remove_keyswap.reg")
|
||||||
|
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("\nWill now install Ubuntu Terminal Theme as default...")
|
||||||
|
os.system("regedit " + path + "\\windows\\theme_ubuntu.reg")
|
||||||
|
print("Copying autohotkey combinations for Terminals & Editors...")
|
||||||
|
os.system("copy /Y " + path + "\\windows\\kinto.ahk \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\kinto.ahk\"")
|
||||||
|
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\"")
|
||||||
|
|
||||||
|
|
||||||
# check_x11 = cmdline("env | grep -i x11").strip()
|
# check_x11 = cmdline("env | grep -i x11").strip()
|
||||||
check_x11 = cmdline("env | grep -i x11 || loginctl show-session \"$XDG_SESSION_ID\" -p Type | awk -F= '{print $2}'").strip()
|
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 len(check_x11) == 0:
|
||||||
print("You are not using x11, please logout and back in using x11/Xorg")
|
if os.name != 'nt':
|
||||||
sys.exit()
|
print("You are not using x11, please logout and back in using x11/Xorg")
|
||||||
|
sys.exit()
|
||||||
|
else:
|
||||||
|
print("You are detected as running Windows.")
|
||||||
|
windows_setup()
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
check_xbind = cmdline("which xbindkeys 2>/dev/null").strip()
|
check_xbind = cmdline("which xbindkeys 2>/dev/null").strip()
|
||||||
check_xdotool = cmdline("which xdotool 2>/dev/null").strip()
|
check_xdotool = cmdline("which xdotool 2>/dev/null").strip()
|
||||||
|
10
uninstall.sh
10
uninstall.sh
@@ -1,9 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
systemctl --user stop keyswap
|
systemctl --user stop keyswap 2>/dev/null
|
||||||
systemctl --user disable keyswap
|
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/autostart/kinto.desktop
|
||||||
rm -rf ~/.config/kinto
|
rm -rf ~/.config/kinto
|
||||||
rm -rf ~/.xkb
|
rm -rf ~/.xkb
|
||||||
|
systemctl daemon-reload
|
||||||
sed -i '/xkb/d' ~/.Xsession
|
sed -i '/xkb/d' ~/.Xsession 2>/dev/null
|
@@ -16,7 +16,7 @@
|
|||||||
"symbols":"",
|
"symbols":"",
|
||||||
"types":"",
|
"types":"",
|
||||||
"de":[],
|
"de":[],
|
||||||
"appnames":[ "Gnome-terminal","konsole","io.elementary.terminal","terminator","sakura","guake","tilda","xterm","eterm" ]
|
"appnames":[ "Gnome-terminal","konsole","io.elementary.terminal","terminator","sakura","guake","tilda","xterm","eterm","kitty" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "firefox",
|
"name": "firefox",
|
||||||
|
12
windows/autohotkey.ps1
Normal file
12
windows/autohotkey.ps1
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
$testchoco = powershell choco -v
|
||||||
|
if(-not($testchoco)){
|
||||||
|
Write-Output "Seems Chocolatey is not installed, installing now"
|
||||||
|
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Write-Output "Chocolatey Version $testchoco is already installed"
|
||||||
|
}
|
||||||
|
|
||||||
|
if(-not(test-path "C:\Program Files\AutoHotkey\AutoHotkey.exe")){
|
||||||
|
choco install autohotkey.install
|
||||||
|
}
|
30
windows/kinto.ahk
Normal file
30
windows/kinto.ahk
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
#IfWinActive ahk_exe sublime_text.exe
|
||||||
|
; Remap Ctrl+Shift to behave like macOS Sublimetext
|
||||||
|
; Will extend cursor to multiple lines
|
||||||
|
#+Up::send {shift up}^!{Up}
|
||||||
|
#+Down::send {shift up}^!{Down}
|
||||||
|
|
||||||
|
; Remap Ctrl+Cmd+G to select all matches
|
||||||
|
#^g::send !{F3}
|
||||||
|
#If
|
||||||
|
|
||||||
|
#IfWinActive ahk_exe ubuntu.exe
|
||||||
|
^c::Send {LCtrl down}{LShift down}c{LCtrl Up}{LShift Up}
|
||||||
|
#c::Send {LCtrl down}c{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}
|
||||||
|
#k::Send {LCtrl down}k{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}
|
||||||
|
^v::Send {LCtrl down}{LShift down}v{LCtrl Up}{LShift Up}
|
||||||
|
#If
|
||||||
|
|
||||||
|
#IfWinActive ahk_exe powershell.exe
|
||||||
|
^c::Send {LCtrl down}{LShift down}c{LCtrl Up}{LShift Up}
|
||||||
|
#c::Send {LCtrl down}c{LCtrl Up}
|
||||||
|
#If
|
BIN
windows/macbook_winctrl_capsesc_swap.reg
Normal file
BIN
windows/macbook_winctrl_capsesc_swap.reg
Normal file
Binary file not shown.
BIN
windows/macbook_winctrl_swap.reg
Normal file
BIN
windows/macbook_winctrl_swap.reg
Normal file
Binary file not shown.
BIN
windows/macbook_winctrl_swap.skl
Executable file
BIN
windows/macbook_winctrl_swap.skl
Executable file
Binary file not shown.
4
windows/remove_keyswap.reg
Normal file
4
windows/remove_keyswap.reg
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
Windows Registry Editor Version 5.00
|
||||||
|
|
||||||
|
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
|
||||||
|
"Scancode Map"=-
|
BIN
windows/standard_ctrlalt_capsesc_swap.reg
Normal file
BIN
windows/standard_ctrlalt_capsesc_swap.reg
Normal file
Binary file not shown.
BIN
windows/standard_ctrlalt_swap.reg
Normal file
BIN
windows/standard_ctrlalt_swap.reg
Normal file
Binary file not shown.
BIN
windows/standard_ctrlalt_swap.skl
Executable file
BIN
windows/standard_ctrlalt_swap.skl
Executable file
Binary file not shown.
BIN
windows/theme_campbell.reg
Normal file
BIN
windows/theme_campbell.reg
Normal file
Binary file not shown.
BIN
windows/theme_legacy.reg
Normal file
BIN
windows/theme_legacy.reg
Normal file
Binary file not shown.
BIN
windows/theme_onehalfdark.reg
Normal file
BIN
windows/theme_onehalfdark.reg
Normal file
Binary file not shown.
BIN
windows/theme_onehalflight.reg
Normal file
BIN
windows/theme_onehalflight.reg
Normal file
Binary file not shown.
BIN
windows/theme_ubuntu.reg
Normal file
BIN
windows/theme_ubuntu.reg
Normal file
Binary file not shown.
Reference in New Issue
Block a user