Compare commits

..

13 Commits

Author SHA1 Message Date
Ben Reaves
e599562ec1 Merge pull request #24 from rbreaves/dev
- Added desktop startup of kinto service
2020-02-05 11:28:15 +00:00
Ben Reaves
b8b81bd907 - Added desktop startup of kinto service 2020-02-05 05:24:40 -06:00
Ben Reaves
22e5462fbc Merge pull request #23 from rbreaves/dev
Updated service
2020-02-05 10:22:55 +00:00
Ben Reaves
72d2007267 - Added restartsec interval on service to 1 second to try and avoid burst limit of systemd 2020-02-05 04:19:44 -06:00
Ben Reaves
3c5b49324c - Removed the creation of the autostart folder 2020-02-05 04:09:20 -06:00
Ben Reaves
3f37ef6e28 - Added back in the enable command for the keyswap service. 2020-02-05 04:01:17 -06:00
Ben Reaves
35cfcce748 Merge pull request #22 from rbreaves/dev
Updated kintox11 binary with better error handling
2020-02-05 09:20:05 +00:00
Ben Reaves
d288048ed4 - Due to updates in kintox11 error handling the services timer is no longer needed, the application will restart properly if it encounters an unrecoverable error on boot, login or any other unexpected event. 2020-02-05 03:01:22 -06:00
Ben Reaves
a30671b08c - Enabled full error handling 2020-02-05 02:47:53 -06:00
Ben Reaves
2f2afecb6d - Added more verbosity to kintox11 and added more functions to increase accuracy of the keyswap on all windows 2020-02-05 02:41:47 -06:00
Ben Reaves
072249d5d4 - Corrected chromebook config file and updated the initialization of the keyswap service file to work when re-running the installer on a currently running version of kinto 2020-02-05 00:12:44 -06:00
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
6 changed files with 52 additions and 12 deletions

View File

@@ -49,7 +49,7 @@
"type":"chromebook",
"active": false,
"description":"Standard Chromebook Keyboards",
"gui":"setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.chromebook.gui $DISPLAY",
"gui":"setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.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_chromebook(mac_levelssym)",
@@ -62,9 +62,9 @@
"type":"chromebook",
"active": false,
"description":"Chromebook with Windows 104 Keyboard",
"gui":"setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.chromebook.gui $DISPLAY; setxkbmap -device $usbid -option altwin:ctrl_alt_win",
"gui":"setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.gui $DISPLAY; setxkbmap -device $usbid -option altwin:ctrl_alt_win",
"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",
"fallbackgui":"setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.gui $DISPLAY",
"xkb_symbols_gui":"+chromebook(swap_lalt_lctrl)+mac_gui(mac_levelssym)",
"xkb_symbols_term":"+altwin(swap_alt_win)+mac_term_chromebook(mac_levelssym)",
"xkb_types_gui":"+mac_gui(addmac_levels)",
@@ -76,7 +76,7 @@
"type":"chromebook",
"active": false,
"description":"Chromebook with Mac Keyboard",
"gui":"setxkbmap -option;setxkbmap -option ctrl:swap_lwin_lctl; xkbcomp -w0 -i $internalid -I$HOME/.xkb ~/.xkb/keymap/kbd.chromebook.gui $DISPLAY",
"gui":"setxkbmap -option;setxkbmap -option ctrl:swap_lwin_lctl; xkbcomp -w0 -i $internalid -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.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_chromebook(mac_levelssym)",

View File

@@ -1,12 +1,18 @@
#!/bin/bash
systemctl --user stop keyswap >/dev/null 2>&1
systemctl --user disable keyswap >/dev/null 2>&1
systemctl --user stop keyswap.timer >/dev/null 2>&1
systemctl --user disable keyswap.timer >/dev/null 2>&1
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/kinto.desktop ~/.config/autostart/kinto.desktop
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 daemon-reload
systemctl --user enable keyswap
systemctl --user start keyswap
systemctl --user start keyswap

Binary file not shown.

View File

@@ -67,10 +67,10 @@ Display* open_display(){
}
int handle_error(Display* display, XErrorEvent* error){
// printf("X11 error: type=%d, serial=%lu, code=%d\n",
// error->type, error->serial, (int)error->error_code);
// xerror = True;
return 0;
printf("X11 error: type=%d, serial=%lu, code=%d\n",
error->type, error->serial, (int)error->error_code);
xerror = True;
return 1;
}
Window get_focus_window(Display* d){
@@ -108,7 +108,7 @@ Window get_top_window(Display* d, Window start){
if (s)
XFree(children);
if(xerror){
if(xerror || w == 0){
printf("fail\n");
exit(1);
}
@@ -121,6 +121,17 @@ Window get_top_window(Display* d, Window start){
return w;
}
// search a named window (that has a WM_STATE prop)
// on the descendent windows of the argment Window.
Window get_named_window(Display* d, Window start){
Window w;
// printf("getting named window ... ");
w = XmuClientWindow(d, start); // see man
// if(w == start)
// printf("fail\n");
// printf("success (window: %d)\n", (int) w);
return w;
}
const char * str_window_class(Display* d, Window w, char *prior_app ){
Status s;
@@ -161,7 +172,8 @@ int main(void){
int system(const char *command);
size_t i,n,r;
printf("Importing user_config.json...\n");
fp = fopen("user_config.json","r");
fread(buffer, 10240, 1, fp);
fclose(fp);
@@ -266,6 +278,8 @@ int main(void){
}
}
printf("Data from user_config.json imported successfully.\n");
for (i = 0; i < init_len; i++) {
init_array[i] = json_object_get_int(json_object_array_get_idx(init, i));
@@ -292,9 +306,12 @@ int main(void){
int remap_bool = 2;
printf("Starting keyswap...\n");
// get active window
w = get_focus_window(d);
w = get_top_window(d, w);
w = get_named_window(d, w);
// XFetchName(d, w, &name);
// printf("window:%#x name:%s\n", w, name);
@@ -339,6 +356,7 @@ int main(void){
break;
} // Else command for ignoring similar app category based on config
else if((strcicmp(appnames_array[i][n], current_app) == 0 && remap_bool == 0)){
printf(" %s\n",current_app);
// 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;
@@ -365,6 +383,12 @@ int main(void){
fflush(stdout);
breakouter = 1;
break;
} // GUI app still - no switching needed
else if ((i == arraylen-1 && appnames_max == n+1) && remap_bool == 1){
printf(" %s\n",current_app);
}
else if ((i == arraylen-1 && appnames_max == n+1)){
printf("%s - Failed to match any keyswap requirements\n",current_app);
}
}
}
@@ -381,6 +405,7 @@ int main(void){
XEvent e;
XNextEvent(d, &e);
w = get_focus_window(d);
w = get_top_window(d, w);
w = get_named_window(d, w);
}
}

View File

@@ -8,6 +8,7 @@ Type=simple
#Group={username}
Environment=DISPLAY=:0
Restart=always
RestartSec=1
WorkingDirectory=/home/{username}/.config/kinto
ExecStart=

View File

@@ -0,0 +1,8 @@
[Desktop Entry]
Name=Kinto
GenericName=Kinto
Comment=Make Linux Type Like it's a Mac
Exec=/bin/systemctrl --user start keyswap
Terminal=false
Type=Application
X-GNOME-Autostart-enabled=true