Compare commits

...

11 Commits
v1.0 ... 1.0.3

Author SHA1 Message Date
Ben Reaves
a6b9b1ffbb Merge pull request #21 from rbreaves/dev
- Fixes login/logout and reboot startup issues
2020-02-05 01:48:19 +00:00
Ben Reaves
d8c516c13c - Fixes login/logout and reboot startup issues, delays the start by 5 seconds 2020-02-04 19:45:39 -06:00
Ben Reaves
b763703d70 Merge pull request #19 from rbreaves/dev
App breaking bug resolved and improved initialization on boot
2020-02-04 22:02:38 +00:00
Ben Reaves
ecaf413fa4 - Removed 5 second restart delay, I think the new changes makes it irrelevant 2020-02-04 15:58:09 -06:00
Ben Reaves
48e01750e5 - Fixed breaking bug exception on how gui apps are initially handled. Also improved the initialization of kintox11. 2020-02-04 15:36:26 -06:00
Ben Reaves
5ec8c076a3 - Added more verbosity to the dynamic app output 2020-02-04 14:48:40 -06:00
Ben Reaves
c620b299bd - Added a more verbose initial startup to kintox11 for easier debugging purposes 2020-02-04 14:41:55 -06:00
Ben Reaves
496cb4d340 - Added O2 optimization to kintox11 binary 2020-02-03 22:52:19 -06:00
Ben Reaves
5f1e82fb24 - Fixed bug that prevented the new keymap from working under Chromebooks with Linux/GalliumOS 2020-02-03 16:27:59 -06:00
Ben Reaves
46e81640c6 - Updated readme again, keeping it shorter 2020-02-03 14:25:22 -06:00
Ben Reaves
1c56c98ab9 - Updated readme to properly link to releases and provide more info 2020-02-03 13:23:51 -06:00
9 changed files with 90 additions and 24 deletions

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
.env/
.DS_Store
__pycache__/

View File

@@ -0,0 +1,14 @@
default partial xkb_symbols "mac_levelssym" {
key <LALT> {
repeat= no,
type= "ONE_LEVEL",
symbols[Group1]= [ Hyper_L ],
actions[group1]=[ SetMods(modifiers=Shift+Control) ]
};
key <RALT> {
repeat= no,
type= "ONE_LEVEL",
symbols[Group1]= [ Hyper_R ],
actions[group1]=[ SetMods(modifiers=Shift+Control) ]
};
};

View File

