mirror of
https://github.com/rbreaves/kinto.git
synced 2025-08-05 18:38:26 +02:00
- Added browsers category, input/caret detection, includes xbindkeys, and xautomation for one off fixes
This commit is contained in:
@@ -4,16 +4,18 @@ 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="\/home\/`whoami`\/.config\/kinto\/xactive.sh"
|
||||
swapcmd="\/bin\/bash -c \"\/home\/`whoami`\/.config\/kinto\/xactive.sh carrots\""
|
||||
swapstopcmd="\/bin\/bash \/home\/`whoami`\/.config\/kinto\/cleanup.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
|
||||
cp ./system-config/caret_Status.sh ~/.config/kinto/caret_Status.sh
|
||||
cp ./system-config/caret_status.sh ~/.config/kinto/caret_status.sh
|
||||
cp ./system-config/cleanup.sh ~/.config/kinto/cleanup.sh
|
||||
cp ./system-config/.browsers ~/.config/kinto/.browsers
|
||||
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
|
||||
|
Binary file not shown.
@@ -274,8 +274,8 @@ int main(void){
|
||||
char buffer[10240];
|
||||
struct json_object *parsed_json, *config, *config_obj,
|
||||
*config_obj_name, *config_obj_run, *config_obj_run_oninput,
|
||||
*config_obj_de, *config_obj_appnames, *appnames_obj,
|
||||
*init, *de, *de_obj, *de_obj_id, *de_obj_active,
|
||||
*config_obj_run_offinput, *config_obj_de, *config_obj_appnames,
|
||||
*appnames_obj, *init, *de, *de_obj, *de_obj_id, *de_obj_active,
|
||||
*de_obj_run, *de_obj_runterm,*de_obj_rungui;
|
||||
|
||||
int arraylen;
|
||||
@@ -302,6 +302,7 @@ int main(void){
|
||||
const char *name_array[arraylen];
|
||||
const char *run_array[arraylen];
|
||||
const char *run_oninput_array[arraylen];
|
||||
const char *run_offinput_array[arraylen];
|
||||
int init_array[init_len];
|
||||
|
||||
int de_id_array[de_len];
|
||||
@@ -354,10 +355,12 @@ int main(void){
|
||||
config_obj_name = json_object_object_get(config_obj, "name");
|
||||
config_obj_run = json_object_object_get(config_obj, "run");
|
||||
config_obj_run_oninput = json_object_object_get(config_obj, "run_onInput");
|
||||
config_obj_run_offinput = json_object_object_get(config_obj, "run_offInput");
|
||||
|
||||
name_array[i] = json_object_get_string(config_obj_name);
|
||||
run_array[i] = json_object_get_string(config_obj_run);
|
||||
run_oninput_array[i] = json_object_get_string(config_obj_run_oninput);
|
||||
run_offinput_array[i] = json_object_get_string(config_obj_run_offinput);
|
||||
// printf("%s\n%s\n", json_object_get_string(config_obj_name), json_object_get_string(config_obj_run));
|
||||
|
||||
config_obj_appnames = json_object_object_get(config_obj, "appnames");
|
||||
@@ -417,11 +420,13 @@ int main(void){
|
||||
|
||||
char * run_normal;
|
||||
char * run_onInput;
|
||||
char * run_offInput;
|
||||
char * prior_app;
|
||||
char * current_app;
|
||||
char * prior_category;
|
||||
char * current_category;
|
||||
run_onInput = malloc(sizeof(char)*400);
|
||||
run_offInput = malloc(sizeof(char)*400);
|
||||
run_normal = malloc(sizeof(char)*400);
|
||||
prior_app = malloc(sizeof(char)*100);
|
||||
current_app = malloc(sizeof(char)*100);
|
||||
@@ -493,6 +498,7 @@ int main(void){
|
||||
ran_onInput = 0;
|
||||
strcpy(run_normal,run_array[category_idx]);
|
||||
strcpy(run_onInput,run_oninput_array[category_idx]);
|
||||
strcpy(run_offInput,run_offinput_array[category_idx]);
|
||||
for(r = 0; r < config_de_max; r++){
|
||||
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]);
|
||||
@@ -520,7 +526,7 @@ int main(void){
|
||||
// printf("run_onInput: %ld\n",strlen(run_onInput));
|
||||
XEvent e;
|
||||
if(strlen(run_onInput) > 0){
|
||||
while(XNextEventTimeout(d, &e, 1.0, event_ts, last_event, &event_ts, &last_event)){
|
||||
while(XNextEventTimeout(d, &e, .5, event_ts, last_event, &event_ts, &last_event)){
|
||||
if(check_caret(run_onInput) && ran_onInput == 0){
|
||||
// printf("run_onInput: %s\n",run_onInput);
|
||||
system(run_onInput);
|
||||
@@ -528,7 +534,7 @@ int main(void){
|
||||
}
|
||||
else if(!check_caret(run_onInput) && ran_onInput == 1){
|
||||
// printf("run_normal: %s\n",run_normal);
|
||||
system(run_normal);
|
||||
system(run_offInput);
|
||||
ran_onInput = 0;
|
||||
}
|
||||
// e.type = Expose;
|
||||
|
26
setup.py
26
setup.py
@@ -15,6 +15,29 @@ def cmdline(command):
|
||||
)
|
||||
return process.communicate()[0]
|
||||
|
||||
def requirements():
|
||||
print(bcolors.CYELLOW + "You need to install some packages, " +run_pkg+ ", for Kinto to fully remap browsers during input focus.\n" + bcolors.ENDC)
|
||||
print("sudo apt-get install -y " + run_pkg + "\n")
|
||||
run_install = yn_choice(bcolors.CYELLOW + "Would you like to run it now? (Will require sudo privileges.)\n" + bcolors.ENDC)
|
||||
if(run_install):
|
||||
os.system("sudo apt-get install -y " + run_pkg)
|
||||
print("\n")
|
||||
|
||||
check_xbind = symbols_gui_line = cmdline("which xbindkeys").strip()
|
||||
check_xte = symbols_gui_line = cmdline("which xte").strip()
|
||||
|
||||
if len(check_xbind) > 0 and len(check_xte) > 0:
|
||||
print("Xbindkeys and xte requirement is installed.")
|
||||
elif len(check_xbind) == 0 and len(check_xbind) == 0:
|
||||
run_pkg = "xbindkeys xautomation"
|
||||
requirements()
|
||||
elif len(check_xbind) == 0:
|
||||
run_pkg = "xbindkeys"
|
||||
requirements()
|
||||
elif len(check_xte) == 0:
|
||||
run_pkg = "xautomation"
|
||||
requirements()
|
||||
|
||||
try:
|
||||
f = open("defaults.json")
|
||||
except IOError:
|
||||
@@ -152,9 +175,12 @@ if len(defaultde) != 0:
|
||||
user_config['config'][0]['de'] = tweaks_selected
|
||||
# term
|
||||
user_config['config'][1]['de'] = tweaks_selected
|
||||
# browsers
|
||||
user_config['config'][2]['de'] = tweaks_selected
|
||||
|
||||
user_config['config'][0]['run'] = keyboardconfigs[defaultkb-1]['gui']
|
||||
user_config['config'][1]['run'] = keyboardconfigs[defaultkb-1]['term']
|
||||
user_config['config'][2]['run'] = keyboardconfigs[defaultkb-1]['gui']
|
||||
|
||||
os.remove(user_file)
|
||||
with open(user_file, 'w') as f:
|
||||
|
5
system-config/.browsers
Normal file
5
system-config/.browsers
Normal file
@@ -0,0 +1,5 @@
|
||||
"xte 'keydown Control_L' 'key bracketleft' 'keyup Control_L'"
|
||||
Home + release
|
||||
|
||||
"xte 'keydown Control_L' 'key bracketright' 'keyup Control_L'"
|
||||
End + release
|
3
system-config/cleanup.sh
Normal file
3
system-config/cleanup.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
rm /tmp/kinto/caret
|
@@ -7,7 +7,8 @@ Type=simple
|
||||
Restart=always
|
||||
RestartSec=1
|
||||
WorkingDirectory=/home/{username}/.config/kinto
|
||||
ExecStart=
|
||||
ExecStart=/bin/bash -c "/home/{username}/.config/kinto/xactive.sh carrots"
|
||||
ExecStop=/bin/bash /home/{username}/.config/kinto/cleanup.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
|
@@ -2,6 +2,9 @@
|
||||
"name":"gui",
|
||||
"run":"",
|
||||
"run_onInput":"",
|
||||
"run_offInput": "",
|
||||
"symbols":"",
|
||||
"types":"",
|
||||
"de":[],
|
||||
"appnames":[ "" ]
|
||||
},
|
||||
@@ -9,8 +12,21 @@
|
||||
"name":"term",
|
||||
"run":"",
|
||||
"run_onInput":"",
|
||||
"run_offInput": "",
|
||||
"symbols":"",
|
||||
"types":"",
|
||||
"de":[],
|
||||
"appnames":[ "Gnome-terminal","konsole","io.elementary.terminal","terminator","sakura","guake","tilda","xterm","eterm" ]
|
||||
},
|
||||
{
|
||||
"name": "browsers",
|
||||
"run": "",
|
||||
"run_onInput": "killall xbindkeys > /dev/null 2>&1",
|
||||
"run_offInput": "xbindkeys -f $HOME/.config/kinto/.browsers",
|
||||
"symbols":"",
|
||||
"types":"",
|
||||
"de": [],
|
||||
"appnames":[ "Chromium","Firefox" ]
|
||||
}],
|
||||
"init": [],
|
||||
"detypes":["gnome2","gnome3","kde4","kde5","xfce","i3wm"],
|
||||
|
Reference in New Issue
Block a user