mirror of
https://github.com/rbreaves/kinto.git
synced 2025-08-04 10:06:41 +02:00
Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e599562ec1 | ||
![]() |
b8b81bd907 | ||
![]() |
22e5462fbc | ||
![]() |
72d2007267 | ||
![]() |
3c5b49324c | ||
![]() |
3f37ef6e28 | ||
![]() |
35cfcce748 | ||
![]() |
d288048ed4 | ||
![]() |
a30671b08c | ||
![]() |
2f2afecb6d | ||
![]() |
072249d5d4 | ||
![]() |
a6b9b1ffbb | ||
![]() |
d8c516c13c |
@@ -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)",
|
||||
|
@@ -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.
@@ -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);
|
||||
}
|
||||
}
|
@@ -8,6 +8,7 @@ Type=simple
|
||||
#Group={username}
|
||||
Environment=DISPLAY=:0
|
||||
Restart=always
|
||||
RestartSec=1
|
||||
WorkingDirectory=/home/{username}/.config/kinto
|
||||
ExecStart=
|
||||
|
||||
|
8
system-config/kinto.desktop
Normal file
8
system-config/kinto.desktop
Normal 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
|
Reference in New Issue
Block a user