@@ -2,15 +2,13 @@
![alt text](https://raw.githubusercontent.com/rbreaves/kinto/master/Kinto.png)
[![GitHub release](https://img.shields.io/github/release/rbreaves/kinto.svg)](https://github.com/rbreaves/kinto/releases)
[![GitHub release](https://img.shields.io/github/release/rbreaves/kinto.svg)](https://github.com/rbreaves/kinto/releases/latest)
![alt text](https://github.com/rbreaves/kinto/blob/master/splash.png)
\- Type in Linux like it's a Mac. \-
Memory muscle matters for programmers and developers.
If it happens on your mac keyboard then it should happen the same in linux.
Cmd = Ctrl+Shift for all terminals.
Note: As of version 1.0 Kinto no longer maps Cmd/Alt to Super while using the Terminal, it is now mapping to Ctrl+Shift by default. Please reset your terminal's keymaps back to their defaults.

View File

@@ -52,7 +52,7 @@
"gui":"setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.chromebook.gui $DISPLAY",
"term":"setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.term $DISPLAY",
"xkb_symbols_gui":"+chromebook(swap_lalt_lctrl)+mac_gui(mac_levelssym)",
"xkb_symbols_term":"+altwin(swap_alt_win)+mac_term(mac_levelssym)",
"xkb_symbols_term":"+altwin(swap_alt_win)+mac_term_chromebook(mac_levelssym)",
"xkb_types_gui":"+mac_gui(addmac_levels)",
"xkb_types_term":""
},
@@ -66,7 +66,7 @@
"term":"setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.term $DISPLAY",
"fallbackgui":"setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.chromebook.gui $DISPLAY",
"xkb_symbols_gui":"+chromebook(swap_lalt_lctrl)+mac_gui(mac_levelssym)",
"xkb_symbols_term":"+altwin(swap_alt_win)+mac_term(mac_levelssym)",
"xkb_symbols_term":"+altwin(swap_alt_win)+mac_term_chromebook(mac_levelssym)",
"xkb_types_gui":"+mac_gui(addmac_levels)",
"xkb_types_term":""
},
@@ -79,7 +79,7 @@
"gui":"setxkbmap -option;setxkbmap -option ctrl:swap_lwin_lctl; xkbcomp -w0 -i $internalid -I$HOME/.xkb ~/.xkb/keymap/kbd.chromebook.gui $DISPLAY",
"term":"setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.term $DISPLAY",
"xkb_symbols_gui":"+chromebook(swap_lalt_lctrl)+mac_gui(mac_levelssym)",
"xkb_symbols_term":"+altwin(swap_alt_win)+mac_term(mac_levelssym)",
"xkb_symbols_term":"+altwin(swap_alt_win)+mac_term_chromebook(mac_levelssym)",
"xkb_types_gui":"+mac_gui(addmac_levels)",
"xkb_types_term":""
}]

View File

@@ -4,10 +4,10 @@ swapcmd="\/bin\/bash\ \/home\/`whoami`\/.config\/kinto\/xactive.sh"
mkdir -p ~/.config/systemd/user
mkdir -p ~/.config/autostart
cp ./system-config/keyswap.service ~/.config/systemd/user/keyswap.service
cp ./system-config/keyswap.sh ~/.config/autostart/keyswap.sh
cp ./system-config/keyswap.timer ~/.config/systemd/user/keyswap.timer
cp ./kintox11/binary/kintox11 ~/.config/kinto/kintox11
cp ./system-config/xactive.sh ~/.config/kinto/xactive.sh
sed -i "s/{username}/`whoami`/g" ~/.config/systemd/user/keyswap.service
sed -i "s/ExecStart=/ExecStart=${swapcmd}/g" ~/.config/systemd/user/keyswap.service
systemctl --user enable keyswap
systemctl --user start keyswap
systemctl --user enable keyswap.timer
systemctl --user start keyswap.timer

Binary file not shown.

View File

@@ -10,7 +10,7 @@
//
// To compile with static library json-c
// Make sure archive with object files exist ar -t /usr/local/lib/libjson-c.a
// gcc -L/usr/local/lib/ kintox11.c -ljson-c -lXmu -lXt -lX11 -o kintox11
// gcc -L/usr/local/lib/ kintox11.c -ljson-c -lXmu -lXt -lX11 -O2 -o kintox11
//
#include <stdlib.h>
@@ -88,6 +88,39 @@ Window get_focus_window(Display* d){
return w;
}
// get the top window.
// a top window have the following specifications.
// * the start window is contained the descendent windows.
// * the parent window is the root window.
Window get_top_window(Display* d, Window start){
Window w = start;
Window parent = start;
Window root = None;
Window *children;
unsigned int nchildren;
Status s;
// printf("getting top window ... \n");
while (parent != root) {
w = parent;
s = XQueryTree(d, w, &root, &parent, &children, &nchildren); // see man
if (s)
XFree(children);
if(xerror){
printf("fail\n");
exit(1);
}
// printf(" get parent (window: %d)\n", (int)w);
}
// printf("success (window: %d)\n", (int)w);
return w;
}
const char * str_window_class(Display* d, Window w, char *prior_app ){
Status s;
@@ -209,13 +242,13 @@ int main(void){
}
else{
appnames_array[i][n] = json_object_get_string(json_object_array_get_idx(config_obj_appnames, n));
// printf("%s i:%ld n:%ld %s\n",name_array[i],i,n,appnames_array[i][n]);
//printf("%s i:%ld n:%ld %s\n",name_array[i],i,n,appnames_array[i][n]);
}
}
if(appnames_max > appnames_len){
for (n = appnames_len; n < appnames_max; n++){
appnames_array[i][n] = NULL;
// printf("%s i:%ld n:%ld %s\n",name_array[i],i,n,appnames_array[i][n]);
//printf("%s i:%ld n:%ld %s\n",name_array[i],i,n,appnames_array[i][n]);
}
}
@@ -243,6 +276,7 @@ int main(void){
Display* d;
Window w;
char *name;
// for XmbTextPropertyToTextList
setlocale(LC_ALL, ""); // see man locale
@@ -252,6 +286,7 @@ int main(void){
XSetErrorHandler(handle_error);
char * prior_app;
char * current_app;
prior_app = malloc(sizeof(char)*100);
strcpy(prior_app,"none");
@@ -259,27 +294,37 @@ int main(void){
// get active window
w = get_focus_window(d);
w = get_top_window(d, w);
// XFetchName(d, w, &name);
// printf("window:%#x name:%s\n", w, name);
printf("First window name: %s \n",str_window_class(d, w,prior_app));
int breakouter;
for (;;)
{
current_app = str_window_class(d, w,prior_app);
breakouter = 0;
// XFetchName(d, w, &name);
// printf("window:%#x name:%s\n", w, name);
// printf("%s\n","1");
// printf("%s\n",str_window_class(d, w,prior_app));
if(strcmp(str_window_class(d, w,prior_app),prior_app)){
if(strcmp(current_app,prior_app)){
// printf("%s\n","2");
for(i = 0; i < arraylen; ++i){
if(breakouter == 0){
if(strcmp(name_array[i],"gui")){
// printf("%s\n","3");
for(n = 0; n < appnames_max; ++n){
// printf("2nd elseif %s i:%ld n:%ld %s\n",name_array[i],i,n,appnames_array[i][n]);
// printf("3rd elseif (i:%ld == arraylen-1:%d && appnames_array[i:%ld][n:%ld+1]:%s == NULL) && (remap_bool: %i == 0 || 2)\n",i,arraylen-1,i,n,appnames_array[i][n+1],remap_bool);
if (appnames_array[i][n] != NULL){
// printf("%s\n",appnames_array[i][n]);
// If statement for triggering terminal config
if((strcicmp(appnames_array[i][n], str_window_class(d, w,prior_app)) == 0 && (remap_bool == 1 || remap_bool == 2))) {
if((strcicmp(appnames_array[i][n], current_app) == 0 && (remap_bool == 1 || remap_bool == 2))) {
// printf("1st if %s i:%ld n:%ld %s\n",name_array[i],i,n,appnames_array[i][n]);
printf("%s\n",name_array[i]);
printf("%s: %s\n",name_array[i],current_app);
system(run_array[i]);
for(r = 0; r < config_de_max; r++){
if(config_de_array[i][r] != -1){
@@ -293,18 +338,19 @@ int main(void){
breakouter = 1;
break;
} // Else command for ignoring similar app category based on config
else if((strcicmp(appnames_array[i][n], str_window_class(d, w,prior_app)) == 0 && remap_bool == 0)){
// printf("2nd elseif %s i:%ld n:%ld %s\n",name_array[i],i,n,appnames_array[i][n]);
else if((strcicmp(appnames_array[i][n], current_app) == 0 && remap_bool == 0)){
// printf("in 2nd elseif %s i:%ld n:%ld %s\n",name_array[i],i,n,appnames_array[i][n]);
// printf("%s\n","4");
breakouter = 1;
break;
} // Else command for triggering gui config
else if ((i == arraylen-1 || appnames_array[i][n+1] == NULL) && (remap_bool == 0 || remap_bool == 2)){
else if ((i == arraylen-1 && (appnames_array[i][n] == NULL || appnames_max == n+1)) && (remap_bool == 0 || remap_bool == 2)){
// printf("in 3rd elseif (i:%ld == arraylen-1:%d && appnames_array[i:%ld][n:%ld+1]:%s == NULL) && (remap_bool: %i == 0 || 2)\n",i,arraylen-1,i,n,appnames_array[i][n+1],remap_bool);
char *find = "gui";
int gui_idx = in(name_array, arraylen, find);
if(gui_idx >= 0) {
printf("%s\n",name_array[gui_idx]);
printf("%s: %s\n",name_array[gui_idx],current_app);
system(run_array[gui_idx]);
}
for(r = 0; r < config_de_max; r++){
@@ -314,7 +360,7 @@ int main(void){
system(de_rungui_array[de_id_idx]);
}
}
// printf("3rd elseif %s i:%ld n:%ld %s\n",name_array[i],i,n,appnames_array[i][n]);
remap_bool = 1;
fflush(stdout);
breakouter = 1;

View File

@@ -1,3 +0,0 @@
#/bin/bash
systemctl --user start keyswap

View File

@@ -0,0 +1,10 @@
# keyswap.timer
[Unit]
Description=Runs the keyswap.service 5 seconds after boot up
[Timer]
OnBootSec=5s
Unit=keyswap.service
[Install]
WantedBy=default.target