mirror of
https://github.com/rbreaves/kinto.git
synced 2025-08-03 09:36:39 +02:00
- Updated kintox11 to read and execute init de commands based on json
This commit is contained in:
@@ -23,38 +23,38 @@
|
|||||||
"description":"Standard Windows 104 Keyboards",
|
"description":"Standard Windows 104 Keyboards",
|
||||||
"gui":"setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.gui $DISPLAY",
|
"gui":"setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.gui $DISPLAY",
|
||||||
"term":"setxkbmap -option;setxkbmap -option altwin:swap_alt_win"
|
"term":"setxkbmap -option;setxkbmap -option altwin:swap_alt_win"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name":"Mac - hid driver",
|
"name":"Mac - hid driver",
|
||||||
"active": false,
|
"active": false,
|
||||||
"description":"Standard Mac Keyboards with Apple driver",
|
"description":"Standard Mac Keyboards with Apple driver",
|
||||||
"gui":"setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.gui $DISPLAY",
|
"gui":"setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.gui $DISPLAY",
|
||||||
"term":"setxkbmap -option",
|
"term":"setxkbmap -option",
|
||||||
"hack": "echo '1' | sudo tee -a /sys/module/hid_apple/parameters/swap_opt_cmd;echo 'options hid_apple swap_opt_cmd=1' | sudo tee -a /etc/modprobe.d/hid_apple.conf;sudo update-initramfs -u -k all"
|
"hack": "echo '1' | sudo tee -a /sys/module/hid_apple/parameters/swap_opt_cmd;echo 'options hid_apple swap_opt_cmd=1' | sudo tee -a /etc/modprobe.d/hid_apple.conf;sudo update-initramfs -u -k all"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name":"Mac Only",
|
"name":"Mac Only",
|
||||||
"active": true,
|
"active": true,
|
||||||
"description":"Standard Mac Keyboards",
|
"description":"Standard Mac Keyboards",
|
||||||
"gui":"setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.gui $DISPLAY",
|
"gui":"setxkbmap -option;xkbcomp -w0 -I$HOME/.xkb ~/.xkb/keymap/kbd.mac.gui $DISPLAY",
|
||||||
"term":"setxkbmap -option;setxkbmap -option altwin:swap_alt_win"
|
"term":"setxkbmap -option;setxkbmap -option altwin:swap_alt_win"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name":"Chromebook",
|
"name":"Chromebook",
|
||||||
"active": false,
|
"active": false,
|
||||||
"description":"Standard Chromebook Keyboards",
|
"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.chromebook.gui $DISPLAY",
|
||||||
"term":"setxkbmap -option;setxkbmap -option altwin:swap_alt_win"
|
"term":"setxkbmap -option;setxkbmap -option altwin:swap_alt_win"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name":"Chromebook - Windows",
|
"name":"Chromebook - Windows",
|
||||||
"active": false,
|
"active": false,
|
||||||
"description":"Chromebook with Windows 104 Keyboard",
|
"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.chromebook.gui $DISPLAY; setxkbmap -device $usbid -option altwin:ctrl_alt_win",
|
||||||
"term":"setxkbmap -option;setxkbmap -option altwin:swap_alt_win",
|
"term":"setxkbmap -option;setxkbmap -option altwin:swap_alt_win",
|
||||||
"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.chromebook.gui $DISPLAY"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name":"Chromebook - Mac",
|
"name":"Chromebook - Mac",
|
||||||
"active": false,
|
"active": false,
|
||||||
"description":"Chromebook with Mac Keyboard",
|
"description":"Chromebook with Mac Keyboard",
|
||||||
@@ -64,8 +64,8 @@
|
|||||||
"defaultapps":[{
|
"defaultapps":[{
|
||||||
"name":"term",
|
"name":"term",
|
||||||
"appnames": [ "Gnome-terminal","konsole","terminator","sakura","guake","tilda","xterm","eterm" ]
|
"appnames": [ "Gnome-terminal","konsole","terminator","sakura","guake","tilda","xterm","eterm" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name":"eosterm",
|
"name":"eosterm",
|
||||||
"appnames": [ "io.elementary.terminal" ]
|
"appnames": [ "io.elementary.terminal" ]
|
||||||
}],
|
}],
|
||||||
@@ -77,24 +77,24 @@
|
|||||||
"name":"gnome-init",
|
"name":"gnome-init",
|
||||||
"description":"Gnome - Remove Superkey Overlay keybinding to Activities Overview",
|
"description":"Gnome - Remove Superkey Overlay keybinding to Activities Overview",
|
||||||
"run":"gsettings set org.gnome.mutter overlay-key ''"
|
"run":"gsettings set org.gnome.mutter overlay-key ''"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 2,
|
"id": 2,
|
||||||
"type": "gnome3",
|
"type": "gnome3",
|
||||||
"active": true,
|
"active": true,
|
||||||
"name":"gnome-term",
|
"name":"gnome-term",
|
||||||
"description":"Gnome - Terminal - Superkey+Space opens Activities Overview",
|
"description":"Gnome - Terminal - Superkey+Space opens Activities Overview",
|
||||||
"run":"gsettings set org.gnome.desktop.wm.keybindings panel-main-menu \"['<Super>Space']\""
|
"run":"gsettings set org.gnome.desktop.wm.keybindings panel-main-menu \"['<Super>Space']\""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 3,
|
"id": 3,
|
||||||
"type": "gnome3",
|
"type": "gnome3",
|
||||||
"active": true,
|
"active": true,
|
||||||
"name":"gnome-gui",
|
"name":"gnome-gui",
|
||||||
"description":"Gnome - GUI - Ctrl+Space opens Activities Overview",
|
"description":"Gnome - GUI - Ctrl+Space opens Activities Overview",
|
||||||
"run":"gsettings set org.gnome.desktop.wm.keybindings panel-main-menu \"['<Ctrl>Space']\""
|
"run":"gsettings set org.gnome.desktop.wm.keybindings panel-main-menu \"['<Ctrl>Space']\""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 4,
|
"id": 4,
|
||||||
"type": "kde5",
|
"type": "kde5",
|
||||||
"active": false,
|
"active": false,
|
||||||
|
@@ -21,6 +21,20 @@
|
|||||||
|
|
||||||
Bool xerror = False;
|
Bool xerror = False;
|
||||||
|
|
||||||
|
int in_int(int a[],int size,int item)
|
||||||
|
{
|
||||||
|
int i,pos=-1;
|
||||||
|
for(i=0;i< size;i++)
|
||||||
|
{
|
||||||
|
if(a[i]==item)
|
||||||
|
{
|
||||||
|
pos=i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
int in(const char **arr, int len, char *target) {
|
int in(const char **arr, int len, char *target) {
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < len; i++) {
|
for(i = 0; i < len; i++) {
|
||||||
@@ -99,9 +113,13 @@ int main(void){
|
|||||||
|
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char buffer[10240];
|
char buffer[10240];
|
||||||
struct json_object *parsed_json, *config, *config_obj, *config_obj_name, *config_obj_run, *config_obj_appnames, *appnames_obj;
|
struct json_object *parsed_json, *config, *config_obj,
|
||||||
|
*config_obj_name, *config_obj_run, *config_obj_de,
|
||||||
|
*config_obj_appnames, *appnames_obj, *init, *de,
|
||||||
|
*de_obj, *de_obj_id, *de_obj_active, *de_obj_run;
|
||||||
|
|
||||||
int arraylen;
|
int arraylen;
|
||||||
int appnames_len;
|
int appnames_len, init_len, de_len;
|
||||||
int system(const char *command);
|
int system(const char *command);
|
||||||
|
|
||||||
size_t i,n;
|
size_t i,n;
|
||||||
@@ -113,10 +131,33 @@ int main(void){
|
|||||||
parsed_json = json_tokener_parse(buffer);
|
parsed_json = json_tokener_parse(buffer);
|
||||||
|
|
||||||
config = json_object_object_get(parsed_json, "config");
|
config = json_object_object_get(parsed_json, "config");
|
||||||
|
init = json_object_object_get(parsed_json, "init");
|
||||||
|
de = json_object_object_get(parsed_json, "de");
|
||||||
|
|
||||||
arraylen = json_object_array_length(config);
|
arraylen = json_object_array_length(config);
|
||||||
|
init_len = json_object_array_length(init);
|
||||||
|
de_len = json_object_array_length(de);
|
||||||
|
|
||||||
const char *name_array[arraylen];
|
const char *name_array[arraylen];
|
||||||
const char *run_array[arraylen];
|
const char *run_array[arraylen];
|
||||||
|
int init_array[init_len];
|
||||||
|
|
||||||
|
int de_id_array[de_len];
|
||||||
|
Bool de_active_array[de_len];
|
||||||
|
const char *de_run_array[de_len];
|
||||||
|
|
||||||
|
// Grab all de variable info needed
|
||||||
|
for (i = 0; i < de_len; i++) {
|
||||||
|
de_obj = json_object_array_get_idx(de, i);
|
||||||
|
de_obj_id = json_object_object_get(de_obj, "id");
|
||||||
|
de_id_array[i] = json_object_get_int(de_obj_id);
|
||||||
|
de_obj_active = json_object_object_get(de_obj, "active");
|
||||||
|
de_active_array[i] = json_object_get_int(de_obj_active);
|
||||||
|
de_obj_run = json_object_object_get(de_obj, "run");
|
||||||
|
de_run_array[i] = json_object_get_string(de_obj_run);
|
||||||
|
}
|
||||||
|
// de ends
|
||||||
|
|
||||||
int appnames_max = 0;
|
int appnames_max = 0;
|
||||||
|
|
||||||
for (i = 0; i < arraylen; i++) {
|
for (i = 0; i < arraylen; i++) {
|
||||||
@@ -159,6 +200,13 @@ int main(void){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < init_len; i++) {
|
||||||
|
init_array[i] = json_object_get_int(json_object_array_get_idx(init, i));
|
||||||
|
int de_id_idx = in_int(de_id_array, init_len, init_array[i]);
|
||||||
|
printf("Running init command: %s\n",de_run_array[de_id_idx]);
|
||||||
|
system(de_run_array[de_id_idx]);
|
||||||
|
}
|
||||||
|
|
||||||
Display* d;
|
Display* d;
|
||||||
Window w;
|
Window w;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user